@@ -85,11 +85,12 @@ def __init__(self) -> None:
8585 self ._gateway_id : str = NONE
8686 self ._zones : dict [str , GwEntityData ]
8787 self .gw_entities : dict [str , GwEntityData ]
88- self .smile_hw_version : str | None
89- self .smile_mac_address : str | None
90- self .smile_model : str
91- self .smile_model_id : str | None
92- self .smile_version : version .Version
88+ self .smile : Munch = Munch ()
89+ self .smile .hw_version : str | None
90+ self .smile .mac_address : str | None
91+ self .smile .model : str
92+ self .smile .model_id : str | None
93+ self .smile .version : version .Version
9394
9495 @property
9596 def gateway_id (self ) -> str :
@@ -160,7 +161,7 @@ def _all_appliances(self) -> None:
160161
161162 self ._create_gw_entities (appl )
162163
163- if self .smile_type == "power" :
164+ if self .smile . type == "power" :
164165 self ._get_p1_smartmeter_info ()
165166
166167 # Sort the gw_entities
@@ -268,12 +269,12 @@ def _appliance_info_finder(self, appl: Munch, appliance: etree.Element) -> Munch
268269 def _appl_gateway_info (self , appl : Munch , appliance : etree .Element ) -> Munch :
269270 """Helper-function for _appliance_info_finder()."""
270271 self ._gateway_id = appliance .attrib ["id" ]
271- appl .firmware = str (self .smile_version )
272- appl .hardware = self .smile_hw_version
273- appl .mac = self .smile_mac_address
274- appl .model = self .smile_model
275- appl .model_id = self .smile_model_id
276- appl .name = self .smile_name
272+ appl .firmware = str (self .smile . version )
273+ appl .hardware = self .smile . hw_version
274+ appl .mac = self .smile . mac_address
275+ appl .model = self .smile . model
276+ appl .model_id = self .smile . model_id
277+ appl .name = self .smile . name
277278 appl .vendor_name = "Plugwise"
278279
279280 # Adam: collect the ZigBee MAC address of the Smile
@@ -346,7 +347,7 @@ def _get_measurement_data(self, entity_id: str) -> GwEntityData:
346347 # Get P1 smartmeter data from LOCATIONS
347348 entity = self .gw_entities [entity_id ]
348349 # !! DON'T CHANGE below two if-lines, will break stuff !!
349- if self .smile_type == "power" :
350+ if self .smile . type == "power" :
350351 if entity ["dev_class" ] == "smartmeter" :
351352 data .update (self ._power_data_from_location ())
352353
@@ -799,8 +800,8 @@ def _control_state(self, data: GwEntityData, loc_id: str) -> str | bool:
799800
800801 # Handle missing control_state in regulation_mode off for firmware >= 3.2.0 (issue #776)
801802 # In newer firmware versions, default to "off" when control_state is not present
802- if self .smile_version != version .Version ("0.0.0" ):
803- if self .smile_version >= version .parse ("3.2.0" ):
803+ if self .smile . version != version .Version ("0.0.0" ):
804+ if self .smile . version >= version .parse ("3.2.0" ):
804805 return "off"
805806
806807 # Older Adam firmware does not have the control_state xml-key
0 commit comments