Momentary vitrual switches, normally on, double pole

I have created two simple virtual switch types that I could not seem to find in the forums but they made things much simpler for my personal setup, particularly when integrating with Echo. I will preface this by saying I don’t know anything about the groovy language (I program in C and C++). The UI part of the second switch is messed up, but I don’t ever use it directly, so I haven’t messed with it. If anyone wants to clean up the second one, have at it.

The first is just a switch that is normally closed. I have a number of lighting groups/scenes that have lights which can be controlled individually. I created a setup where my lighting groups/scenes each have a normal momentary button tile so I can turn them on at any time regardless of the current lighting state. But if I want to turn off an individual light, I have a normally open switch that will always allow me to turn that one off directly.

This worked fine, but when it came to activating and switching Harmony activities, things got a little more complicated. If I commanded Echo to turn on my TV, I could have a momentary switch do this, and return to the off position. However, this does not allow me to command that activity off now, since the switch it already off. I could have made it a non-momentary switch, but that would have made things even worse. What if I turned on the TV, then switched to (turned on) Roku, then switched to (turned on) Music? Now I have 3 switches in the on position, and if I turn off just the last one, the others are not ready to be turned on again. I initially created a normally on switch so that I could “turn off entertainment” and it would end the current activity, but I still didn’t care for this.

So I created a double-pole momentary switch for each activity. It can be turned on or off, but will return to a non-connected state. This works well for the lights also. For example, I have a switch for “all lights,” and no matter what scenes/groups are on I can always turn “all lights” on or off because the switch will always return to the middle state.

Maybe there is a better way to accomplish this, but I did not come across one. If you want to use this or modify it, have at it.

4 Likes

The MomentaryNormallyOn switch is exactly what I have been looking for. Makes some things with the Amazon Echo work with more natural language.

In my case, I no longer have to say “turn on” an “off” button. Now I can just use one of these and tell the Echo to turn it off. Works great!

Thanks for the double-pole momentary switch type. Solves the lack of Google Home grouping.

Hi Damon,

I created a similar code to your double pole one, but with proper UI, as yours one didn’t supported it.

The UI contains 2 momentary buttons (one on, and one off) which works for same device, and can also be controlable by Google Home.

Feel free to try it, if you want :slight_smile:

1 Like

This worked great for me for both arming / disarming my blink system (via IFTTT location) and for groups of Hue bulbs. Now it doesn’t matter if a couple of living room lights get turned on. I can turn off the group and it still works.