executeFile() does not work correctly on main.js (automation)

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
crvchul
Posts: 7
Joined: 14 Jun 2013 15:41

executeFile() does not work correctly on main.js (automation)

Post by crvchul »

Hello,

It seems that the variables doesn't set correctly with the executeFile() Method.
For example

function startAutomation() {
// load global varible _scripts_configs
debugPrint("Starting JS Automation engine");
_scripts_configs = null;
executeFile(configFile);
loadAndInitModules();
_scripts_configs = null;
}

_scripts_configs is empty at the point where loadAndInitModules() gets called.
Is this a problem on my site?
User avatar
PoltoS
Posts: 7571
Joined: 26 Jan 2011 19:36

I don't know what is in your

Post by PoltoS »

I don't know what is in your configFile variable (it should be the name to the JS file). Please check it.
crvchul
Posts: 7
Joined: 14 Jun 2013 15:41

I did not modified anything.

Post by crvchul »

I did not modified anything. The files are "out of the box".

var configFile = automationRoot + "config.js";

and the config.js contains

_scripts_configs = [{
name: 'AutoOff',
module: 'AutoOff.js',
config: {
tags: 'AutoOff5sec',
delay: 5
}
}, { and so on....

If I initialize the object directly in the main.js file (by just copying the content) everything works fine until the point where "function loadModule(moduleName) {" wants to execute the external .js file defined in the object. This also doesn't work.

How does executeFile() works? Because it isn't so straightforward in javascript to include oder load other javascript files.
Post Reply