mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-06 10:44:04 +00:00
Do not error when accessing smart device_type before update (#1319)
This commit is contained in:
@@ -765,10 +765,11 @@ class SmartDevice(Device):
|
||||
if self._device_type is not DeviceType.Unknown:
|
||||
return self._device_type
|
||||
|
||||
# Fallback to device_type (from disco info)
|
||||
type_str = self._info.get("type", self._info.get("device_type"))
|
||||
|
||||
if not type_str: # no update or discovery info
|
||||
if (
|
||||
not (type_str := self._info.get("type", self._info.get("device_type")))
|
||||
or not self._components
|
||||
):
|
||||
# no update or discovery info
|
||||
return self._device_type
|
||||
|
||||
self._device_type = self._get_device_type_from_components(
|
||||
|
Reference in New Issue
Block a user