Blockly to switch lights when alarm = On

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
wormiedk
Posts: 15
Joined: Wednesday 18 May 2016 5:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Blockly to switch lights when alarm = On

Post by wormiedk »

Hi there.

I tried creating a blockly script to make my lights turn on if the alarm is in the on state. My alarm is a simple threeway switch ("On", "Off", "Home on"), as I have not found a way to change the "armed" state of my home using a switch.

My current blockly looks like this. None of the events are ever triggered.
Screen Shot 2016-07-25 at 09.47.23.png
Screen Shot 2016-07-25 at 09.47.23.png (143.29 KiB) Viewed 1294 times
My devices look like this
Screen Shot 2016-07-25 at 09.47.45.png
Screen Shot 2016-07-25 at 09.47.45.png (29.17 KiB) Viewed 1294 times
Screen Shot 2016-07-25 at 09.47.36.png
Screen Shot 2016-07-25 at 09.47.36.png (32.02 KiB) Viewed 1294 times
Can anyone suggest how to fix the problem or suggest a Lua script alternative?
Could timers on a switch be conditional e.g. if "Alarm=On" the timer is active else it is not?
mrf68

Re: Blockly to switch lights when alarm = On

Post by mrf68 »

Hi,

the first line states ".... and Alarm = "On" "

A selector has numeric values, i.e. 0 for Off, 10 for Level1, etc. So I think your blockly needs to check not if it is "On" but if it is "10". And I expect it not to be text (that is not between quotes) but as a number.


I should test it before I post something here. :oops:
It works with the text blockly, so I need to investigate it some more.

Did you choose the blockly to be "Device" or "Time"? When I test it as Device, it doesn't work, but as Time it will.
selector.jpg
selector.jpg (8.82 KiB) Viewed 1271 times
wormiedk
Posts: 15
Joined: Wednesday 18 May 2016 5:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly to switch lights when alarm = On

Post by wormiedk »

Thanks. I had my script set to "Both". I tried modifying it to time but it still did not work.

I got it working by adding an extra and testing if a light was off or on in each of the statements.
maomanna
Posts: 94
Joined: Monday 30 November 2015 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly to switch lights when alarm = On

Post by maomanna »

If Alarm is a multi selector, you need to set it as 0, 10 or 20.

You can also look at my blockly:
http://domoticz.com/forum/viewtopic.php ... 043#p71013
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest