Use ColorMode enum in switch (#70537)

This commit is contained in:
epenet 2022-04-23 22:26:35 +02:00 committed by GitHub
parent 7d2e75e6ab
commit be6dc81fc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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."""