Skip to content

Commit

Permalink
Shift to sensor from entity
Browse files Browse the repository at this point in the history
  • Loading branch information
drc38 authored Jan 18, 2024
1 parent 1b5717b commit 163b08f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 0 additions & 6 deletions custom_components/dius/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ def __init__(self, coordinator, config_entry, description):
self.config_entry = config_entry
self.entity_description = description

@property
def _attr_unique_id(self):
"""Return a unique ID to use for this entity."""
data = self.coordinator.data.get(self.entity_description.key)
return data.get(Msg_keys.mac.value)

@property
def device_info(self) -> DeviceInfo:
return DeviceInfo(
Expand Down
7 changes: 7 additions & 0 deletions custom_components/dius/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def __init__(self, coordinator, config_entry, description: DiusSensorDescription
self._config = config_entry
self.entity_description = description
self._extra_attr = {}
self._attr_name = None
self._power: float | None = None

@property
Expand Down Expand Up @@ -86,3 +87,9 @@ def extra_state_attributes(self):
"HA_reconnects": self.coordinator.data.get("reconnects")
}
return data

@property
def _attr_unique_id(self):
"""Return a unique ID to use for this entity."""
data = self.coordinator.data.get(self.entity_description.key)
return data.get(Msg_keys.mac.value)

0 comments on commit 163b08f

Please sign in to comment.