mirror of
https://github.com/home-assistant/core.git
synced 2025-08-01 03:35:09 +02:00
Use light enums in tasmota (#70788)
This commit is contained in:
@@ -10,7 +10,7 @@ from hatasmota.utils import (
|
||||
get_topic_tele_will,
|
||||
)
|
||||
|
||||
from homeassistant.components.light import SUPPORT_EFFECT, SUPPORT_TRANSITION
|
||||
from homeassistant.components.light import LightEntityFeature
|
||||
from homeassistant.components.tasmota.const import DEFAULT_PREFIX
|
||||
from homeassistant.const import ATTR_ASSUMED_STATE, STATE_OFF, STATE_ON, Platform
|
||||
|
||||
@@ -105,7 +105,7 @@ async def test_attributes_dimmer(hass, mqtt_mock, setup_tasmota):
|
||||
assert state.attributes.get("effect_list") is None
|
||||
assert state.attributes.get("min_mireds") is None
|
||||
assert state.attributes.get("max_mireds") is None
|
||||
assert state.attributes.get("supported_features") == SUPPORT_TRANSITION
|
||||
assert state.attributes.get("supported_features") == LightEntityFeature.TRANSITION
|
||||
assert state.attributes.get("supported_color_modes") == ["brightness"]
|
||||
assert state.attributes.get("color_mode") == "brightness"
|
||||
|
||||
@@ -131,7 +131,7 @@ async def test_attributes_ct(hass, mqtt_mock, setup_tasmota):
|
||||
assert state.attributes.get("effect_list") is None
|
||||
assert state.attributes.get("min_mireds") == 153
|
||||
assert state.attributes.get("max_mireds") == 500
|
||||
assert state.attributes.get("supported_features") == SUPPORT_TRANSITION
|
||||
assert state.attributes.get("supported_features") == LightEntityFeature.TRANSITION
|
||||
assert state.attributes.get("supported_color_modes") == ["color_temp"]
|
||||
assert state.attributes.get("color_mode") == "color_temp"
|
||||
|
||||
@@ -158,7 +158,7 @@ async def test_attributes_ct_reduced(hass, mqtt_mock, setup_tasmota):
|
||||
assert state.attributes.get("effect_list") is None
|
||||
assert state.attributes.get("min_mireds") == 200
|
||||
assert state.attributes.get("max_mireds") == 380
|
||||
assert state.attributes.get("supported_features") == SUPPORT_TRANSITION
|
||||
assert state.attributes.get("supported_features") == LightEntityFeature.TRANSITION
|
||||
assert state.attributes.get("supported_color_modes") == ["color_temp"]
|
||||
assert state.attributes.get("color_mode") == "color_temp"
|
||||
|
||||
@@ -192,7 +192,7 @@ async def test_attributes_rgb(hass, mqtt_mock, setup_tasmota):
|
||||
assert state.attributes.get("max_mireds") is None
|
||||
assert (
|
||||
state.attributes.get("supported_features")
|
||||
== SUPPORT_EFFECT | SUPPORT_TRANSITION
|
||||
== LightEntityFeature.EFFECT | LightEntityFeature.TRANSITION
|
||||
)
|
||||
assert state.attributes.get("supported_color_modes") == ["hs"]
|
||||
assert state.attributes.get("color_mode") == "hs"
|
||||
@@ -227,7 +227,7 @@ async def test_attributes_rgbw(hass, mqtt_mock, setup_tasmota):
|
||||
assert state.attributes.get("max_mireds") is None
|
||||
assert (
|
||||
state.attributes.get("supported_features")
|
||||
== SUPPORT_EFFECT | SUPPORT_TRANSITION
|
||||
== LightEntityFeature.EFFECT | LightEntityFeature.TRANSITION
|
||||
)
|
||||
assert state.attributes.get("supported_color_modes") == ["hs", "white"]
|
||||
assert state.attributes.get("color_mode") == "hs"
|
||||
@@ -262,7 +262,7 @@ async def test_attributes_rgbww(hass, mqtt_mock, setup_tasmota):
|
||||
assert state.attributes.get("max_mireds") == 500
|
||||
assert (
|
||||
state.attributes.get("supported_features")
|
||||
== SUPPORT_EFFECT | SUPPORT_TRANSITION
|
||||
== LightEntityFeature.EFFECT | LightEntityFeature.TRANSITION
|
||||
)
|
||||
assert state.attributes.get("supported_color_modes") == ["color_temp", "hs"]
|
||||
assert state.attributes.get("color_mode") == "color_temp"
|
||||
@@ -298,7 +298,7 @@ async def test_attributes_rgbww_reduced(hass, mqtt_mock, setup_tasmota):
|
||||
assert state.attributes.get("max_mireds") == 380
|
||||
assert (
|
||||
state.attributes.get("supported_features")
|
||||
== SUPPORT_EFFECT | SUPPORT_TRANSITION
|
||||
== LightEntityFeature.EFFECT | LightEntityFeature.TRANSITION
|
||||
)
|
||||
assert state.attributes.get("supported_color_modes") == ["color_temp", "hs"]
|
||||
assert state.attributes.get("color_mode") == "color_temp"
|
||||
@@ -1597,7 +1597,7 @@ async def test_discovery_update_reconfigure_light(
|
||||
async_fire_mqtt_message(hass, f"{DEFAULT_PREFIX}/{config[CONF_MAC]}/config", data1)
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get("light.test")
|
||||
assert state.attributes.get("supported_features") == SUPPORT_TRANSITION
|
||||
assert state.attributes.get("supported_features") == LightEntityFeature.TRANSITION
|
||||
assert state.attributes.get("supported_color_modes") == ["brightness"]
|
||||
|
||||
# Reconfigure as RGB light
|
||||
@@ -1606,7 +1606,7 @@ async def test_discovery_update_reconfigure_light(
|
||||
state = hass.states.get("light.test")
|
||||
assert (
|
||||
state.attributes.get("supported_features")
|
||||
== SUPPORT_EFFECT | SUPPORT_TRANSITION
|
||||
== LightEntityFeature.EFFECT | LightEntityFeature.TRANSITION
|
||||
)
|
||||
assert state.attributes.get("supported_color_modes") == ["hs"]
|
||||
|
||||
|
Reference in New Issue
Block a user