Page 1 of 1

Trigger Switch A only when B changes state from On to off

Posted: Wednesday 22 May 2019 21:13
by superczar
TL;DR : I have a use-case which requires me to set Switch A to off when switch B switches off
However , I want this to happen only when switch B changes state from On to off i.e. if I switch A back On while B is off, it shouldn't be triggered off again.

Real life scenario - We get frequent powercuts, up to 2-3 a week
We have a DG backup that takes between a minute to two to start

When the utility power goes off, I have a ping switch that switches off and comes back on when utility power is back on
In such an event, I want my harmony hub to switch off my TV/AVR etc (which are on a UPS)
However, once the DG backup comes back on and if I switch the TV/AVR on again, standard blockly If-Do will trigger it back off unless the mains power is back again

I was hoping that I could trigger the harmony switch to off only when the ping switch changes state from on to off
For anything else (stays off or goes from off to on) , the harmony switch is not triggered

PS: Sorry if I missing something fundamental
I did read through the dzvents commented sample script but could not figure this out

Re: Trigger Switch A only when B changes state from On to off  [Solved]

Posted: Wednesday 22 May 2019 21:22
by snellejellep
you could just put in the off action box in your switches properties a command like this:
http://127.0.0.1:8080/json.htm?type=com ... tchcmd=Off

edit the 200 after idx= to your switch a idx and put the command in the off action box in switch b

make sure you have whitelisted 127.0.0.* in the local networks in the settings menu

Re: Trigger Switch A only when B changes state from On to off

Posted: Wednesday 22 May 2019 21:30
by superczar
Thanks - That was so simple and elegant
I feel stupid now :)

Re: Trigger Switch A only when B changes state from On to off

Posted: Wednesday 22 May 2019 21:31
by snellejellep
superczar wrote: Wednesday 22 May 2019 21:30 Thanks - That was so simple and elegant
I feel stupid now :)
don't be, we are all here to help each other and learn new things.