fix generic_thermostat bug when restore state from HA start up (#12134)
* fix generic_thermostat bug when restore state from HA start up if you don't set "initial_operation_mode" in config, you will get `self._enabled = True` when init GenericThermostat. And then you will miss the `if self._current_operation != STATE_OFF` statement and the self._enabled still keep `True`. That's the problem * add a test to describe the restore case
This commit is contained in:
parent
c144a3339f
commit
4ac9e7edf4
2 changed files with 86 additions and 3 deletions
|
@ -173,8 +173,8 @@ class GenericThermostat(ClimateDevice):
|
|||
old_state.attributes[ATTR_OPERATION_MODE] is not None):
|
||||
self._current_operation = \
|
||||
old_state.attributes[ATTR_OPERATION_MODE]
|
||||
if self._current_operation != STATE_OFF:
|
||||
self._enabled = True
|
||||
self._enabled = self._current_operation != STATE_OFF
|
||||
|
||||
else:
|
||||
# No previous state, try and restore defaults
|
||||
if self._target_temp is None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue