I have a JS that I've added via the Load custom JavaScript file App. The first two entries are looking for sensors 5 and 9 to trigger on motion. This part of the script works just fine. The BASH scripts below (movement-alert.bash and basement-alert.bash) send my iPhone text messages when they are triggered.
However, the last two entries for device 9 are for the temperature and LUX don't work. The device is an Aeon Multisensor that shows motion, temperature, humidity, battery status and LUX. I have the "temperature.bash" and "lights.bash" scripts in the .syscommands file. I doubt there's a typo anywhere in the scripts...they are pretty simple. I suspect the "if" statement in the JS file is malformed. If I want to check for 25.0 C and 20 LUX, is the JS below correct? I have also tried 25.0 and 20 without the quote marks. The actual values being displayed by the sensor is 21.7 C and 7 LUX but I don't receive text messages. Thanks in advance! Here is the file:
Code: Select all
zway.devices[5].instances[0].commandClasses[48].data[1].level.bind(function() {
if (this.value == "1")
system('/opt/z-way-server/automation/userModules/movement-alert.bash');
});
zway.devices[9].instances[0].commandClasses[48].data[1].level.bind(function() {
if (this.value == "1")
system('/opt/z-way-server/automation/userModules/basement-alert.bash');
});
zway.devices[9].instances[0].commandClasses[49].data[1].level.bind(function() {
if (this.value < "25.0")
system('/opt/z-way-server/automation/userModules/temperature.bash');
});
zway.devices[9].instances[0].commandClasses[49].data[3].level.bind(function() {
if (this.value < "20")
system('/opt/z-way-server/automation/userModules/lights.bash');
});