Generic thermostatc hvac mode switch

Hello!

I have a thermostat defined as

climate:
  - platform: generic_thermostat
    name: Living Room Thermostat
    unique_id: living_room_thermostat
    heater: switch.thermostatlivingroom_switch_0
    target_sensor: sensor.esp_bme680_temperature
    cold_tolerance: 0.5
    hot_tolerance: 0.5
    min_temp: 16
    max_temp: 30

I would like to switch the thermostat mode heat/cool using an automation.

I setup an helper dropdown and a couple related automations (for cool/heat respectively). E.g.

alias: HVAC Cool Mode
description: ""
trigger:
  - platform: state
    entity_id:
      - input_select.hvac_mode
    to: Cool
condition: []
action:
  - service: climate.set_hvac_mode
    metadata: {}
    data:
      hvac_mode: cool
    target:
      floor_id:
        - basement
        - ground_floor
mode: single

Now, the automation correctly set the thermostat’s state but the hvac_modes associated with it are wrong

Due to this I can’t use the thermostat “cool” action from somewhere else (e.g. a scheduler). What am I missing?

Thanks

From what I remember you need to have two thermostats configured, one for heat and one for cool. The ac_mode needs to be enabled.

One Generic Thermostat entity can only control one switch. If you need to activate two switches, one for a heater and one for an air conditioner, you will need two Generic Thermostat entities.

This is what it will look like with ac-mode enabled

climate:
  - platform: generic_thermostat
    name: Test Thermostat
    unique_id: test_thermostat
    heater: switch.your_switch
    target_sensor: sensor.your_sensor
    cold_tolerance: 0.5
    hot_tolerance: 0.5
    min_temp: 16
    max_temp: 30
    ac_mode: true

Or you can use a third party integration that supports heating and cooling, like this one:

Thanks for the answer. In my use case, for both heat and cool, the switch remains the same.
I was under the impression that setting “hvac mode” via service would set ac_mode accordingly. Is this not the case? If so, what’s the rationale?

Thanks, I’ll have a look

It looks at the switch in a binary fashion, so either heat, off or cool, off, not heat, cool, off. Not sure what the rationale is…