You’re in a situation where harmony does not report a devices status through the API. In my opinion, this is a major design flaw of harmony (Not home assistant). Harmony just doesn’t give that information out which is kind of counter intuitive for any device automating harmony.
So with that being said, you really only have 1 option.
Create an input boolean that represents the state of your device.
input_boolean:
device_64156777:
Then use that input boolean to represent the state of your switch, while also toggling the input boolean.
You may need to separate turn_on and turn_off into their own scripts. if the turn_on section does not allow multiple actions. A generic script for all devices that power on and power off would look like this:
Keep in mind, if you go the script route, you need to name all input booleans: input_boolean.device_<device_number>, e.g. input_boolean.device_64156777
A little update: configuration before is again working one-way, like before if TV is off, it turns it on and slider goes back to “OFF” position. I’m stuck
And another question: how do I rename my switch, because configuration fails if I change “remote” to something else?
You can’t lose device. Do not name your input booleans starting with a number. You’ll have nothing but problems.
You can’t use these buttons if you don’t follow the naming convention laid out. Naming it device_tv will cause it to break. It needs to be named device_64156777. Or the template needs to change drastically.
So your options are:
Name your input_boolean entity_id’s device_<number> and use the original script that I created
of
Come up with a new template that satisfies your current need, mapping tv to the number 64156777.
Okay, I got the dea now, thanks alot, mate! But still,
have to loose ending quote, the " symbol, otherwise it’s not working. I renamed switches to my liking and next stop is volume control in HA, but I want to do it myself. Thank you again for your guidance!
Your problem is you’re not using Activities properly, unless it’s things like a light you may or may not want on during a particular activity. Devices like a TV should only be switched as part of an activity start or stop.
Assume you mean it doesn’t report what it thinks the state is as Harmony doesn’t know for sure, it just assumes it has turned something on or off. If using Activities as intended it’s not a big deal to let HA use the Activity status to come to the same conclusion.
Right but if you just want to have a device with an on/off state and no activity (which is what he is doing), it’s not possible with harmonys api. Even if the device reports a state. For example, I have network receivers that report states. Harmony does not report this to home assistant.
Like I said though, it doesn’t report it’s state to Harmony, Harmony just assumes based on the buttons you’ve pressed as it is really just a glorified IR remote which is one way by definition.
If the device does report a state you can use that directly with HA. For example, I have several lights and a fan switched by Harmony but I control them via the emulated Roku component in HA so their state is registered fine. I also have things like my AVR and TV controlled directly by Harmony but they also have their own integration within HA so again you can get real reports of state change directly to use in automations.
I don’t know why this is even a debate… the poster asking the question has only mentioned harmony without an activity and just a device. Therefore, to make a switch work you have to assume a state, which is what was done.
Thank you for this guide, I was able to setup my harmony remote and my denon receiver. I just had to remove a couple of lines from the automation to make the volume slider work since denon now uses 0-100 for its volume and no longer dB. Just figured I would post the code in case it might help out someone else.
I’m sorry, couldn’t answer right away. What do you mean “should”, why can’t I choose how to control devices? I would very much like having actual state in realtime, but I am yet to test integration possibilities for everything I need. Plus, during activties I have to account for several devices controls, which has same buttons with different actions for each device, like red/yellow/blue/green buttons, for instance. I need those button for media player and receiver both, but there is only a one set of them on Harmony Remote, thus I have to switch to “Devices” mode, choose needed, perform required action and switch back to the current activity mode. So, yes, I do have need for individual commands use.
And as for individual integration, it works well if all components have corresponded integrations up and running, which is hardly ever the case, compromises are everywhere.
Hi HeffeD
Thanks for sharing your way of doing it with an Onkyo reciever.
I have the same issue than you with the volume slider (kind of works but go down to 0 after 1 second)
Did you find a solution ? Could you please share ?
Thanks in advance
(and thanks petro for the work done!!)
Edit: Adapting code from Mar16 is working (22nd of May post). Thanks everyone
This is what i have for an Onkyo NR626.
Min Volume:0 (0 as well on hassio)
Max Volume: 78 (0.975 in hassio)
so Step = 0.0125
(sometimes on the sliders it shows 23.9999999 instead of 24 but not going back to 0)