mirror of
https://github.com/andvikt/mega_hacs.git
synced 2025-12-11 00:54:28 +05:00
новы способ адресации кастомизаций
This commit is contained in:
@@ -129,12 +129,14 @@ class BaseMegaEntity(CoordinatorEntity, RestoreEntity):
|
|||||||
if self.hass is None:
|
if self.hass is None:
|
||||||
return {}
|
return {}
|
||||||
if self._customize is None:
|
if self._customize is None:
|
||||||
|
c_entity_id = self.hass.data.get(DOMAIN, {}).get(self.entity_id, {})
|
||||||
c = self.hass.data.get(DOMAIN, {}).get(CONF_CUSTOM) or {}
|
c = self.hass.data.get(DOMAIN, {}).get(CONF_CUSTOM) or {}
|
||||||
c = c.get(self._mega_id) or {}
|
c = c.get(self._mega_id) or {}
|
||||||
c = c.get(self.port) or {}
|
c = c.get(self.port) or {}
|
||||||
if self.addr is not None and self.index is not None and isinstance(c, dict):
|
if self.addr is not None and self.index is not None and isinstance(c, dict):
|
||||||
idx = self.addr.lower() + f'_a' if self.index == 0 else '_b'
|
idx = self.addr.lower() + f'_a' if self.index == 0 else '_b'
|
||||||
c = c.get(idx, {})
|
c = c.get(idx, {})
|
||||||
|
c.update(c_entity_id)
|
||||||
self._customize = c
|
self._customize = c
|
||||||
|
|
||||||
return self._customize
|
return self._customize
|
||||||
|
|||||||
Reference in New Issue
Block a user