Add command list to Remote entity #875
Replies: 4 comments 1 reply
-
I think we could standardize the key list so we have a list of Home Assistant defined keys that we can map to remote commands So if you want to send Something like
And it would translate This would allow the frontend to have a defined list of keys to send as well as integrations that consume entities (ie alexa, homekit, etc) to send the right command without the user having to figure out the command set for every remote. |
Beta Was this translation helpful? Give feedback.
-
I recently experimented a bit with exposing a supported commands list on the remote enitity basically as mentioned by bdraco except that I used the existing So a remote entity exposes an attribute like this:
I could then build my (crude) dashboard with buttons that applied to those remote entities so as a proof-of-concept that worked. Next to dashboard it could also be used in places where the remote entity/send_command service is used in the UI e.g. with automations. I ran into two issues/challenges that I did not see covered here. First, how to handle universal remotes like Harmony that control multiple devices? For example a "mute" command can apply to multiple devices (receiver, tv, sonosses). The Instead I exposed a remote entity for each device supported by the Harmony so each one could have its own list. This works nicely and feels quite logical to me. Only downside is that you end up with quite some remote entities (11 in my case) The remote-entity-per-device does make the Activity part of the remote entity a bit weird for Harmony as that actually applies to the Hub and not a device that is controlled through IR. Activating an activity e.g. Watch Movie will make the Hub send commands to all configured devices to go to the correct state. For Harmony I would even go as far as to drop it from the remote entity and just keep the also existing select entity for Activities as it does the same. I looked mostly at Harmony as I own one, but had a quick look a the other universal remotes:
For these 4 universal remotes I am not sure how standardized commands would be done. Maybe just based on the name the user gave to the code? Maybe they should just expose a list of non-standardized commands? (might be out of scope of this discussion) They could also follow the remote-entity-per-device as suggested for Harmony, but not sure how well it fits usage scenarios of those devices. Second, not all integrations can detect what commands are actually supported by the specific device. E.g. for Android TV Remote there is a list of all commands that could potentially work, but not what actually works on device that is setup as manufacturers decide what to implement. Should such an integration expose the complete list, nothing, or a basic subset that most likely works? Having the complete list will result in non working commands unclear why to users, nothing requires the user to figure it all out, basic subset does not expose all possible options. btw I looked at this topic because I am adding a remote entity to my custom integration and I needed to write a lot of documentation to explain the commands that are supported and how to send them with the Having a list of supported commands per entity and UI support would make it a lot easier to use for a user and require less explanation. (the text ended up being a bit long and I might be overthinking it, sorry for that) |
Beta Was this translation helpful? Give feedback.
-
Hi, I also created a similar request here following a discussion with the core team : |
Beta Was this translation helpful? Give feedback.
-
Standardizing command names to decouple the user interface from the internal logic of each integration is a smart move. It promotes consistency and reusability. However, using a YAML schema for this purpose might not be the best choice. As mentioned earlier, some integrations rely on JSON to store commands, enabling them to be dynamically learned through the user interface. This capability could be compromised by a YAML-based approach. A more adaptable solution would involve defining these constants on the remote platform and allowing each integration to import them to compose its own schema. This approach provides a consistent reference point, without restricting integrations to a single format or schema structure. |
Beta Was this translation helpful? Give feedback.
-
Proposal
My suggestion is to add a command list attribute to the
Remote
entity to allow integrations to store commands that can be sent byremote.send_command
service call.The first time I mentioned it here: home-assistant/core#83439 (comment)
My suggestion is to do it like this:
With such a structure we cover two cases:
When the remote entity represents a virtual device in Home Assistant that sends commands to device (ATV, Bravia, Phillips, Xbox, etc.)
Remote entity can represent a physical device that sends commands (Broadlink, Harmony, another IR blaster)
Which integrations can use it:
All integrations that use
Remote
entity: https://www.home-assistant.io/integrations/#remoteWhy is it needed?
Using this data, we can build buttons in the UI (e.g. on a special card). I think this will greatly improve the user experience.
Icon variant (in this case, we probably have to add a key containing the name of the icon):
Beta Was this translation helpful? Give feedback.
All reactions