mirror of
https://github.com/andvikt/mega_hacs.git
synced 2025-12-11 17:14:28 +05:00
fix #151
This commit is contained in:
@@ -8,6 +8,7 @@ from functools import partial
|
|||||||
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 State
|
from homeassistant.core import State
|
||||||
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
from homeassistant.helpers.restore_state import RestoreEntity
|
from homeassistant.helpers.restore_state import RestoreEntity
|
||||||
from . import hub as h
|
from . import hub as h
|
||||||
@@ -142,7 +143,7 @@ class BaseMegaEntity(CoordinatorEntity, RestoreEntity):
|
|||||||
return self._customize
|
return self._customize
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self):
|
def device_info(self) -> DeviceInfo:
|
||||||
if isinstance(self.port, list):
|
if isinstance(self.port, list):
|
||||||
pt_idx = self.id_suffix
|
pt_idx = self.id_suffix
|
||||||
else:
|
else:
|
||||||
@@ -151,19 +152,16 @@ class BaseMegaEntity(CoordinatorEntity, RestoreEntity):
|
|||||||
pt_idx, _ = _pt.split('e')
|
pt_idx, _ = _pt.split('e')
|
||||||
else:
|
else:
|
||||||
pt_idx = _pt
|
pt_idx = _pt
|
||||||
return {
|
return DeviceInfo(
|
||||||
"identifiers": {
|
identifiers={
|
||||||
# Serial numbers are unique identifiers within a specific domain
|
# Serial numbers are unique identifiers within a specific domain
|
||||||
(DOMAIN, f'{self._mega_id}', pt_idx),
|
(DOMAIN, f'{self._mega_id}'), #pt_idx
|
||||||
},
|
},
|
||||||
"config_entries": [
|
name=self.name,
|
||||||
self.config_entry,
|
manufacturer='ab-log.ru',
|
||||||
],
|
sw_version=self.mega.fw,
|
||||||
"name": f'{self._mega_id} port {pt_idx}' if not isinstance(self.port, list) else f'{self._mega_id} {pt_idx}',
|
via_device=(DOMAIN, self._mega_id),
|
||||||
"manufacturer": 'ab-log.ru',
|
)
|
||||||
"sw_version": self.mega.fw,
|
|
||||||
"via_device": (DOMAIN, self._mega_id),
|
|
||||||
}
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def lg(self) -> logging.Logger:
|
def lg(self) -> logging.Logger:
|
||||||
|
|||||||
Reference in New Issue
Block a user