What does (map) mean?

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
1 Like

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:

Screenshot_2019-11-29%20Entities%20Card

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.ā€