Wont preform the switch.turn_on

Hi.
need help.
don’t understand way a popup window shows when pushing the image icon:

aspect_ratio: 35%
elements:
    show_name: true
    state_image:
      'off': /local/images scenes/welcom 30 tint.jpg
      'on': /local/images scenes/welcom 30.jpg
    style:
      background-color: 'rgb(255, 255, 255, 0.0)'
      border-radius: 4px
      filter: invert(0.20)
      height: 120px
      left: 25%
      top: 5.5em
      width: 150px
    service: switch.turn_on
    type: image
image: /local/red.jpg
type: picture-elements

way it wont preform the switch.turn_on immediately?
what don’t i understand?

Thanks
Refael

Remove this:

service: switch.turn_on

Replace with:

tap_action:
  action: toggle

Hi.
i know this will work.
i just wondering way, the way that i did it not working.
the “Picture Entity Card” page in HA web site seys it should
work.

Refael

Actually it says this:

You get the pop-up because the default tap action is ‘more-info’. If you want to call a service you have to set it to:

tap_action:
  action: call-service

so it’s should be like this?

tap_action:
action: call-service
service: switch.turn_on

if i want only to turn on a switch ?

Refael

Yes but make sure you indent it correctly. Also you need to tell it what to turn on.

tap_action:
  action: call-service
service: switch.turn_on
service_data:
  entity_id: the.thing_you_want_to_turn_on

Thanks tom_l.