LogitechHarmony Companion Remote commands

I have several activities that run on a Logitech Harmony Hub. These are somteimes quite complex and i want to keep these activities as they are.

I generall use a Harmony Companion remote to control these. Recently, i had to replace a remote and had some trouble as these are discontinued.

As I have other remotes as cards in Home Assistant, i thought i could have a backup virtual companion remote. However, i don’t fancy having to write scripts to reflect all these activities plus the different command for each button depending on current activity. This would utilise the Harmony Hub integration but with 6 activities and then the 6 x number of remote button commands, this would be messy.

So, is there a means in home assistant of sending just the remote command (e.g. Fast Forward) to the Harmony Hub? This would mean i could just send the command for each button once and let the hub decode this into the activity action?

In your config folder, you will find a file for the harmony config. It contains the commands and device codes you need. You may need Samba Share to access the file.
In automations, use the Remote: Send Command service with those device codes and commands.
Here is a snippet of one of my automations:

service: remote.send_command
data:
  device: "65890902"
  command: ModeDirect
target:
  entity_id: remote.harmony_hub

Looking at my config file, this has the commands for each device. I wanted to communicate with the harmony hub to send the single remote command from my “virtual” Harmony Companion remote and let the harmony hub change it into the appropriate command, based on the activity currently active and the mapping of the button in the Harmony app would change that into the appropriate command.

I may have misunderstood the remote itself but I thought that was a pretty dumb piece of electronics that sent a single wifi command, for example on button 1, and the syncing of the Harmony Hub with the Harmony app implemented the data to transpose that into say a “1” command for the TV, or a “1” command for a Roku box, or a “1” command for a Now TV stick, and so on. This mapping would be set up in the Harmony App for the activity concerned.

If I have to create Yaml for button “1” based on the harmony config file, I would need a condition for every activity with a different action for each “1” command. Although I know I could script this with a reusable argument driven script call, it still is a lot of re-inventing the logic that the harmony hub is already doing. That is a lot of code and really it seems silly to “re-invent the wheel” if there is a possibility of passing the “bare” remote command to the Harmony Hub itself.

Sorry if that is long-winded but I really want any virtual remote in Home Assistant to let the Harmony Hub do the work. Maybe, as the wifi remote commands are not represented in the Harmony integration, it only works with the infrared commands of individual devices.

I guess I am after some different integration that is not built from the Harmony Hub/App device data but is an actual interface with the Harmony Hub using just the initial wifi remote command.

Ive not tackled anything like this, but you could use conditional cards I would think,

I have been thinking more about this and it appears Logitech may be moving completely away from remotes. So, if their days are numbered, perhaps i need to prepare for some other kind of universal remote in the future. Perhaps i will have to write yaml code for all activities and buttons so i can plug these into any remote i replace Harmony with.

I think i can slim down the code so will see how it goes. Lots of ir commands for my blaster to learn!

It gets really complicated really quickly. I have created conditional cards that have displays different buttons depending on what activity is currently selected. Often the buttons look the same, but actually send a different command to a different device.

There was a different approach using appdaemon here

I have moved on with creating actions within HA rather than utilising Harmony itself. This has raised another issue which may end up as a new topic but I will try here first.

I have no problem with finding ir codes for remotes that I own.

However, based on Harmony commands for activities, it is clear that there are codes that directly open specific commands on the devices without having to navigate via menus and up/down buttons.

For example, I am trying to replicate the source commands (HDMI1/2/3/4 etc) for a Sony kd-49xe8396 tv, as well as the D.IN command for a Samsung Soundbar.

It is impossible using the menu navigation route as it all depends what the last selected item was and also, which inputs are receiving any signal. I cannot guarantee that I can open Source on my TV and navigate to a required Source.

How do we get hold of these? Is there anything in the Harmony API used by the integration that shows the ir codes for individual commands?

Certainly, I can see specific harmony commands in the integration for my Sony TV as follows:

            "InputAnalog",
            "InputDigital",
            "InputHdmi1",
            "InputHdmi2",
            "InputHdmi3",
            "InputHdmi4",
            "InputNext",
            "InputTv",
            "InputVideo1",
            "InputVideo2",

Update:

I realise I can get these with an ir extension connected to my harmony and that can easily reach my sonoff ir blaster for learning the codes from harmony