-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User Defined Global Custom Sources and Actions #157
Comments
A global custom actions file wouldn't be a bad idea, but it would make sense to add the custom sources you've provided to the Samsung TV default source list. I should look into this further, as I'm concerned about how this would work with custom sources within the card itself. |
Thanks for the consideration.
What I'm trying to avoid (I have 4 cards) is duplicating and maintaining those custom sources in every card! |
Thinking more about this. It doesn't make sense to separate out custom actions and sources, they're just custom actions in code and config now. The file format can instead just be a JSON or YAML array (I can probably support both and parse on file extension). [
{
"type": "button",
"name": "netflix",
"tap_action": { "action": "source", "source": "Netflix" },
"icon": "fapro:netflix#fullcolor"
},
{
"type": "button",
"name": "youtubetv",
"tap_action": { "action": "source", "source": "YouTube TV" },
"icon": "fapro:youtubetvicon#fullcolor"
},
{
"type": "button",
"name": "primevideo",
"tap_action": { "action": "source", "source": "Prime Video" },
"icon": "fapro:amazonprime#fullcolor"
},
] - type: button
name: netflix
tap_action:
action: source
source: Netflix
icon: fapro:netflix#fullcolor
- type: button
name: youtubetv
tap_action:
action: source
source: YouTube TV
icon: fapro:youtubetv#fullcolor
- type: button
name: primevideo
tap_action:
action: source
source: Prime Video
icon: fapro:amazonprime#fullcolor Then different custom action lists can go in different files. |
@skavan You can load custom actions from file in the latest alpha, and I've also added your Samsung custom sources to the default sources list. The file uses the format I described above. Set the field Config UI TBD |
As of the latest alpha this has been completely integrated into the configuration UI. |
Wow -- genius -- will test this out! Amazing... s. |
Glad it's working for you!
It already does? If the custom actions do not appear for you for both imported from file and configured in remote custom actions there may be a bug. They appear consistently for me.
Use a label with a template on a custom action element. label: '{{ state_attr("media_player.samsung", "source") }}'
Probably out of scope of this issue. Making the icons customizable without creating new custom actions would make things much more complicated and I'm going to opt not to do that. I do want to add more custom icon support (like custom icon files) in the future, but probably not any time soon. Default > custom action inheritance is now handled by the UI, which is why the tap action is lost in your custom actions file if not specified. I'd recommend creating all of your custom actions with the configuration UI, then copying them to your custom actions file. The file can also be a YAML which makes for easier copying.
Why not create custom actions in the remote config for these actions? That's what I'm doing for volume and power since they're controlled by IR. |
Once I added a single custom action through the gui, it showed up! A quick question for you. In the json files I have an action that requires entity to be set. Is there a way to plop a variable in there that will be evaluated (i.e. the current
|
I'll have to fix it not appearing when you only have file custom actions, that's a bug.
You can access any fields in the current custom action using FYI the Android TV ADB / Fire TV integration now provides a remote entity which I find performs better than the old |
A few hours later -- what a card! I just replace the entity id's and the custom_actions_file and boom. It works across my fire tv and samsung. Google TV next. THANK YOU. my dashboard below - for others to benefit from. I have two questions:
How would I replace the target line using your approach? Here's the full dashboard:
|
You need to create a custom action for the touchpad and use the appearance style field within that. The touchpad has an inner
As of the latest alpha, the custom action entity or remote media player ID (prioritized in that order for whichever is the correct domain for the service) will autofill in the {
"type": "button",
"name": "play_pause",
"icon": "mdi:play-pause",
"tap_action": {
"action": "perform-action",
"perform_action": "media_player.media_play_pause"
}
} |
4.2.0 is now in beta. @skavan if everything is working for you I'm going to release it tomorrow and close out this issue. |
Thank you. All good here until my next crazy idea! |
Couple of things. Well one for now. I'm seeing if the second is my issue...
|
EDIT: The below, may or may not be true, because the problem is deeper!
in custom_actions, this doesn't work (although I could swear it did with the alpha):
Original Thought: OK - debugged a bit. My second "issue" is your auto-fill in of target entity works in a gui based custom action, but not when loaded from custom_actions_file: GUI versions -- works:
FILE version --- doesn't work:
...and I tried avoiding this method (adbcommand) entirely, but your FireTV, "Max" button doesn't work for me at all. |
Malformed config, the remote ID should be in the tap_action and named differently. - type: button
name: volume_up
tap_action:
action: key
key: KEY_VOLUP
remote_id: remote.fire_tv
hold_action:
action: repeat
icon: mdi:volume-plus |
I was initially able to recreate this issue, but after some more testing it seems to be a caching issue. Whenever you modify the custom actions file, it doesn't get updated in the card as it keeps using a cached version. I had to clear browser cache multiple times and change multiple things about the custom action in the file until it finally pulled down an updated copy of the file and worked correctly. |
Thank you. This caching thing is a nightmare.
Note, the keys:
I then call my lovelace page, with a query string i.e.
Just change the query string and wow - whole new remote with exactly the same layout, but including custom remote specific buttons too.
Now, lets move to the
Inside the button, I have access to the Button That's my enhancement request:If I could get access to the card config variables, from inside a custom_action, I could eliminate so much hard-coding. Bonus: |
Discussions. It'll get lost here.
That's really confusing and hard to follow. To boil it down, you want to access the entire card config in the templates of custom actions? That would be a lot of data to copy to each custom action. We should limit it to a subset. What about if this subset was copied to each custom action? card:
title: string
remote_id: string
media_player_id: string
keyboard_id: string
platform: Platform
extra: {} |
Perfect. |
@skavan try the 4.2.1 alpha. You can access the parent card (minus array elements) using a template like |
Fabulous. Thank you. Will play with it on Sunday and let you know... s. |
Great...it's working well. Thank you. s. |
FYI I removed the minus array elements restriction, so the entire card config is available in sub-elements templates. Added in 4.2.1 |
Is your feature request related to a problem? Please describe.
I have multiple TV's from multiple brands (Google TV, Fire TV, Samsung, LG). Your card is excellent. I want to build one remote "style" for all my TV's. The challenge is that
Describe the solution you'd like
I edited the Samsung section of
universal-remote-card.min
and added the missing entries...and it works beautifully. So I was thinking (for advanced users) of whether you could do the following:custom_sources_actions.json
Here's an example (missing the custom icons stuff) -- by the way the Samsung TV sources have all been tested and work so maybe you could update that! The approach below also handles custom icons for each source...
and if anyone is interested, here's my 'Universal Remote' (ignore last row, it's a WIP). This whole card is only 142 lines of yaml because I hacked the source .js -- which will, of course, get overwritten with your next release!
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: