mirror of
https://github.com/home-assistant/core.git
synced 2025-08-03 20:55:10 +02:00
forgot to commit the test
This commit is contained in:
@@ -470,6 +470,45 @@ class TestTemplateLight:
|
|||||||
# need to add assertions about optimistic state
|
# need to add assertions about optimistic state
|
||||||
# assert state.attributes.get('brightness') == 124
|
# assert state.attributes.get('brightness') == 124
|
||||||
|
|
||||||
|
def test_level_template(self):
|
||||||
|
"""Test the setting of the state with off."""
|
||||||
|
with assert_setup_component(1):
|
||||||
|
assert setup.setup_component(self.hass, 'light', {
|
||||||
|
'light': {
|
||||||
|
'platform': 'template',
|
||||||
|
'lights': {
|
||||||
|
'test_template_light': {
|
||||||
|
'value_template': "{{ 1 == 2 }}",
|
||||||
|
'turn_on': {
|
||||||
|
'service': 'light.turn_on',
|
||||||
|
'entity_id': 'light.test_state'
|
||||||
|
},
|
||||||
|
'turn_off': {
|
||||||
|
'service': 'light.turn_off',
|
||||||
|
'entity_id': 'light.test_state'
|
||||||
|
},
|
||||||
|
'set_level': {
|
||||||
|
'service': 'light.turn_on',
|
||||||
|
'data_template': {
|
||||||
|
'entity_id': 'light.test_state',
|
||||||
|
'brightness': '{{brightness}}'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'level_template':
|
||||||
|
'{{42}}'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
self.hass.start()
|
||||||
|
self.hass.block_till_done()
|
||||||
|
|
||||||
|
state = self.hass.states.get('light.test_template_light')
|
||||||
|
assert state != None
|
||||||
|
_LOGGER.error(str(state))
|
||||||
|
assert state.attributes.get('brightness') == 42
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def test_restore_state(hass):
|
def test_restore_state(hass):
|
||||||
"""Ensure states are restored on startup."""
|
"""Ensure states are restored on startup."""
|
||||||
|
Reference in New Issue
Block a user