Help needed with thermostat configuration

Hi,

I’m new here and very new to YAML, so sorry if this is obvious to everyone else, but I can’t get the thermostat card in HA to switch on/off my thermostat. I want it to control a sonoff basic, running Tasmota, with a AM2301 attached.

Here is the YAML extract for the relevant functions. The switch works in it’s own right, i.e. I can switch it on/off via HA and the sensor also works and can be displayed in HA but no matter what I set the temperature to on the thermostat card, it does not switch the sonoff on/off, it just displays idol even when the temperature is below the set point:

switch:
  - platform: mqtt
    name: "Boiler"
    command_topic: "cmnd/boiler/power"
    state_topic: "stat/boiler/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: false
    
climate:
  - platform: generic_thermostat
    name: "Thermostat"
    heater: switch.boiler
    target_sensor: sensor.boiler
    min_temp: 7
    max_temp: 26
    min_cycle_duration:
      minutes: 1
    initial_hvac_mode: "off"      
    cold_tolerance: 0.5
    hot_tolerance: 0.5
    away_temp: 7
    precision: 0.1

sensor:
  - platform: mqtt
    state_topic: 'tele/boiler/SENSOR'
    name: 'Room Temp' #AM2302
    unit_of_measurement: '°C'
    value_template: '{{ value_json.AM2301.Temperature }}'
  - platform: mqtt
    state_topic: 'tele/boiler/SENSOR'
    name: 'Room Humidity'
    unit_of_measurement: '%'
    value_template: '{{ value_json.AM2301.Humidity }}' 

I’ve had a play around with the configuration.yaml and it now looks like this. The thermostat is seeing the sensor temperature but sits at ‘Idle’ all the time, even when there is a requirement for it to be on:

switch:
  - platform: mqtt
    name: "Lounge Heater"
    state_topic: "stat/boiler/POWER"
    command_topic: "cmnd/boiler/POWER"
    availability_topic: "tele/boiler/LWT"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: false
    
climate:
  - platform: generic_thermostat
    name: Thermostat
    heater: switch.lounge_heater
    target_sensor: sensor.temp
    min_temp: 10
    max_temp: 30
    ac_mode: 'False'
    #target_temp: 18
    cold_tolerance: 0.3
    hot_tolerance: 0.3
    away_temp: 11

sensor:
  - platform: mqtt
    state_topic: 'tele/boiler/SENSOR'
    name: 'Temp' #AM2302
    unit_of_measurement: '°C'
    value_template: '{{ value_json.AM2301.Temperature }}'
  - platform: mqtt
    state_topic: 'tele/boiler/SENSOR'
    name: 'Humidity'
    unit_of_measurement: '%'
    value_template: '{{ value_json.AM2301.Humidity }}'   

Screenshot%20from%202019-11-13%2021-23-53

I’m not very familiar with Generic Thermostat but try changing:

ac_mode: 'False'

to:

ac_mode: false

That’s the way it’s shown in the documentation’s example.

1 Like

@123, that is the solution, thank you very much. Sometimes these things need a fresh pair of eyes, as I was staring at this yaml for ages and never saw that syntax error.

1 Like

For reference to others who this may be useful to, this is the relevant section of my configuration.yaml, which now functions as expected:

switch:
  - platform: mqtt
    name: "Lounge Heater"
    command_topic: "cmnd/boiler/power"
    state_topic: "stat/boiler/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true
    
climate:
  - platform: generic_thermostat
    name: Thermostat
    heater: switch.lounge_heater
    target_sensor: sensor.temp
    min_temp: 10
    max_temp: 30
    ac_mode: false
    #target_temp: 18
    cold_tolerance: 0.3
    hot_tolerance: 0.3
    away_temp: 11

sensor:
  - platform: mqtt
    state_topic: 'tele/boiler/SENSOR'
    name: 'Temp' #AM2302
    unit_of_measurement: '°C'
    value_template: '{{ value_json.AM2301.Temperature }}'
  - platform: mqtt
    state_topic: 'tele/boiler/SENSOR'
    name: 'Humidity'
    unit_of_measurement: '%'
    value_template: '{{ value_json.AM2301.Humidity }}'