Migrate myq light to color_mode (#69427)

This commit is contained in:
Erik Montnemery 2022-04-07 09:09:07 +02:00 committed by GitHub
parent a10a1794d9
commit 9834197f71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -1,7 +1,7 @@
"""Support for MyQ-Enabled lights."""
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.const import STATE_OFF, STATE_ON
from homeassistant.core import HomeAssistant
@ -30,7 +30,8 @@ async def async_setup_entry(
class MyQLight(MyQEntity, LightEntity):
"""Representation of a MyQ light."""
_attr_supported_features = 0
_attr_color_mode = COLOR_MODE_ONOFF
_attr_supported_color_modes = {COLOR_MODE_ONOFF}
@property
def is_on(self):

View File

@ -1,5 +1,6 @@
"""The scene tests for the myq platform."""
from homeassistant.components.light import COLOR_MODE_ONOFF
from homeassistant.const import STATE_OFF, STATE_ON
from .util import async_init_integration
@ -15,6 +16,7 @@ async def test_create_lights(hass):
expected_attributes = {
"friendly_name": "Garage Door Light Off",
"supported_features": 0,
"supported_color_modes": [COLOR_MODE_ONOFF],
}
# Only test for a subset of attributes in case
# HA changes the implementation and a new one appears
@ -27,6 +29,7 @@ async def test_create_lights(hass):
expected_attributes = {
"friendly_name": "Garage Door Light On",
"supported_features": 0,
"supported_color_modes": [COLOR_MODE_ONOFF],
}
# Only test for a subset of attributes in case
# HA changes the implementation and a new one appears