2021-06-09 18:15:46 +00:00
|
|
|
"""Models for WLED."""
|
2022-01-04 12:49:15 +00:00
|
|
|
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
2021-06-09 18:15:46 +00:00
|
|
|
from homeassistant.helpers.entity import DeviceInfo
|
|
|
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
|
|
|
|
|
|
|
from .const import DOMAIN
|
|
|
|
from .coordinator import WLEDDataUpdateCoordinator
|
|
|
|
|
|
|
|
|
2022-03-21 14:29:11 +00:00
|
|
|
class WLEDEntity(CoordinatorEntity[WLEDDataUpdateCoordinator]):
|
2021-06-09 18:15:46 +00:00
|
|
|
"""Defines a base WLED entity."""
|
|
|
|
|
|
|
|
@property
|
|
|
|
def device_info(self) -> DeviceInfo:
|
|
|
|
"""Return device information about this WLED device."""
|
2021-10-14 22:46:26 +00:00
|
|
|
return DeviceInfo(
|
2022-01-04 12:49:15 +00:00
|
|
|
connections={
|
|
|
|
(CONNECTION_NETWORK_MAC, self.coordinator.data.info.mac_address)
|
|
|
|
},
|
2021-10-14 22:46:26 +00:00
|
|
|
identifiers={(DOMAIN, self.coordinator.data.info.mac_address)},
|
|
|
|
name=self.coordinator.data.info.name,
|
|
|
|
manufacturer=self.coordinator.data.info.brand,
|
|
|
|
model=self.coordinator.data.info.product,
|
2021-11-14 20:03:00 +00:00
|
|
|
sw_version=str(self.coordinator.data.info.version),
|
2022-01-25 23:07:52 +00:00
|
|
|
hw_version=self.coordinator.data.info.architecture,
|
2021-10-14 22:46:26 +00:00
|
|
|
configuration_url=f"http://{self.coordinator.wled.host}",
|
|
|
|
)
|