Skip to content

Commit

Permalink
debug eneity key error
Browse files Browse the repository at this point in the history
  • Loading branch information
grimmpp committed Feb 15, 2024
1 parent 313f273 commit 5a9b3f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions custom_components/eltako/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,12 @@ class GatewayConnectionState(AbstractBinarySensor):
"""Protocols last time when message received"""

def __init__(self, platform: str, gateway: EnOceanGateway):
description_key = "Gateway_Connection_State"
self.description_key = "Gateway_Connection_State"

self._attr_icon = "mdi:connection"
self._attr_name = "Connected"

super().__init__(platform, gateway, gateway.base_id, dev_name="Connected", description_key=description_key)
super().__init__(platform, gateway, gateway.base_id, dev_name="Connected")
self.gateway.set_connection_state_changed_handler(self.async_value_changed)

@property
Expand Down
5 changes: 3 additions & 2 deletions custom_components/eltako/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class EltakoEntity(Entity):
"""Parent class for all entities associated with the Eltako component."""


def __init__(self, platform: str, gateway: EnOceanGateway, dev_id: AddressExpression, dev_name: str="Device", dev_eep: EEP=None, description_key:str=None):
def __init__(self, platform: str, gateway: EnOceanGateway, dev_id: AddressExpression, dev_name: str="Device", dev_eep: EEP=None):
"""Initialize the device."""
self._attr_has_entity_name = True
self._attr_should_poll = True
Expand All @@ -36,7 +36,7 @@ def __init__(self, platform: str, gateway: EnOceanGateway, dev_id: AddressExpres
self._attr_dev_eep = dev_eep
self.listen_to_addresses = []
self.listen_to_addresses.append(self.dev_id[0])
self.description_key = self._get_description_key(description_key)
self.description_key = self._get_description_key()
self._attr_unique_id = EltakoEntity._get_identifier(self.gateway, self.dev_id, self.description_key)
# self._attr_identifier = EltakoEntity._get_identifier(self.gateway, self.dev_id, self._get_description_key())
self.entity_id = f"{self._attr_ha_platform}.{self._attr_unique_id}"
Expand All @@ -62,6 +62,7 @@ def _get_description_key(self, description_key:str=None):
if hasattr(self, 'entity_description') and self.entity_description is not None:
if self.description_key is None:
self.description_key = self.entity_description.key

return self.description_key

@property
Expand Down

0 comments on commit 5a9b3f7

Please sign in to comment.