In the docs for Entities card under tap_action it says: (map) (Optional).
I searched in all the docs for Lovelace UI, and Lovelace Advanced, and Automation Actions and could not find an explanation.
What does it mean?
Cheers, Richard
In the docs for Entities card under tap_action it says: (map) (Optional).
I searched in all the docs for Lovelace UI, and Lovelace Advanced, and Automation Actions and could not find an explanation.
What does it mean?
Cheers, Richard
hey @RichardU,
not sure what map stands for ā¦ but this type of configurations are related to multiple items you can add below. in this case, you can āmapā the tap_action to either and āactionā a ānavvigation_pathā, etc.
thatās the way read it.
hope this helps!
a āmapā in HA refers to a listing of key:value pairs.
So in this case everything below the following is a map (examples taken from the docs page):
tap_action:
action: call-service
service: media_player.media_play_pause
service_data:
entity_id: media_player.bedroom
So, should I be able to do this?
tap_action:
- action: call-service
service: media_player.media_play_pause
service_data:
entity_id: media_player.bedroom
- action: call-service
service: media_player.media_play_pause
service_data:
entity_id: media_player.bedroom2
If not, how would I know that?
Thanks, Richard
Iām really not sure.
It doesnāt make sense that you can call two different actions with the same tap_action but you might be able to.
But honestly, Iāve never used it so I donāt know.
Put your two actions in a script and call that as the service.
Or put your two media players in a group and pause the group.
Thanks. I can do the script. What Iām trying to understand is how can I know when I must include a single item (e.g. a single action in a tap_action) versus when I can include a list of items (e.g. multiple actions in a script).
Is there a standard or a hint that will tell me when each is permissible throughout HASS?
tap_action:
action: call-service
service: media_player.media_play_pause
service_data:
entity_id:
- media_player.bedroom
- media_player.bedroom2
Thanks @anon43302295. So in this instance Iām allowed to list multiple items under entity_id. How would I know that? Is it documented somewhere?
Entities are (nearly?) always specified as a list in the documented options:
Thomas Loven wrote an excellent explanation of YAML terms like ālistā and āmapā (dictionary):
http://thomasloven.com/blog/2018/08/YAML-For-Nonprogrammers/
I thought the same thing and almost wrote pretty much what @anon43302295 wrote as a reply but then I looked at the docs and saw that the āservice_data:ā in the tap action section isnāt listed as a ālistā. It is specified as a string so I changed my response.
Again, Iāve never used that so Iām not really sure how it is supposed to work. If you guys have then itās good to know and the docs should be updated.
Thanks @tom_l for the reference to the Thomas Loven article.
Iād like to update the documentation for the benefit of others. (Iām thinking here: https://www.home-assistant.io/docs/configuration/yaml/)
Would this be appropriate?
āDocumentation for YAML entities specifies available options. If an object allows for (map) entries, you may enter a single mapping item, but not a list of items. If an object allows for (list) entries, you may enter a list of items.ā