@@ -75,6 +75,7 @@ def __init__(
7575 self ._stretch_v2 = False
7676 self ._target_smile : str = NONE
7777 self .smile : Munch = Munch ()
78+ self .smile .anna_p1 = False
7879 self .smile .hostname = NONE
7980 self .smile .hw_version = None
8081 self .smile .legacy = False
@@ -189,13 +190,23 @@ async def _smile_detect(
189190 """
190191 model : str = "Unknown"
191192 if (gateway := result .find ("./gateway" )) is not None :
192- if (v_model := gateway .find ("vendor_model" )) is not None :
193- model = v_model .text
194193 self .smile .version = parse (gateway .find ("firmware_version" ).text )
195194 self .smile .hw_version = gateway .find ("hardware_version" ).text
196195 self .smile .hostname = gateway .find ("hostname" ).text
197196 self .smile .mac_address = gateway .find ("mac_address" ).text
198- self .smile .model_id = gateway .find ("vendor_model" ).text
197+ if (vendor_model := gateway .find ("vendor_model" )) is None :
198+ return # pragma: no cover
199+
200+ model = vendor_model .text
201+ elec_measurement = gateway .find (
202+ "gateway_environment/electricity_consumption_tariff_structure"
203+ )
204+ if (
205+ elec_measurement is not None
206+ and elec_measurement .text
207+ and model == "smile_thermo"
208+ ):
209+ self .smile .anna_p1 = True
199210 else :
200211 model = await self ._smile_detect_legacy (result , dsmrmain , model )
201212
@@ -231,29 +242,38 @@ async def _smile_detect(
231242 raise UnsupportedDeviceError # pragma: no cover
232243
233244 self .smile .model = "Gateway"
245+ self .smile .model_id = model
234246 self .smile .name = SMILES [self ._target_smile ].smile_name
235247 self .smile .type = SMILES [self ._target_smile ].smile_type
248+ if self .smile .name == "Smile Anna" and self .smile .anna_p1 :
249+ self .smile .name = "Smile Anna P1"
236250
237251 if self .smile .type == "stretch" :
238252 self ._stretch_v2 = int (version_major ) == 2
239253
240- if self .smile .type == "thermostat" :
241- self ._is_thermostat = True
242- # For Adam, Anna, determine the system capabilities:
243- # Find the connected heating/cooling device (heater_central),
244- # e.g. heat-pump or gas-fired heater
245- onoff_boiler = result .find ("./module/protocols/onoff_boiler" )
246- open_therm_boiler = result .find ("./module/protocols/open_therm_boiler" )
247- self ._on_off_device = onoff_boiler is not None
248- self ._opentherm_device = open_therm_boiler is not None
249-
250- # Determine the presence of special features
251- locator_1 = "./gateway/features/cooling"
252- locator_2 = "./gateway/features/elga_support"
253- if result .find (locator_1 ) is not None :
254- self ._cooling_present = True
255- if result .find (locator_2 ) is not None :
256- self ._elga = True
254+ self ._process_for_thermostat (result )
255+
256+ def _process_for_thermostat (self , result : etree .Element ) -> None :
257+ """Extra processing for thermostats."""
258+ if self .smile .type != "thermostat" :
259+ return
260+
261+ self ._is_thermostat = True
262+ # For Adam, Anna, determine the system capabilities:
263+ # Find the connected heating/cooling device (heater_central),
264+ # e.g. heat-pump or gas-fired heater
265+ onoff_boiler = result .find ("./module/protocols/onoff_boiler" )
266+ open_therm_boiler = result .find ("./module/protocols/open_therm_boiler" )
267+ self ._on_off_device = onoff_boiler is not None
268+ self ._opentherm_device = open_therm_boiler is not None
269+
270+ # Determine the presence of special features
271+ locator_1 = "./gateway/features/cooling"
272+ locator_2 = "./gateway/features/elga_support"
273+ if result .find (locator_1 ) is not None :
274+ self ._cooling_present = True
275+ if result .find (locator_2 ) is not None :
276+ self ._elga = True
257277
258278 async def _smile_detect_legacy (
259279 self , result : etree .Element , dsmrmain : etree .Element , model : str
0 commit comments