Hi All,
I’m trying to have two actions performed when a button card i clicked in Lovelace UI.
This issue her is not the actions themselves. Both works perfectly in their own, but combining them into a single YAML fails.
This is my first attempt:
This does not give any error message, but absolutely nothing happens when I click the button card. No log entries of any kind.
The I tried another variation, but this one gives syntax error “Bad indentation at line 5” and thus cannot be tested or saved:
Ok, thanks - I’ll try that.
But how are we to know what can and what can’t be done in the UI ?
It seems like there are lots of YAML limitations when used in the UI, while not so many when used in an automation and even less when used in a script. I thought YAML was YAML. If that’s not the case, where are these limitation documented ?
The documentation about buttons and actions always reads like there’s only one supported, but I get your point, it isn’t 100% clear.
However - there is an open pull request in the frontend repository, you could give that a thumbs up if you have a github account.
Seems like the PR is lacking documentation as well, if you want to contribute.
I like to think about possibilities, not limitations, and all of those are very well documented at home-assistant.io/docs
There are no limitation differences between automations and scripts. The only “limitation” I could think of is that you can’t manually execute an automation easily.
YAML is just the language, the syntax. There’s no tap_action in automations, so I don’t really know where you’re coming from here.
Thank you all for answers and guidance.
So, to sum up - It isn’t possible to add two (or more) actions to a singel button-card, unless i turn to scripting (which I did - and it works)
alias: Play Radio
sequence:
- service: remote.turn_on
data:
activity: 41122377
entity_id: remote.harmony
- service: media_player.play_media
data:
media_content_id: https://p7.p4groupaudio.com/P07_MH
media_content_type: music
entity_id: media_player.stue_ac_lms
mode: single
icon: 'mdi:panda'
I can’t believe this is still an issue in 2023: I want one dashboard button to tun on a switch while simultaneously navigating to another screen. Scripts don’t have the navigate function. Pah!
I’d like my front door lock wake button (Yale lock) to be pressed when I navigate to the section of my UI for my front door so I have an up-to-date status whenever I check, but don’t have to create unnecessary battery drain by automating the wake button to be pressed every few minutes.
I’m trying to do two action with on key pressed, but I’ve been getting nowhere.
I read on the page that the action can use a template, so I tried to do it, but I can’t seem to get it right. here’s the code: