[RELEASE] Inverse Link Two Switches

Over the years my logic in virtual switches got messy - instead of cleaning, i just wrote an app instead!

This small app gives you 'flip' of two switches - if one goes ON, the other goes OFF. Simple as that.

**Edit - so when I searched HPM for similar apps - I got to the letter N and stopped looking -
Now I know there are at LEAST two other apps that do the exact same thing!

So- my apologies!

Every developer who reads this is cringing. Yes, I understand boolean - if a switch is off it is not on. But I get easily confused in my old age.
I originally created a switch for Awake. It happened to be a virtual switch and I used it in a lot of rules - tie it to my external tools and apps such as Alexa. Then somewhere I created a virtual switch called Sleeping. Yes. Robert - I could go change all 'sleeping' switch references to 'Not Awake' but that just made my head hurt. I don't speak 'Not Awake'. I say - 'Asleep'.
This also goes with Home/Away, and other pairings. So instead of hunting down all the pairings and relationships, fixing all the logic and almost assuredly breaking stuff... I just use this app to force my switch pairings to be inversed.

the Parent app can be disabled with a switch of it's own. I thought about implementing the ability to disable individual children but that seems more ridiculous than the initial concept already was.

It is a Parent/Child app so it can handle numerous pairs, and not make a mess of the GUI. I stole snippets of stuff and gave some raw references as I felt necessary but in the end, This just really works well for me.
It is in HPM now, and I've tested the app, install etc. and it should be a fairly simple step via HPM to put in play if you want to check it. I setup log and debug as well. shrugs A fun morning.
https://raw.githubusercontent.com/jshimota01/hubitat/main/Apps/inverse_link/inverse_link.groovy
https://raw.githubusercontent.com/jshimota01/hubitat/main/Apps/inverse_link/inverse_link_child.groovy

2 Likes