Add min_mireds and max_mireds to MQTT Light (#32613)

* Add min_mireds and max_mireds to MQTT Light

* Add abbreviations for min_mireds and max_mireds

* Add tests for min_mireds and max_mireds
This commit is contained in:
Pieter Goetschalckx authored and GitHub committed 2020-05-10 09:34:48 +02:00
1 parent 8947ce5053
commit 02a36a9b68
7 files changed
+106

No files matched your search

+19
View File
@@ -1483,3 +1483,22 @@ async def test_entity_debug_info_message(hass, mqtt_mock):
await help_test_entity_debug_info_message(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG
)
async def test_max_mireds(hass, mqtt_mock):
"""Test setting min_mireds and max_mireds."""
config = {
light.DOMAIN: {
"platform": "mqtt",
"name": "test",
"command_topic": "test_max_mireds/set",
"color_temp_command_topic": "test_max_mireds/color_temp/set",
"max_mireds": 370,
}
}
assert await async_setup_component(hass, light.DOMAIN, config)
state = hass.states.get("light.test")
assert state.attributes.get("min_mireds") == 153
assert state.attributes.get("max_mireds") == 370
+20
View File
@@ -1219,3 +1219,23 @@ async def test_entity_debug_info_message(hass, mqtt_mock):
await help_test_entity_debug_info_message(
hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG, payload='{"state":"ON"}'
)
async def test_max_mireds(hass, mqtt_mock):
"""Test setting min_mireds and max_mireds."""
config = {
light.DOMAIN: {
"platform": "mqtt",
"schema": "json",
"name": "test",
"command_topic": "test_max_mireds/set",
"color_temp": True,
"max_mireds": 370,
}
}
assert await async_setup_component(hass, light.DOMAIN, config)
state = hass.states.get("light.test")
assert state.attributes.get("min_mireds") == 153
assert state.attributes.get("max_mireds") == 370
@@ -976,3 +976,25 @@ async def test_entity_debug_info_message(hass, mqtt_mock):
}
}
await help_test_entity_debug_info_message(hass, mqtt_mock, light.DOMAIN, config)
async def test_max_mireds(hass, mqtt_mock):
"""Test setting min_mireds and max_mireds."""
config = {
light.DOMAIN: {
"platform": "mqtt",
"schema": "template",
"name": "test",
"command_topic": "test_max_mireds/set",
"command_on_template": "on",
"command_off_template": "off",
"color_temp_template": "{{ value }}",
"max_mireds": 370,
}
}
assert await async_setup_component(hass, light.DOMAIN, config)
state = hass.states.get("light.test")
assert state.attributes.get("min_mireds") == 153
assert state.attributes.get("max_mireds") == 370