Why does the Generic Thermostat not keep it's state after a reboot or update?

Target temperature or target sensor?
Target temperature is the temperature you want in the room.
Target sensor is configured in configuration.yaml when you created the generic thermostat.

IÂŽve created other generic thermostat like you said, but for me in only appears with 2 AC options, Cold or Heat and OFF. The original thermostat has 6 options, Heat/Cold, Heat, Cold, Dry, Fan only and OFF.
I used this code to create it, but i cannot add more options. Generic Thermostat - Home Assistant.
I just want to get 4 thermostats for my 4 ACs units with all the options that they original have, but with a different target sensor yes. It seems easy to config, but im struggling

If you know, can you please share the code?
Thank you!

Created with code in YAML:
termo1
Captura de ecrĂŁ 2022-11-16 180731

Original:
termo2

I don’t know how to add modes.
Not sure if it’s even possible.

Came across the same problem, after wondering why it got so cold after doing some configuration and restarts.

I have a shelly switch which switches the heater on or off.

After removing initial_hvac_mode and adding keep_alive, set to 5 minutes, it keeps the state after a restart, and ensures the target heater is set to that mode within the keep_alive interval. Even after manually switching the shelly off from its own interface.

The lovelace climate card shows the state as “Idle” if it’s set to heat, but the shelly is Off. So the interface is always correct, it might just not be heating while it should for up to whatever is set in keep_alive.

Finally, I don’t use the modes in the thermostat, they’re mostly annoying and clumsy. I have automations which do service calls to set the temperature of all thermostats based on a number helper for both away and home. Does the trick very well, allows for a nice dashboard, and keeps the automation concise and clear.

2 Likes

Thanks for this - had the same problem (after HA restart, not setting the prior state) and adding keep_alive: 5 (& removing set_hvac_mode) fixed it.

The keep_alive description, perhaps, could be rewritten to clarify this.

It’s a very useful platform - thanks for the work !

Could this also be related to target_temp?
I don’t have this issue on any of my 8 generic_thermostats and I don’t use keep_alive

climate:
  - platform: generic_thermostat
    name: Thermostaat woonkamer voor
    heater: input_boolean.heater_living_room_front
    target_sensor: sensor.temp_kamer_voor_temperature
    away_temp: 7
    cold_tolerance: 0.1
    hot_tolerance: 0.1
    target_temp_step: 0.5
  - platform: generic_thermostat
    name: Thermostat woonkamer achter
    heater: input_boolean.heater_living_room_back
    target_sensor: sensor.temp_kamer_achter_temperature
    away_temp: 7
    cold_tolerance: 0.1
    hot_tolerance: 0.1
    target_temp_step: 0.5
  - platform: generic_thermostat
    name: Thermostat keuken
    heater: input_boolean.heater_kitchen
    target_sensor: sensor.temp_keuken_temperature
    away_temp: 7
    cold_tolerance: 0.1
    hot_tolerance: 0.1
    target_temp_step: 0.5
2 Likes

How to add working time so that the thermostat allows it to be turned on only between 10 p.m. - 6 a.m. and 12 p.m. - 4 p.m.
esphome:
name: nazwa_twojego_esp
platform: ESP8266
board: nodemcuv2

wifi:
ssid: “nazwa_twojej_sieci”
password: “haslo_do_sieci”

api:

ota:

time:

  • platform: homeassistant
    id: ha_time

switch:

  • platform: gpio
    name: “PrzekaĆșnik PC”
    pin: 16
    id: relay
    inverted: True
    restore_mode: RESTORE_default_OFF

automation:

  • id: turn_on_relay
    alias: “WƂącz PrzekaĆșnik PC”
    trigger:
    platform: time
    at: “22:00:00”
    condition:
    condition: and
    conditions:
    - condition: time
    after: “22:00:00”
    before: “06:00:00”
    - condition: time
    after: “12:00:00”
    before: “16:00:00”
    action:

    • switch.turn_on: relay
  • id: turn_off_relay
    alias: “WyƂącz PrzekaĆșnik PC”
    trigger:
    platform: time
    at: “06:00:00”
    action:

    • switch.turn_off: relay