mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 13:47:35 +00:00
Migrate myq light to color_mode (#69427)
This commit is contained in:
parent
a10a1794d9
commit
9834197f71
@ -1,7 +1,7 @@
|
|||||||
"""Support for MyQ-Enabled lights."""
|
"""Support for MyQ-Enabled lights."""
|
||||||
from pymyq.errors import MyQError
|
from pymyq.errors import MyQError
|
||||||
|
|
||||||
from homeassistant.components.light import LightEntity
|
from homeassistant.components.light import COLOR_MODE_ONOFF, LightEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import STATE_OFF, STATE_ON
|
from homeassistant.const import STATE_OFF, STATE_ON
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -30,7 +30,8 @@ async def async_setup_entry(
|
|||||||
class MyQLight(MyQEntity, LightEntity):
|
class MyQLight(MyQEntity, LightEntity):
|
||||||
"""Representation of a MyQ light."""
|
"""Representation of a MyQ light."""
|
||||||
|
|
||||||
_attr_supported_features = 0
|
_attr_color_mode = COLOR_MODE_ONOFF
|
||||||
|
_attr_supported_color_modes = {COLOR_MODE_ONOFF}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"""The scene tests for the myq platform."""
|
"""The scene tests for the myq platform."""
|
||||||
|
|
||||||
|
from homeassistant.components.light import COLOR_MODE_ONOFF
|
||||||
from homeassistant.const import STATE_OFF, STATE_ON
|
from homeassistant.const import STATE_OFF, STATE_ON
|
||||||
|
|
||||||
from .util import async_init_integration
|
from .util import async_init_integration
|
||||||
@ -15,6 +16,7 @@ async def test_create_lights(hass):
|
|||||||
expected_attributes = {
|
expected_attributes = {
|
||||||
"friendly_name": "Garage Door Light Off",
|
"friendly_name": "Garage Door Light Off",
|
||||||
"supported_features": 0,
|
"supported_features": 0,
|
||||||
|
"supported_color_modes": [COLOR_MODE_ONOFF],
|
||||||
}
|
}
|
||||||
# Only test for a subset of attributes in case
|
# Only test for a subset of attributes in case
|
||||||
# HA changes the implementation and a new one appears
|
# HA changes the implementation and a new one appears
|
||||||
@ -27,6 +29,7 @@ async def test_create_lights(hass):
|
|||||||
expected_attributes = {
|
expected_attributes = {
|
||||||
"friendly_name": "Garage Door Light On",
|
"friendly_name": "Garage Door Light On",
|
||||||
"supported_features": 0,
|
"supported_features": 0,
|
||||||
|
"supported_color_modes": [COLOR_MODE_ONOFF],
|
||||||
}
|
}
|
||||||
# Only test for a subset of attributes in case
|
# Only test for a subset of attributes in case
|
||||||
# HA changes the implementation and a new one appears
|
# HA changes the implementation and a new one appears
|
||||||
|
Loading…
x
Reference in New Issue
Block a user