Has anyone found a way to trigger a Routine or Switch when the off button is pressed on the Harmony remote? I want to trigger a “go to bed” routine when the harmony activities is turned off after a set time of night.
I’ve already created virtual Switches in ST, one for each Harmony activity (ie…Cable, Music…etc) I’ve also created modes for TV & Music. If I switch activities the virtual switches will turn on and off to match. I could trigger something when “cable” switch turns off but what if I was just switching over to music… I guess i’m not sure how I watch all the switches. Maybe I’m making it harder than it needs to be…
I know you and I have talked about this. I’ve been thinking about it a lot, and I think I have a working protocol.
Activity Off, not Device off.
It appears that the off button on the Harmony remote is not a device off button, it’s an activity off button. And the only activity that it turns off is the specific one that is active at the moment you press the button.
If you have your tablet or phone open to the harmony app at the moment you press the button you can see which activity it is.
At one point, I think there was a power off activity. But if there was it doesn’t exist anymore. Now it’s turning off the activity.
So let’s use a binary switch and turn it on AND off with EVERY activity
The easiest way to make it conditional is to add a single “simulated switch” (that’s a binary type, not a momentary type that’s a binary type, not a momentary type, ) And add it as turning on at the start of every single one of your Harmony activities, and have it turning off at the end of every single one of your harmony activities.
Now at least you captured the physical act of touching the Off button. When the button gets touched on the harmony button remote, that specific binary switch will get turned off in smartthings. That’s your place to start.
If you want the off button to do different things at different times
Now, you can put your conditional logic over on the smartthings side by deciding what routines will run off of that switch changing at different modes, or with certain presence, or time of day, or your other conditionals.
This should work because you’re not going to put anything on the SmartThings side to happen when that switch goes on. When it’s going on is irrelevant. It’s only going on so that you can turn off later.
Conditionals will all be based on subscribing to that switch going off. That’s why it has to be a binary type.
Harmony won’t turn off a device which is needed by the next activity
And another basic harmony principle is that if an activity requests that a device turn off, but the next Activity requests that device turned on, that device will be left on rather than toggle off Toggle on. Again, that’s what we want. The power switch becomes irrelevant to everything except the moment when you press the off button on the button remote or use a voice command or other method to turn that switch off.
now it’s up to you to make sure that switch gets added as both a start step on and end step off to every new Harmony activity you create
However, this creates a maintenance requirement for you. Every single time you create a new harmony activity, you must add this binary switch turning on at the start of the activity, and turning off at the end of the activity.
But I think this approach should work. It’s working now in my set up I been testing it for a couple of days.
Device Type Matters
Note that the device type makes a big difference. You can’t pick just any random virtual device type for the switch. It needs to be a binary switch. “Simulated switch” should work. This was the only way I was able to find you could capture the physical moment of pressing the off on the button remote and passing that information to SmartThings as base information.
With that, you can have different SmartThings events happen if it’s late at night, if it’s in the middle of the day, etc. If anyone has a less fragile way of doing this, please let us know.
Again, I’d love to see an easier way of doing this. But at least it seems to work.
Thanks again for your help. So it sounds like I’m on the right track… I have the binary switches working, I can change harmony activites via the ST app. (ie…I press the music switch on and the cable switch turns off and the activity changes to music). It’s the last steps I don’t understand yet. How do I trigger on ALL switches being off? Smartapp?
I think what I would do is make sure you have a virtual switch that when turned on will initiate your good night action, then in your activity that you are shutting off that you want to initial good night add a step that turns on your good night switch. I haven’t tested this and as I type it I think you’re gonna have to do some playing around to get it right but should be able to accomplish it.
So if JD is right that switching from one activity to the next doesn’t turn off the switch as long as it is used for the next activity, then all you need is to create a new virtual switch that you add to each activity you have. That way, it will only get turned off when all activities are off, namely when you push the off button. As JD mentioned, this is not how things were working in the past, but is worth trying. I am testing now and will report if it works for me.
Instead of trying to trigger on multiple switches being on you’re going to dedicate a single switch as your “virtual power” Switch.
Add that switch as an ending sequence step to every single activity you have, as shown above. And also add it going on as a starting sequence step to every single activity as discussed above.
Now in SmartThings you can use Alexa helper or “big switch for routines” or a similar smart app to start whatever routine you want to run when that switch goes off. Nothing activated by going on. Just by going off.
Here’s what will happen.
One) you start any activity in harmony. Maybe it’s watch TV. That activity will turn on your virtual power switch.
So now the TV is on, and the virtual power switch is on and the watch TV activity is active.
Two) you switch to a different activity in harmony. Maybe listen to music. That activity says it’s supposed to turn your virtual power switch on but since it’s already on, it just stays on. Your old watch TV activity is going to end, and it’s supposed to turn your virtual power switch off when it ends, but it isn’t going to because that switch is needed in the listen to music activity.
So now the TV is off, the music is on, and the power switch is still on. The listen to music activity is active.
Three) you hit the off button on the Harmony remote. This will end the listen to music activity. Since there is no next activity, apthe listen to music activity will turn off the virtual power switch.
So now the tv is off, the music is off, there are no harmony activities running, and the virtual power switch just turned itself off.
since the virtual power switch actually finally had a state change to off, now your chosen routine will run in smartthings.
So with this approach, we don’t need to check the multiple other switches for the multiple other activities. It’s just that the power switch will come on with the first activity and it will stay on until you turn off the last activity, no matter what that last activity is.
JD strikes again! Have had an open ticket with Harmony for more than a year to fix the off button on the remote. I cannot believe they didn’t let me know that it was finally fixed. So the scenario that JD came up with works. Here is the log of events recorded on ST side. Note that switch VS Activity was turned on with first activity and then it wasn’t turned off until I pushed the off button. Harmony only sent ON command every time I flipped through different activities. Great idea JD, thank you!
I think I’m going to create one more virtual switch to control/watch the overall “on” status of the system. I’m going to keep my individual switches for each activity since it works very well in the smart tiles app.
I’ll let you know how it goes… Next is a light level thing for the living room so different lights will turn on with different activity but only if its too dark.
Edit: Yep… Seems to be working well. THANKS JD. I almost had to message you again. I keep forgetting about “Smart Lighting” in smartapps. I keep wanting to use “Routines” as like scenes but I see now the scene is the smartapp and the trigger can be any Virtual switch. Price for switching systems.
I also wanted to turn off all entertainment devices when I click on “Good Night” routine. I use Harmony only for entertainment devices and smarthings hub for all lights and other devices. So solved the problem in the following way.
Added a LIFX to harmony. Since it is a wifi bulb, you can add it to multiple hubs. You can use any wifi based device for this purpose
Created an activity in harmony using only the LIFX bulb
In the activity, turn off the bulb
Save the activity and call it “All devices off” or whatever you want to call it.
Add this activity to your “Good Night” routine in smarthings
Since harmony turns off all other devices that are not required when you click on any activity, it turns off all entertainment devices in the above case.