Creating a toggle switch
Posted: Monday 05 March 2018 20:16
I'm struggling with something that seems like it should be really simple. I've bought a lightwave RF switch that is designed to select lighting scenes. It is essentially a selector switch with 5 options.
I want to repurpose the buttons as toggle switches, so that rather than choosing between one of 5 scenes, each button can be used to toggle a device on and off.
Example: if I press button 3 once, a device switches on. If I press it again, the device switches off. I thought I could create a blocky logic as follows:
If lightwave switch = button 3, and device switch is off, set to on
Or
If lightwave switch = button 3 and device switch is on, set to off.
The problem with this is that the lightwave switch is a selector, so once I press button 3, it stays selected until I select another button. This results in an endless loop as the device switches on and off until I press a different button on the lightwave switch.
Is there a way to count the number of presses of a button? There is a record in the log each time I press the button so it seems like it should be possible. If I could count the number of presses, I could possibly create some logic to identify if pressing button 3 should be an On action or and Off action.
Or is there some other way? Any guidance would be appreciated.
I want to repurpose the buttons as toggle switches, so that rather than choosing between one of 5 scenes, each button can be used to toggle a device on and off.
Example: if I press button 3 once, a device switches on. If I press it again, the device switches off. I thought I could create a blocky logic as follows:
If lightwave switch = button 3, and device switch is off, set to on
Or
If lightwave switch = button 3 and device switch is on, set to off.
The problem with this is that the lightwave switch is a selector, so once I press button 3, it stays selected until I select another button. This results in an endless loop as the device switches on and off until I press a different button on the lightwave switch.
Is there a way to count the number of presses of a button? There is a record in the log each time I press the button so it seems like it should be possible. If I could count the number of presses, I could possibly create some logic to identify if pressing button 3 should be an On action or and Off action.
Or is there some other way? Any guidance would be appreciated.