Thermostat for heating pump

Hi all, I have a heat pump that only has two switches, one for ON/OFF and the other for Heat/Cool. I would need to find a way that allows me, through the thermostat, to change the mode using the dedicated switch and to turn on or off with the other in both modes.
Can someone help me?

hi do you need help with the electric connection, code or hardware?

I have hardware and I already integrated it in HA. I’m looking for an integration if exist or something (automation, code) that I use to make it work

Have you tried to set it up using the Generic thermostat - Home Assistant

Yea, I did but i dont know how to switch mode with that one

Hmmm yeah…

My best suggestion would be to add a pair of button cards to your dashboard (or an input select card) that allows you to chose the mode and then respond to clicks/changes to those with a script

image

Tnx for suggestion buit i’m really new in this world. Can you help me explaining all the steps?
Thanks

I created this automation:

- id: "1709218975233"
  alias: Modalità termostato
  trigger:
    - platform: state
      entity_id: switch.sonoff_1000a4243c
      from: "off"
      to: "on"
    - platform: state
      entity_id: switch.sonoff_1000a4243c
      from: "on"
      to: "off"
  action:
    - service: climate.set_hvac_mode
      data_template:
        entity_id: climate.casa
        hvac_mode: >
          {% if is_state('switch.sonoff_1000a4243c', 'on') %}
            cool
          {% else %}
            heat
          {% endif %}

The thermostat change color but works as heater.