Z-Way undefined variable error.

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
jstaffon
Posts: 80
Joined: 29 May 2015 04:47

Z-Way undefined variable error.

Post by jstaffon »

I'm getting the following error message which seems to be related to the "Load Custom Java Script" app:

"Cannot instantiate module: CustomUserCodeLoader: Error: Uncaught ReferenceError: zway is not defined"

It appears in the "Events" screen in the Z-Way Smart Home webpage. When this message appears, the custom scripting does not work. My script sends my cell phone a text message when sensors trigger. When the Z-Way service is started and the error message doesn't appear, everything works as designed. The filename in the app is as follows:

userModules/sensorsend.js

The "sensorsend.js" script is as follows:

--
zway.devices[5].instances[0].commandClasses[48].data[1].level.bind(function() {
if (this.value == true)
system('/opt/z-way-server/automation/userModules/fra.bash');
});

zway.devices[15].instances[0].commandClasses[48].data[1].level.bind(function() {
if (this.value == true)
system('/opt/z-way-server/automation/userModules/water.bash');
});
--

NOTE: The "--" are not part of the script file. They are used in this post to denote where the script information starts and stops.

The "sensorsend.js script sends a text message when movement is sensed and when a water sensor senses water in the basement.

Remember, if the error message DOES NOT appear in the "Events" page, everything works fine. It's as if the sequence in which variables ("zway" in this case) are defined causes the error.

Thanks in advance!
jstaffon
Posts: 80
Joined: 29 May 2015 04:47

Re: Z-Way undefined variable error.

Post by jstaffon »

I'm running v2.2.2 now on jessie. The "Events" screen now shows different information. How do I find the logging that would show the error above? I've looked in z-way-server.log in /var/log, but can't find that error and my javascript code has stopped working. Thanks in advance.
jstaffon
Posts: 80
Joined: 29 May 2015 04:47

Re: Z-Way undefined variable error.

Post by jstaffon »

Problem resolved with a new image of jessie and v2.2.2-test-new-webserver version of the software.
Post Reply