From be6dc81fc0a84fc0b65b2ad0ff85db3cbd1d4884 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Sat, 23 Apr 2022 22:26:35 +0200 Subject: [PATCH] Use ColorMode enum in switch (#70537) --- homeassistant/components/switch/light.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/switch/light.py b/homeassistant/components/switch/light.py index ac548652953..fd2a5afff1c 100644 --- a/homeassistant/components/switch/light.py +++ b/homeassistant/components/switch/light.py @@ -5,11 +5,7 @@ from typing import Any import voluptuous as vol -from homeassistant.components.light import ( - COLOR_MODE_ONOFF, - PLATFORM_SCHEMA, - LightEntity, -) +from homeassistant.components.light import PLATFORM_SCHEMA, ColorMode, LightEntity from homeassistant.const import ( ATTR_ENTITY_ID, CONF_ENTITY_ID, @@ -63,9 +59,9 @@ async def async_setup_platform( class LightSwitch(LightEntity): """Represents a Switch as a Light.""" - _attr_color_mode = COLOR_MODE_ONOFF + _attr_color_mode = ColorMode.ONOFF _attr_should_poll = False - _attr_supported_color_modes = {COLOR_MODE_ONOFF} + _attr_supported_color_modes = {ColorMode.ONOFF} def __init__(self, name: str, switch_entity_id: str, unique_id: str | None) -> None: """Initialize Light Switch."""