Combine switch and sensor in a single virtual switch
Posted: Thursday 02 March 2017 19:11
Hi everyone!
I've integrated an alarm system inside Domoticz by using:
- Philio PAN06 switch to control the arm and disarm of the alarm by triggering a 2 seconds pulse from each channel (1st channel pulse means arm, and the 2nd means disarm). This is needed as the module doesn't have a battery backup and I don't want the alarm to be disarmed by simply cutting my house's power wires.
- Universal Fibaro Sensor conected to the alarm output to get the armed/diarmed status. Why is this required, because the alarm might not be armed if there's a failing zone or another type of problem, so I cannot rely just on the switch working fine.
This is working perfectly but it lacks some usability as I (well... to be honest it's my wife) would expect to have a single switch that:
- When clicked from off state, triggers the alarm arming, and only transitions to "on" state when the alarm sensor reports the "on" state.
- When clicked from on state, triggers the alarm disarming process, and only transitions to "off" state when the alarm sensor reports the "off" state.
I've tried to implement this with a virtual switch and with events. I've successfully created a virtual switch that:
- When clicked from off state, triggers the alarm arming and keeps as on even when the pulse ends.
- When clicked from on state, triggers the disarm and keeps as off.
But I've not been able to block the trigger to be displayed as on/off depending on the sensor state. When trying to do so with an event, the whole system enters a loop and keeps trying to arm the alarm.
I've also been trying to use LUA but I get to the same loop.
TLDR; how do you make a switch stay off even after being activated until a sensor reports on state, and how do you make it to stay as on even after a deactivation attempt until a sensor reports off?
Any ideas or guidance will be welcome .
Thanks!
I've integrated an alarm system inside Domoticz by using:
- Philio PAN06 switch to control the arm and disarm of the alarm by triggering a 2 seconds pulse from each channel (1st channel pulse means arm, and the 2nd means disarm). This is needed as the module doesn't have a battery backup and I don't want the alarm to be disarmed by simply cutting my house's power wires.
- Universal Fibaro Sensor conected to the alarm output to get the armed/diarmed status. Why is this required, because the alarm might not be armed if there's a failing zone or another type of problem, so I cannot rely just on the switch working fine.
This is working perfectly but it lacks some usability as I (well... to be honest it's my wife) would expect to have a single switch that:
- When clicked from off state, triggers the alarm arming, and only transitions to "on" state when the alarm sensor reports the "on" state.
- When clicked from on state, triggers the alarm disarming process, and only transitions to "off" state when the alarm sensor reports the "off" state.
I've tried to implement this with a virtual switch and with events. I've successfully created a virtual switch that:
- When clicked from off state, triggers the alarm arming and keeps as on even when the pulse ends.
- When clicked from on state, triggers the disarm and keeps as off.
But I've not been able to block the trigger to be displayed as on/off depending on the sensor state. When trying to do so with an event, the whole system enters a loop and keeps trying to arm the alarm.
I've also been trying to use LUA but I get to the same loop.
TLDR; how do you make a switch stay off even after being activated until a sensor reports on state, and how do you make it to stay as on even after a deactivation attempt until a sensor reports off?
Any ideas or guidance will be welcome .
Thanks!