Skip to content

Commit 95b887d

Browse files
committed
Fix mypy error
1 parent 0b1edce commit 95b887d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

plugwise/__init__.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,9 @@ async def connect(self) -> bool:
380380

381381
return True
382382

383-
async def _smile_detect_legacy(self, result: etree, dsmrmain: etree) -> str:
383+
async def _smile_detect_legacy(
384+
self, result: etree, dsmrmain: etree, model: str
385+
) -> str:
384386
"""Helper-function for _smile_detect()."""
385387
# Stretch: find the MAC of the zigbee master_controller (= Stick)
386388
if network := result.find("./module/protocols/master_controller"):
@@ -431,17 +433,18 @@ async def _smile_detect(self, result: etree, dsmrmain: etree) -> None:
431433
432434
Detect which type of Smile is connected.
433435
"""
434-
model: str | None = None
436+
model: str = "Unknown"
435437
if (gateway := result.find("./gateway")) is not None:
436-
model = gateway.find("vendor_model").text
438+
if (v_model := gateway.find("vendor_model")) is not None:
439+
model = v_model.text
437440
self.smile_fw_version = gateway.find("firmware_version").text
438441
self.smile_hw_version = gateway.find("hardware_version").text
439442
self.smile_hostname = gateway.find("hostname").text
440443
self.smile_mac_address = gateway.find("mac_address").text
441444
else:
442-
model = await self._smile_detect_legacy(result, dsmrmain)
445+
model = await self._smile_detect_legacy(result, dsmrmain, model)
443446

444-
if model is None or self.smile_fw_version is None: # pragma: no cover
447+
if model == "Unknown" or self.smile_fw_version is None: # pragma: no cover
445448
# Corner case check
446449
LOGGER.error(
447450
"Unable to find model or version information, please create \

0 commit comments

Comments
 (0)