How to turn off current "unknown" harmony activity


#1

Using webcore with Hubitat, and the built in Harmony integration.

I have a virtual switch “VS-TV On/Off” that I want to use to turn my TV and reciever on and off using a harmony hub. I have activities programmed, power options set, etc, and can control all of that fine. My problem is, I can’t find a reliable way to turn everything off. I think I could do it reliably by knowing what the current activity is, and then turning it off. I tried turning on a generic “Watch TV” activity (to make it the current one) and then turning it off, but it isn’t reliable.

Getting the current activity and storing it in a global variable is working fine. But…how can I set up an action to turn that activity off? I can’t find a way to access the current acivity or a variable. The harmony device has a “deviceCommand” action available, but I have no idea if that is usable or not.


#2

I think this can be quite tricky. I used harmony to control an IR lighting scene controller, and wonder if some of my methods may be helpful to you. An additional problem can be that sometimes an IR signal doesnt work, leaving you in an unknown state. Also, I had to work with the scene controller being operated manually.

The first step was to connect the scene controller to an outlet that I could monitor its power usage from webcore. In my case I was able to fit a fibaro relay in the consumer unit, but guess you could use a suitable outlet.

I then used a virtual switch to turn on/off & set scenes (using the dim level to denote each scene)

Interactions from the VS via webcore then sent the relevant activities to harmony.

Changes to the power used would also update the VS, but not activate any harmony activities.

I also used the harmony activities differently than the way they are intended to be used, and I think the way you use them. I made each activity perform a set action when it was turned on, but do nothing when it was turned off. Having turned on an activity within webcore, I turn it off again 1 sec later. In effect the whole state is held in webcore via the virtual switch, rather than the harmony activities.

I suspect my setup may be simpler than what you are trying to achieve, but hope some of the above may help you think around how to do it.

I intend to write up my full solution at some point and post on here, but it just needs a bit more tweaking to iron out a few minor issues first. I’m happy to share the current piston if you think it may be useful, but just thin kit would need some explanation to understand how it works.


#3

I came up with something that seems to work pretty well. “Switch 61” is the virtual “TV On/Off” switch that gets triggered from a dashboard, presence sensors, Google Home, etc. The other switches are all Harmony activity switches.