@@ -85,7 +85,7 @@ def get_all_devices(self) -> None:
8585 self .single_master_thermostat ()
8686
8787 for appliance , details in self ._appl_data .items ():
88- loc_id : str | None = details ["location" ]
88+ loc_id = details ["location" ]
8989 # Don't assign the _home_location to thermostat-devices without a location, they are not active
9090 if loc_id is None and details ["class" ] not in THERMOSTAT_CLASSES :
9191 details ["location" ] = self ._home_location
@@ -146,7 +146,7 @@ def _device_data_climate(self, details, device_data) -> dict[str, Any]:
146146 # Presets
147147 device_data ["preset_modes" ] = None
148148 device_data ["active_preset" ] = None
149- presets : dict [ str , Any ] = self ._presets (loc_id )
149+ presets = self ._presets (loc_id )
150150 if presets :
151151 device_data ["presets" ] = presets
152152 device_data ["preset_modes" ] = list (presets )
@@ -183,7 +183,7 @@ def _get_device_data(self, dev_id) -> dict[str, Any]:
183183 """Helper-function for _all_device_data() and async_update().
184184 Provide device-data, based on Location ID (= dev_id), from APPLIANCES.
185185 """
186- details : dict [ str , Any ] = self ._devices .get (dev_id )
186+ details = self ._devices .get (dev_id )
187187 device_data = self ._get_appliance_data (dev_id )
188188
189189 # Generic
@@ -268,8 +268,8 @@ async def connect(self) -> bool:
268268 """Connect to Plugwise device and determine its name, type and version."""
269269 names : list [str ] = []
270270
271- result : etree = await self ._request (DOMAIN_OBJECTS )
272- dsmrmain : etree | None = result .find (".//module/protocols/dsmrmain" )
271+ result = await self ._request (DOMAIN_OBJECTS )
272+ dsmrmain = result .find (".//module/protocols/dsmrmain" )
273273
274274 vendor_names : list [etree ] = result .findall (".//module/vendor_name" )
275275 if not vendor_names :
@@ -300,12 +300,12 @@ async def connect(self) -> bool:
300300
301301 async def _smile_detect_legacy (self , result , dsmrmain ) -> tuple [str , str ]:
302302 """Helper-function for _smile_detect()."""
303- network : etree | None = result .find (".//module/protocols/master_controller" )
303+ network = result .find (".//module/protocols/master_controller" )
304304
305305 # Assume legacy
306306 self ._smile_legacy = True
307307 # Try if it is an Anna, assuming appliance thermostat
308- anna : etree | None = result .find ('.//appliance[type="thermostat"]' )
308+ anna = result .find ('.//appliance[type="thermostat"]' )
309309 # Fake insert version assuming Anna
310310 # couldn't find another way to identify as legacy Anna
311311 version = "1.8.0"
@@ -314,7 +314,7 @@ async def _smile_detect_legacy(self, result, dsmrmain) -> tuple[str, str]:
314314 # P1 legacy:
315315 if dsmrmain is not None :
316316 try :
317- status : etree = await self ._request (STATUS )
317+ status = await self ._request (STATUS )
318318 version = status .find (".//system/version" ).text
319319 model = status .find (".//system/product" ).text
320320 self .smile_hostname = status .find (".//network/hostname" ).text
@@ -325,7 +325,7 @@ async def _smile_detect_legacy(self, result, dsmrmain) -> tuple[str, str]:
325325 # Stretch:
326326 elif network is not None :
327327 try :
328- system : etree = await self ._request (SYSTEM )
328+ system = await self ._request (SYSTEM )
329329 version = system .find (".//gateway/firmware" ).text
330330 model = system .find (".//gateway/product" ).text
331331 self .smile_hostname = system .find (".//gateway/hostname" ).text
@@ -345,10 +345,10 @@ async def _smile_detect(self, result, dsmrmain) -> None:
345345 """Helper-function for connect().
346346 Detect which type of Smile is connected.
347347 """
348- model : str = None
348+ model : str | None = None
349349 if (gateway := result .find (".//gateway" )) is not None :
350350 model = result .find (".//gateway/vendor_model" ).text
351- version : str = result .find (".//gateway/firmware_version" ).text
351+ version = result .find (".//gateway/firmware_version" ).text
352352 if gateway .find ("hostname" ) is not None :
353353 self .smile_hostname = gateway .find ("hostname" ).text
354354 else :
@@ -362,8 +362,8 @@ async def _smile_detect(self, result, dsmrmain) -> None:
362362 )
363363 raise UnsupportedDeviceError
364364
365- ver : semver = semver .VersionInfo .parse (version )
366- target_smile : str = f"{ model } _v{ ver .major } "
365+ ver = semver .VersionInfo .parse (version )
366+ target_smile = f"{ model } _v{ ver .major } "
367367 LOGGER .debug ("Plugwise identified as %s" , target_smile )
368368 if target_smile not in SMILES :
369369 LOGGER .error (
@@ -473,7 +473,6 @@ async def _set_schedule_state_legacy(self, name: str, status: str) -> bool:
473473 if schema_rule_id is None :
474474 return False
475475
476- template_id : str = None
477476 state : str = "false"
478477 if status == "on" :
479478 state = "true"
0 commit comments