Migrate modbus light to color_mode (#69426)

This commit is contained in:
Erik Montnemery 2022-04-06 20:27:03 +02:00 committed by GitHub
parent def305cf46
commit 181142aae7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,7 @@ from __future__ import annotations
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.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -36,6 +36,9 @@ async def async_setup_platform(
class ModbusLight(BaseSwitch, LightEntity):
"""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:
"""Set light on."""
await self.async_turn(self.command_on)