Generic Thermostat always IDLE

Hi,

This is my first HASS configuration. Everything works except the Generic Thermostat that keeps on IDLE even when the room has lower temperature than the target one. There have been people reporting the same problem on previous HASS versions but that’s supposed to be fixed. Let me know if I miss something.
The versions that I tried are:

HASS 0.65.5 and 0.66.1
Python 3.5.3 and 3.6.4
OS Windows and Rasbian

The climate configuration is:

- platform: generic_thermostat
  name: Heating
  heater: switch.boiler_switch
  target_sensor: sensor.living_room_temperature
  min_temp: 10
  max_temp: 25
  ac_mode: False
  target_temp: 22
  cold_tolerance: 0.5
  hot_tolerance: 0.5
  min_cycle_duration:
    seconds: 30
  keep_alive:
    minutes: 2
  initial_operation_mode: "auto"
  away_temp: 16

The log is:

[32m2018-04-04 20:08:08 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.living_room_temperature, old_state=<state sensor.living_room_temperature=unknown; unit_of_measurement=°C, friendly_name=Living room Temperature @ 2018-04-04T20:07:16.541418+01:00>, new_state=<state sensor.living_room_temperature=20.2; unit_of_measurement=°C, friendly_name=Living room Temperature @ 2018-04-04T20:08:08.345414+01:00>>

[32m2018-04-04 20:08:08 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.living_room_humidity, old_state=<state sensor.living_room_humidity=unknown; unit_of_measurement=%, friendly_name=Living room Humidity @ 2018-04-04T20:07:16.589730+01:00>, new_state=<state sensor.living_room_humidity=43.9; unit_of_measurement=%, friendly_name=Living room Humidity @ 2018-04-04T20:08:08.346424+01:00>>

[32m2018-04-04 20:08:08 INFO (MainThread) [homeassistant.components.climate.generic_thermostat] Obtained current and target temperature. Generic thermostat active. 20.2, 22.0

[32m2018-04-04 20:08:08 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=climate.heating, old_state=<state climate.heating=idle; current_temperature=None, min_temp=10.0, max_temp=25.0, temperature=22.0, operation_mode=heat, operation_list=['heat', 'off'], away_mode=off, unit_of_measurement=°C, friendly_name=Heating, supported_features=1153 @ 2018-04-04T20:07:19.333929+01:00>, new_state=<state climate.heating=idle; current_temperature=20.2, min_temp=10.0, max_temp=25.0, temperature=22.0, operation_mode=heat, operation_list=['heat', 'off'], away_mode=off, unit_of_measurement=°C, friendly_name=Heating, supported_features=1153 @ 2018-04-04T20:07:19.333929+01:00>>

Thank you

It looks like it didn’t have a state before and now it has one. If you look at the previous state, the current temperature is ‘none’, then it switches to 20.2.

Forgive my ignorance, but is it supposed to switch to heat when it’s below temperature? I would assume that the user would need to make the automation to switch it to heat.

The reason that it doesn’t have a state is because it the first log at the beginning. After that it keeps the values.

The automation is part of the generic_thermostat as I can see in generic_thermostat.py. I belive there is a bug in the automation. I need to investigate, I was hopping somene will be more familiar with this component.

1 Like

Ok, well I’ve read through the code and I noticed a few things:

Well I followed the code and something interesting to note is that in order for this device to return a state other than idle, the heater needs to be on.

So, is your heater on?

Here’s the code that determines the state of the device, based on your config and the logic, the only way for you to be in idle mode is if your heater is off:

    @property
    def state(self):
        """Return the current state."""
        if self._is_device_active:
            return self.current_operation
        if self._enabled:
            return STATE_IDLE
        return STATE_OFF

    @property
    def _is_device_active(self):
        """If the toggleable device is currently active."""
        return self.hass.states.is_state(self.heater_entity_id, STATE_ON)

Theres another interesting function that ‘keeps it alive’ that seems backwards to me:

    @callback
    def _async_keep_alive(self, time):
        """Call at constant intervals for keep-alive purposes."""
        if self._is_device_active:
            self._heater_turn_on()
        else:
            self._heater_turn_off()

Seems like this would do the opposite of what should happen during the callback. Shouldn’t the callback turn off the device because the 2 minutes are up?

This of course is if the callback occurs at the end of 2 minutes, not at periodically during it.

Thanks for trying to help me. The problem has been solved. There was a mistake in my configuration.

Switches:

  - platform: broadlink
  host: xxxxxxxxxxxxxx
  mac: xxxxxxxxxxxxxx
  timeout: 15
  type: rm2_pro_plus
  switches:
    boiler_switch:
      friendly_name: "Boiler"
      command_on: 'xxxxxxxxxxxxxxxx'
      command_off: 'xxxxxxxxxxxxxxxx'

Climate:

 - platform: generic_thermostat
  name: Heating
  heater: switch.boiler_switch

When I replaced “heater: switch.boiler_switch” to “heater: switch.boiler” works as it should. Silly me I assumed the wrong entity name.

Thanks again.