RFC: Only use supported light properties (#15484)
* Only use supported light properties * Fix tests
This commit is contained in:
1 parent
e62e2bb131
commit
e427f9ee38
5 files changed
+43
-34
No files matched your search
@@ -200,21 +200,24 @@ async def test_effect_list(hass):
|
||||
}})
|
||||
|
||||
hass.states.async_set('light.test1', 'on',
|
||||
{'effect_list': ['None', 'Random', 'Colorloop']})
|
||||
{'effect_list': ['None', 'Random', 'Colorloop'],
|
||||
'supported_features': 4})
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get('light.light_group')
|
||||
assert set(state.attributes['effect_list']) == {
|
||||
'None', 'Random', 'Colorloop'}
|
||||
|
||||
hass.states.async_set('light.test2', 'on',
|
||||
{'effect_list': ['None', 'Random', 'Rainbow']})
|
||||
{'effect_list': ['None', 'Random', 'Rainbow'],
|
||||
'supported_features': 4})
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get('light.light_group')
|
||||
assert set(state.attributes['effect_list']) == {
|
||||
'None', 'Random', 'Colorloop', 'Rainbow'}
|
||||
|
||||
hass.states.async_set('light.test1', 'off',
|
||||
{'effect_list': ['None', 'Colorloop', 'Seven']})
|
||||
{'effect_list': ['None', 'Colorloop', 'Seven'],
|
||||
'supported_features': 4})
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get('light.light_group')
|
||||
assert set(state.attributes['effect_list']) == {
|
||||
@@ -229,27 +232,27 @@ async def test_effect(hass):
|
||||
}})
|
||||
|
||||
hass.states.async_set('light.test1', 'on',
|
||||
{'effect': 'None', 'supported_features': 2})
|
||||
{'effect': 'None', 'supported_features': 6})
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get('light.light_group')
|
||||
assert state.attributes['effect'] == 'None'
|
||||
|
||||
hass.states.async_set('light.test2', 'on',
|
||||
{'effect': 'None', 'supported_features': 2})
|
||||
{'effect': 'None', 'supported_features': 6})
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get('light.light_group')
|
||||
assert state.attributes['effect'] == 'None'
|
||||
|
||||
hass.states.async_set('light.test3', 'on',
|
||||
{'effect': 'Random', 'supported_features': 2})
|
||||
{'effect': 'Random', 'supported_features': 6})
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get('light.light_group')
|
||||
assert state.attributes['effect'] == 'None'
|
||||
|
||||
hass.states.async_set('light.test1', 'off',
|
||||
{'effect': 'None', 'supported_features': 2})
|
||||
{'effect': 'None', 'supported_features': 6})
|
||||
hass.states.async_set('light.test2', 'off',
|
||||
{'effect': 'None', 'supported_features': 2})
|
||||
{'effect': 'None', 'supported_features': 6})
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get('light.light_group')
|
||||
assert state.attributes['effect'] == 'Random'
|
||||
|
||||
@@ -415,6 +415,12 @@ class TestLightMQTT(unittest.TestCase):
|
||||
'name': 'test',
|
||||
'state_topic': 'test_light_rgb/status',
|
||||
'command_topic': 'test_light_rgb/set',
|
||||
'brightness_command_topic': 'test_light_rgb/brightness/set',
|
||||
'rgb_command_topic': 'test_light_rgb/rgb/set',
|
||||
'color_temp_command_topic': 'test_light_rgb/color_temp/set',
|
||||
'effect_command_topic': 'test_light_rgb/effect/set',
|
||||
'white_value_command_topic': 'test_light_rgb/white_value/set',
|
||||
'xy_command_topic': 'test_light_rgb/xy/set',
|
||||
'brightness_state_topic': 'test_light_rgb/brightness/status',
|
||||
'color_temp_state_topic': 'test_light_rgb/color_temp/status',
|
||||
'effect_state_topic': 'test_light_rgb/effect/status',
|
||||
@@ -475,6 +481,7 @@ class TestLightMQTT(unittest.TestCase):
|
||||
'effect_command_topic': 'test_light_rgb/effect/set',
|
||||
'white_value_command_topic': 'test_light_rgb/white_value/set',
|
||||
'xy_command_topic': 'test_light_rgb/xy/set',
|
||||
'effect_list': ['colorloop', 'random'],
|
||||
'qos': 2,
|
||||
'payload_on': 'on',
|
||||
'payload_off': 'off'
|
||||
|
||||
@@ -228,6 +228,8 @@ class TestLightMQTTTemplate(unittest.TestCase):
|
||||
'{{ green|d }}-'
|
||||
'{{ blue|d }}',
|
||||
'command_off_template': 'off',
|
||||
'effect_list': ['colorloop', 'random'],
|
||||
'effect_command_topic': 'test_light_rgb/effect/set',
|
||||
'qos': 2
|
||||
}
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user