#One TV remote with selectable target

1 messages · Page 1 of 1 (latest)

lament crystal
#

I'd like to expand my current remote control panel to apply to any android TV around the house. One solution would be to copy and paste the yaml for every TV, but that'll get messy whenever I'd want to modify anything. It'd be cool if I could have a drop-down or a radio box to choose which TV to control that is local to the browser, meaning that me and someone else would be able to command a different TV without fighting over some shared variable. Is it possible to do this with the stock dashboard? Do I need some custom component from HACS?

shrewd spindle
#

Before I get to writing a whole bunch of stuff, what are you using for the remote control? Just some stock button cards set to perform a certain actin directed at a certain entity?

lament crystal
#

I tried some frontend integrations that add like a nice gui on top but it didn't functionally change much

#

Then I remembered I was already using the one this was forked from

#

The declutter-card or something

#

Works really nicely for simple substitutions

shrewd spindle
#

The problem that you're likely to run into first is the stock cards to not like to be templated, especially the tap_actions. You would need to be able to template the action to look at the device you have selected; they don't like that.
The only card that I know that can do that is the custom:button-card.
If you want to stick with stock button cards, maybe you can use a script and pass the "action" as a variable (such as Power). The script itself could look at the selected device helper.
Using the Streamline-card you mentioned above (or the Decluttering card might allow you to template the action but I'm not sure.
But, all this is assuming only one helper entity and you already mentioned having multiple users that might be working with it at the same time. I don't think there is an easy fix to get around that. IMO, it may all come down to dashboard design. Perhaps, you have the "Master Remote Control" that has the option to select different devices (more intended for your use), but the other users would have to rely on views dedicated to the room the device is in (so the Living Room has its remote control and other lights and whatnot.)
Maybe you could get around it by making a couple of helper entities, one for each user. (input_select.device_selector_dad, input_select.device_selector_mom, etc). A conditional card could show the respective user's selector entity and they would only interact with that... (This may be a useful idea depending on how many users you have.) Conditional card - user
I think I would go with custom:button-cards with multiple helper entities if I were to try to do what you're wanting to do.

#

You may also want to take a look at @minor oriole 's Universal Remote Card. It is super powerful with lots of options and things to tinker with. I'm not sure if it will work with your multi-device/multi-device&multi-user goal but it does look like it supports templating which would be beneficial, I think.

lament crystal
#

That's the case at least for repeated remote controls, all spread into one dashboard

#

As for the drop-down or radio button I still haven't found a pure client-side solution, which I think is essential for it to not cause fighting issues or overcomplicated actions that require back end template support

shrewd spindle
#

I wonder if the decluttering card will "update" the child card if an input_select is changed, thus selecting a different device. I suspect that once the card is rendered the values are pretty much static. That's where I think the custom:button-card would be able to best handle the selected device with some inline JavaScript. Also, it has its own templating and variable capabilities so you would not have to rely on the decluttering card.

#

I can't think of any way to keep the device selection strictly on the client-side of things. I think you'd still need a helper of some sort to be able to "remember" the individual user's selection.

minor oriole
#

Possible solution: Create an input select for each user for the different room TV names and conditionally display them for different users. Then within Universal Remote Card use templates to check the current user by ID at hass.user.id (my projects templating engine supports referencing the frontend hass object directly), then use that to choose the correct input select entity, and then from the value of the input select choose the correct entity IDs. You'd have to rename your remote and media player IDs to be consistent with each other so constructing them like this would work, or add additional template logic to choose the correct ones.

type: custom:universal-remote-card
remote_id: remote.{{ states("input_select.android_tv_" + hass.user.id) }}
media_player_id: media_player.{{ states("input_select.android_tv_" + hass.user.id) }}
keyboard_id: remote.{{ states("input_select.android_tv_" + hass.user.id) }}_adb
lament crystal
#

oh nvm that relies on an entity

#

ho no it does

#

the entity field is optional

#

otherwise it adds a hash to the url to control the state