mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Use ColorMode enum in switch (#70537)
This commit is contained in:
parent
7d2e75e6ab
commit
be6dc81fc0
@ -5,11 +5,7 @@ from typing import Any
|
|||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import PLATFORM_SCHEMA, ColorMode, LightEntity
|
||||||
COLOR_MODE_ONOFF,
|
|
||||||
PLATFORM_SCHEMA,
|
|
||||||
LightEntity,
|
|
||||||
)
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ENTITY_ID,
|
ATTR_ENTITY_ID,
|
||||||
CONF_ENTITY_ID,
|
CONF_ENTITY_ID,
|
||||||
@ -63,9 +59,9 @@ async def async_setup_platform(
|
|||||||
class LightSwitch(LightEntity):
|
class LightSwitch(LightEntity):
|
||||||
"""Represents a Switch as a Light."""
|
"""Represents a Switch as a Light."""
|
||||||
|
|
||||||
_attr_color_mode = COLOR_MODE_ONOFF
|
_attr_color_mode = ColorMode.ONOFF
|
||||||
_attr_should_poll = False
|
_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:
|
def __init__(self, name: str, switch_entity_id: str, unique_id: str | None) -> None:
|
||||||
"""Initialize Light Switch."""
|
"""Initialize Light Switch."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user