Skip to content

Commit

Permalink
Merge pull request #92 from jasperslits/revert-key
Browse files Browse the repository at this point in the history
Revert reafactor of key
  • Loading branch information
benjamin-dcs authored Jan 10, 2025
2 parents a941a9d + 37fa3a7 commit b643078
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 8 additions & 0 deletions custom_components/ithodaalderop/definitions/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
A sensor entity represents passive, read-only data provided by a device. It reflects the current state or measurement of something in the environment without directly interacting with or changing the device.
A control entity represents interactive elements that allow the user to send commands or configure a device to change its state or behavior.
A diagnostic entity provides device-specific metadata or operational insights that assist in understanding the device's internal state or functioning but is not directly related to the user's environment.
https://developers.home-assistant.io/docs/core/entity/#entity-description
By default the EntityDescription instance has one required attribute named key.
This is a string which is meant to be unique for all the entity descriptions of an implementing platform.
A common use case for this attribute is to include it in the unique_id of the described entity.
The defined keys within this integration are unique per Itho device. Some are re-used for several devices, such as 'Error'.
The key is also used to define the translation_key and to setup the unique_id of each sensor
"""

from __future__ import annotations
Expand Down
2 changes: 0 additions & 2 deletions custom_components/ithodaalderop/sensors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def __init__(
self._attr_unique_id = f"itho_{ADDON_TYPES[config_entry.data[CONF_ADDON_TYPE]]}_{description.key}"

self.entity_id = f"sensor.{self._attr_unique_id}"
self.entity_description.key = self.entity_id

@property
def icon(self) -> str | None:
Expand Down Expand Up @@ -110,7 +109,6 @@ def __init__(
f"itho_{ADDON_TYPES[config_entry.data[CONF_ADDON_TYPE]]}_{description.key}"
)
self.entity_id = f"binary_sensor.{self._attr_unique_id}"
self.entity_description.key = self.entity_id

@property
def icon(self):
Expand Down

0 comments on commit b643078

Please sign in to comment.