Skip to content

Commit f0c9e7a

Browse files
committed
add system id to keys, where needed, and names
1 parent 9ebe162 commit f0c9e7a

3 files changed

Lines changed: 14 additions & 7 deletions

File tree

‎custom_components/tigo_cloud/const.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
DOMAIN = "tigo"
1+
DOMAIN = "tigo_cloud"
22

33
CONF_USERNAME = "username"
44
CONF_PASSWORD = "password"

‎custom_components/tigo_cloud/sensor.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
from .const import DOMAIN
2424

25+
import logging
26+
_LOGGER = logging.getLogger(__name__)
27+
2528
PANEL_PROPERTIES = {
2629
"energy": {
2730
"name": "Energy",
@@ -160,9 +163,9 @@ def __init__(self, coordinator, property) -> None:
160163
"""Initialize the sensor."""
161164
super().__init__(coordinator)
162165
self._property = property
163-
self._attr_unique_id = DOMAIN + "tigo.summary." + property
166+
self._attr_unique_id = DOMAIN + "tigo.summary." + coordinator.get_systemId() + "." + property
164167

165-
self._attr_name = SUMMARY_PROPERTIES[property]["name"]
168+
self._attr_name = SUMMARY_PROPERTIES[property]["name"] + " [" + coordinator.get_systemId() + "]"
166169
self._attr_native_unit_of_measurement = SUMMARY_PROPERTIES[property][
167170
"native_unit_of_measurement"
168171
]
@@ -195,7 +198,7 @@ def __init__(self, panel, coordinator, property) -> None:
195198
self._panel = panel
196199
self._attr_unique_id = DOMAIN + "tigo." + panel["T"] + "_" + property
197200

198-
self._attr_name = panel["C"] + " " + PANEL_PROPERTIES[property]["name"]
201+
self._attr_name = panel["C"] + " " + PANEL_PROPERTIES[property]["name"] + " [" + coordinator.get_systemId() + "]"
199202
self._attr_native_unit_of_measurement = PANEL_PROPERTIES[property][
200203
"native_unit_of_measurement"
201204
]

‎custom_components/tigo_cloud/tigo.py‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ def get_summary(self, property) -> any:
198198
"""Retun summary reading."""
199199
return self._data.get(property)
200200

201+
def get_systemId(self) -> any:
202+
"""Return the system id"""
203+
return self._systemId
204+
201205

202206
# see https://developers.home-assistant.io/docs/integration_fetching_data/
203207
class TigoCoordinator(DataUpdateCoordinator):
@@ -232,6 +236,6 @@ def get_summary(self, property) -> any:
232236
"""Get the summary reading."""
233237
return self.tigo_data.get_summary(property)
234238

235-
def get_data(self) -> any:
236-
"""Get the whole reaging data."""
237-
return self.htigo_data.get_data()
239+
def get_systemId(self) -> any:
240+
"""Return the system id"""
241+
return self.tigo_data.get_systemId()

0 commit comments

Comments
 (0)