mirror of
https://github.com/home-assistant/core.git
synced 2025-07-29 16:17:20 +00:00
Add device and enable entity name for Lutron homeworks (#112268)
This commit is contained in:
parent
68141873cd
commit
32964a2e90
@ -166,6 +166,7 @@ def calculate_unique_id(controller_id: str, addr: str, idx: int) -> str:
|
|||||||
class HomeworksEntity(Entity):
|
class HomeworksEntity(Entity):
|
||||||
"""Base class of a Homeworks device."""
|
"""Base class of a Homeworks device."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
_attr_should_poll = False
|
_attr_should_poll = False
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -10,6 +10,7 @@ from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEnti
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
from homeassistant.helpers.device_registry import DeviceInfo
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
@ -54,7 +55,10 @@ class HomeworksLight(HomeworksEntity, LightEntity):
|
|||||||
rate: float,
|
rate: float,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Create device with Addr, name, and rate."""
|
"""Create device with Addr, name, and rate."""
|
||||||
super().__init__(controller, controller_id, addr, 0, name)
|
super().__init__(controller, controller_id, addr, 0, None)
|
||||||
|
self._attr_device_info = DeviceInfo(
|
||||||
|
identifiers={(DOMAIN, f"{controller_id}.{addr}")}, name=name
|
||||||
|
)
|
||||||
self._rate = rate
|
self._rate = rate
|
||||||
self._level = 0
|
self._level = 0
|
||||||
self._prev_level = 0
|
self._prev_level = 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user