mirror of
https://github.com/Andre0512/hon.git
synced 2025-05-23 03:06:51 -04:00
More functions
This commit is contained in:
parent
31c30b1670
commit
136a1810fc
12 changed files with 140 additions and 46 deletions
|
@ -1,29 +0,0 @@
|
|||
from pyhon.device import HonDevice
|
||||
|
||||
from .const import DOMAIN
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
|
||||
class HonEntity(CoordinatorEntity):
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(self, hass, entry, coordinator, device: HonDevice) -> None:
|
||||
super().__init__(coordinator)
|
||||
|
||||
self._hon = hass.data[DOMAIN][entry.unique_id]
|
||||
self._hass = hass
|
||||
self._device = device
|
||||
|
||||
self._attr_unique_id = self._device.mac_address
|
||||
|
||||
@property
|
||||
def device_info(self):
|
||||
"""Return a device description for device registry."""
|
||||
return DeviceInfo(
|
||||
identifiers={(DOMAIN, self._device.mac_address)},
|
||||
manufacturer=self._device.brand,
|
||||
name=self._device.nick_name if self._device.nick_name else self._device.model_name,
|
||||
model=self._device.model_name,
|
||||
sw_version=self._device.fw_version,
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue