@@ -278,6 +278,10 @@ def __init__(self) -> None:
278278 self .smile_zigbee_mac_address : str | None = None
279279 self .therms_with_offset_func : list [str ] = []
280280
281+ def smile (self , name : str ) -> bool :
282+ """Helper-function checking the smile-name."""
283+ return self .smile_name == name
284+
281285 def _all_locations (self ) -> None :
282286 """Collect all locations."""
283287 loc = Munch ()
@@ -382,7 +386,7 @@ def _energy_device_info_finder(self, appliance: etree, appl: Munch) -> Munch | N
382386
383387 return appl
384388
385- if self .smile_name == ADAM :
389+ if self .smile ( ADAM ) :
386390 locator = "./logs/interval_log/electricity_interval_meter"
387391 mod_type = "electricity_interval_meter"
388392 module_data = self ._get_module_data (appliance , locator , mod_type )
@@ -413,7 +417,7 @@ def _appliance_info_finder(self, appliance: etree, appl: Munch) -> Munch:
413417 appl .vendor_name = "Plugwise"
414418
415419 # Adam: look for the ZigBee MAC address of the Smile
416- if self .smile_name == ADAM and (
420+ if self .smile ( ADAM ) and (
417421 found := self ._modules .find (".//protocols/zig_bee_coordinator" )
418422 ):
419423 appl .zigbee_mac = found .find ("mac_address" ).text
@@ -832,7 +836,7 @@ def _wireless_availablity(self, appliance: etree, data: DeviceData) -> None:
832836
833837 Collect the availablity-status for wireless connected devices.
834838 """
835- if self .smile_name == ADAM :
839+ if self .smile ( ADAM ) :
836840 # Collect for Plugs
837841 locator = "./logs/interval_log/electricity_interval_meter"
838842 mod_type = "electricity_interval_meter"
@@ -953,11 +957,11 @@ def _process_c_heating_state(self, data: DeviceData) -> None:
953957 if self ._on_off_device :
954958 # Anna + OnOff heater: use central_heating_state to show heating_state
955959 # Solution for Core issue #81839
956- if self .smile_name == ANNA :
960+ if self .smile ( ANNA ) :
957961 data ["binary_sensors" ]["heating_state" ] = data ["c_heating_state" ]
958962
959963 # Adam + OnOff cooling: use central_heating_state to show heating/cooling_state
960- if self .smile_name == ADAM :
964+ if self .smile ( ADAM ) :
961965 if "heating_state" not in data ["binary_sensors" ]:
962966 self ._count += 1
963967 data ["binary_sensors" ]["heating_state" ] = False
@@ -1011,7 +1015,7 @@ def _get_measurement_data(self, dev_id: str) -> DeviceData:
10111015 # Collect availability-status for wireless connected devices to Adam
10121016 self ._wireless_availablity (appliance , data )
10131017
1014- if dev_id == self .gateway_id and self .smile_name == ADAM :
1018+ if dev_id == self .gateway_id and self .smile ( ADAM ) :
10151019 self ._get_regulation_mode (appliance , data )
10161020
10171021 if "c_heating_state" in data :
@@ -1022,7 +1026,7 @@ def _get_measurement_data(self, dev_id: str) -> DeviceData:
10221026
10231027 if (
10241028 self ._is_thermostat
1025- and self .smile_name == ANNA
1029+ and self .smile ( ANNA )
10261030 and dev_id == self ._heater_id
10271031 ):
10281032 # Anna+Elga: base cooling_state on the elga-status-code
@@ -1142,7 +1146,7 @@ def _get_group_switches(self) -> dict[str, DeviceData]:
11421146 """
11431147 switch_groups : dict [str , DeviceData ] = {}
11441148 # P1 and Anna don't have switchgroups
1145- if self .smile_type == "power" or self .smile_name == ANNA :
1149+ if self .smile_type == "power" or self .smile ( ANNA ) :
11461150 return switch_groups
11471151
11481152 for group in self ._domain_objects .findall ("./group" ):
0 commit comments