Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Multi-device report sensors (#174)
Browse files Browse the repository at this point in the history
Unique id for reports to manage the same sensors on several devices
  • Loading branch information
xaviergriffon authored Jan 9, 2023
1 parent 11bec7a commit 25f5923
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/multimatic/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class ReportSensor(MultimaticEntity, SensorEntity):

def __init__(self, coordinator: MultimaticCoordinator, report: Report) -> None:
"""Init entity."""
MultimaticEntity.__init__(self, coordinator, DOMAIN, report.id)
MultimaticEntity.__init__(self, coordinator, DOMAIN, f"{report.device_id}_{report.id}")
self._report_id = report.id
self._unit = report.unit
self._name = report.name
Expand All @@ -122,7 +122,7 @@ def report(self):
(
report
for report in self.coordinator.data
if report.id == self._report_id
if report.device_id == self._device_id and report.id == self._report_id
),
None,
)
Expand Down

0 comments on commit 25f5923

Please sign in to comment.