Need help to configure

Hi
it is my first message and question on this community.

I am using home assistant (of course) and I am trying to configure a map of my house with all my devices.
I have created in lovelace a “picture-element” (type: picture-elements).
I want to have a buton in the picture (i am using an icon) to change the mode of the “climate”.

  - type: state-icon
    icon: 'mdi:fire'
    entity: climate.my_heater
    style:
      top: 20%
      left: 25%
      font-size: 10px
    tap_action:
      action: call-service
      service: script.action_heater_1

In my scripts.yaml, I have detailed the action

action_heater_1:
  alias: action_heater_1
  sequence:
  - service_template: "{% if is_state_attr('climate.my_heater', 'system_mode', 'auto') %}\n  state_attr('my_heater.force', 'open')\n\
      {% else %}\n  climate.turn_off\n{% endif %}\n"
    entity_id: climate.my_heater

This one does work.

But I have 3 modes and not only “on” and “off”.
I can be “auto”
So how to turn to auto ?
I would like to set a value.

when I use “turn_on” it changes the attribute “force” to “open”,
“turn_of” gives “close”
I want to set it to "normal

Please use code blocks, it is very difficult to read your code :smile:

Markdown Guide

I think it is better now.
As I said, it was my first post…

how about using hold_action to set it to auto with a different script? Then you can have all 3 modes from the UI

You will have to use a different script to set it to auto.

action_heater_mode_auto:
  alias: action_heater_mode_auto
  sequence:
  - service: climate.set_hvac_mode
    data:
      hvac_mode: auto
    entity_id: climate.my_heater

Either use hold_action as @richieframe suggest or maybe use a dropdown helper entity.

Thank you both

With your code I can switch to auto.

I have to try to put this action in a “if/else” code.