Away mode temperature fix for generic thermostat (#17641)

* Resolves /home-assistant/home-assistant#17433

Away mode temperature issue fix for generic_thermostat

* Debug messages removed from generic_thermostat.py

* Test for repeat away_mode set

Test for fix of generic thermostat issue when away_mode was set several times in a row.

* Code style fix in generic_thermostat

* Remove blank line in the end of generic_thermostat

* Fix style
This commit is contained in:
Yegor Vialov authored and Daniel Høyer Iversen committed 2018-10-23 09:04:47 +02:00
1 parent ad3d0c4e99
commit 324587b2db
2 files changed
+22

No files matched your search

@@ -221,6 +221,24 @@ class TestClimateGenericThermostat(unittest.TestCase):
state = self.hass.states.get(ENTITY)
self.assertEqual(23, state.attributes.get('temperature'))
def test_set_away_mode_twice_and_restore_prev_temp(self):
"""Test the setting away mode twice in a row.
Verify original temperature is restored.
"""
common.set_temperature(self.hass, 23)
self.hass.block_till_done()
common.set_away_mode(self.hass, True)
self.hass.block_till_done()
common.set_away_mode(self.hass, True)
self.hass.block_till_done()
state = self.hass.states.get(ENTITY)
self.assertEqual(16, state.attributes.get('temperature'))
common.set_away_mode(self.hass, False)
self.hass.block_till_done()
state = self.hass.states.get(ENTITY)
self.assertEqual(23, state.attributes.get('temperature'))
def test_sensor_bad_value(self):
"""Test sensor that have None as state."""
state = self.hass.states.get(ENTITY)