Logic Machine Forum
Change in status - Tagged objects - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Change in status - Tagged objects (/showthread.php?tid=720)



Change in status - Tagged objects - Mr.D - 06.04.2017

Hi,

I am also trying to write a script that will turn on the lights (object 1/1/1, value) if there is a change in object a, b, c or d (tagged "alarm"). However, this should only happen if object (2/2/2 has value 1). 
The idea of the script is that it should function as kind of alarm at night. We have sensors in all doors and windows, and if the alarm is on (2/2/2, 1), and there is a change in status for one of the sensors then the lights in the bedroom (1/1/1, 50) should turn it self on to 50%.

Any help would be appreciated [Image: smile.png]

Mr.D


RE: Change in status - Tagged objects - Erwin van der Zwart - 06.04.2017

Hi Mr. D,

Try one of the 2 scripts below : (put one of them in a event based script linked to the tag 'alarm')

Code:
-- Without input value check
if grp.getvalue('2/2/2') == true then
  grp.write('1/1/1', 50) -- or 128
end
Code:
-- With input value check on event value
if grp.getvalue(event.dst) == true then
 if grp.getvalue('2/2/2') == true then
   grp.write('1/1/1', 50) -- or 128
 end
end

BR,

Erwin


RE: Change in status - Tagged objects - Mr.D - 07.04.2017

Hi Erwin,

The first script works best since the lights get turned on with any change in status from the tagged objects. The last script only turns the lights on when the change in status goes from value 0 to value 1. Your last script came in handy for a different script I have made.

Thanks for your help Smile

Mr.D