Add on/off supported feature to climate (#11379)

* Add on/off supported feature to climate

* Lint
This commit is contained in:
Andrey 2018-01-04 00:10:54 +02:00 committed by Lukas Barth
parent ec700c2cd6
commit eb00e54eba
5 changed files with 125 additions and 17 deletions

View file

@ -250,3 +250,20 @@ class TestDemoClimate(unittest.TestCase):
self.hass.block_till_done()
state = self.hass.states.get(ENTITY_CLIMATE)
self.assertEqual('off', state.attributes.get('aux_heat'))
def test_set_on_off(self):
"""Test on/off service."""
state = self.hass.states.get(ENTITY_ECOBEE)
self.assertEqual('auto', state.state)
self.hass.services.call(climate.DOMAIN, climate.SERVICE_TURN_OFF,
{climate.ATTR_ENTITY_ID: ENTITY_ECOBEE})
self.hass.block_till_done()
state = self.hass.states.get(ENTITY_ECOBEE)
self.assertEqual('off', state.state)
self.hass.services.call(climate.DOMAIN, climate.SERVICE_TURN_ON,
{climate.ATTR_ENTITY_ID: ENTITY_ECOBEE})
self.hass.block_till_done()
state = self.hass.states.get(ENTITY_ECOBEE)
self.assertEqual('auto', state.state)