I have the following rule sets which are used to combine various Window Status Displays using BJs Waveline Window sensors. If a window is open, it's sending a 255, if it's just flip-open, it's sending 89 and if it's closed, it's sending a 0.
You can use the same values to show the status via a LED - 0 = green, 89 = yellow, 255 = red.
I now use the below rule set to combine the sensors, so the highest value is always the one that counts.
I'm pretty sure that there is an easier way using Lua scripting.I tried it once, but debugging is a pain :-)
Basically you would need to get the highest value of the sensors - so something like:
value = max(Sensor1, Sensor2, Sensor3);
set("status", value)
Okay…one last thing for today :-)
I have the following rule sets which are used to combine various Window Status Displays using BJs Waveline Window sensors. If a window is open, it's sending a 255, if it's just flip-open, it's sending 89 and if it's closed, it's sending a 0.
You can use the same values to show the status via a LED - 0 = green, 89 = yellow, 255 = red.
I now use the below rule set to combine the sensors, so the highest value is always the one that counts.
I'm pretty sure that there is an easier way using Lua scripting.I tried it once, but debugging is a pain :-)
Basically you would need to get the highest value of the sensors - so something like:
value = max(Sensor1, Sensor2, Sensor3);
set("status", value)
should do the trick.
Any ideas?
hi,
you can look at :
http://www.lua.org/manual/5.1/manual.html
http://lua-users.org/wiki/MathLibraryTutorial
Anthony.