mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 03:37:07 +00:00
Migrate modbus light to color_mode (#69426)
This commit is contained in:
parent
def305cf46
commit
181142aae7
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant.components.light import LightEntity
|
from homeassistant.components.light import COLOR_MODE_ONOFF, LightEntity
|
||||||
from homeassistant.const import CONF_LIGHTS, CONF_NAME
|
from homeassistant.const import CONF_LIGHTS, CONF_NAME
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -36,6 +36,9 @@ async def async_setup_platform(
|
|||||||
class ModbusLight(BaseSwitch, LightEntity):
|
class ModbusLight(BaseSwitch, LightEntity):
|
||||||
"""Class representing a Modbus light."""
|
"""Class representing a Modbus light."""
|
||||||
|
|
||||||
|
_attr_color_mode = COLOR_MODE_ONOFF
|
||||||
|
_attr_supported_color_modes = {COLOR_MODE_ONOFF}
|
||||||
|
|
||||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||||
"""Set light on."""
|
"""Set light on."""
|
||||||
await self.async_turn(self.command_on)
|
await self.async_turn(self.command_on)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user