From 9834197f71008bfd2059f1162768f017c0346501 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Thu, 7 Apr 2022 09:09:07 +0200 Subject: [PATCH] Migrate myq light to color_mode (#69427) --- homeassistant/components/myq/light.py | 5 +++-- tests/components/myq/test_light.py | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/myq/light.py b/homeassistant/components/myq/light.py index d3f6c6de36b..49ac4755d4c 100644 --- a/homeassistant/components/myq/light.py +++ b/homeassistant/components/myq/light.py @@ -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): diff --git a/tests/components/myq/test_light.py b/tests/components/myq/test_light.py index c7b3dbc8427..acc12ef0ce1 100644 --- a/tests/components/myq/test_light.py +++ b/tests/components/myq/test_light.py @@ -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