@@ -66,6 +66,7 @@ def __init__(self) -> None:
6666 """Set the constructor for this class."""
6767 super ().__init__ ()
6868 self ._appliances : etree .Element
69+ self ._gateway_id : str = NONE
6970 self ._is_thermostat : bool
7071 self ._loc_data : dict [str , ThermoLoc ]
7172 self ._locations : etree .Element
@@ -77,6 +78,11 @@ def __init__(self) -> None:
7778 self .smile_version : Version
7879 self .smile_zigbee_mac_address : str | None
7980
81+ @property
82+ def gateway_id (self ) -> str :
83+ """Return the gateway-id."""
84+ return self ._gateway_id
85+
8086 def _all_appliances (self ) -> None :
8187 """Collect all appliances with relevant info."""
8288 self ._count = 0
@@ -173,11 +179,11 @@ def _create_legacy_gateway(self) -> None:
173179
174180 Use the home_location or FAKE_APPL as entity id.
175181 """
176- self .gateway_id = self ._home_loc_id
182+ self ._gateway_id = self ._home_loc_id
177183 if self .smile_type == "power" :
178- self .gateway_id = FAKE_APPL
184+ self ._gateway_id = FAKE_APPL
179185
180- self .gw_entities [self .gateway_id ] = {"dev_class" : "gateway" }
186+ self .gw_entities [self ._gateway_id ] = {"dev_class" : "gateway" }
181187 self ._count += 1
182188 for key , value in {
183189 "firmware" : str (self .smile_version ),
@@ -190,7 +196,7 @@ def _create_legacy_gateway(self) -> None:
190196 }.items ():
191197 if value is not None :
192198 gw_key = cast (ApplianceType , key )
193- self .gw_entities [self .gateway_id ][gw_key ] = value
199+ self .gw_entities [self ._gateway_id ][gw_key ] = value
194200 self ._count += 1
195201
196202 def _appliance_info_finder (self , appliance : etree , appl : Munch ) -> Munch :
@@ -282,7 +288,7 @@ def _get_measurement_data(self, entity_id: str) -> GwEntityData:
282288
283289 # Anna: the Smile outdoor_temperature is present in the Home location
284290 # For some Anna's LOCATIONS is empty, falling back to domain_objects!
285- if self ._is_thermostat and entity_id == self .gateway_id :
291+ if self ._is_thermostat and entity_id == self ._gateway_id :
286292 locator = f"./location[@id='{ self ._home_loc_id } ']/logs/point_log[type='outdoor_temperature']/period/measurement"
287293 if (found := self ._domain_objects .find (locator )) is not None :
288294 value = format_measure (found .text , NONE )
0 commit comments