File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 44import logging
55from collections .abc import Callable
66from functools import lru_cache
7- from typing import TypedDict
7+ from typing import Any , TypedDict
88
99from bleak .backends .device import BLEDevice
1010from bleak .backends .scanner import AdvertisementData
@@ -189,7 +189,7 @@ def _parse_data(
189189 _mfr_data : bytes | None ,
190190 _mfr_id : int | None = None ,
191191 _switchbot_model : SwitchbotModel | None = None ,
192- ) -> SwitchBotAdvertisement | None :
192+ ) -> dict [ str , Any ] | None :
193193 """Parse advertisement data."""
194194 _model = chr (_service_data [0 ] & 0b01111111 ) if _service_data else None
195195
Original file line number Diff line number Diff line change @@ -482,7 +482,11 @@ def _check_command_result(
482482
483483 def _set_advertisement_data (self , advertisement : SwitchBotAdvertisement ) -> None :
484484 """Set advertisement data."""
485- if advertisement .data .get ("data" ) or not self ._sb_adv_data .data .get ("data" ):
485+ if (
486+ advertisement .data .get ("data" )
487+ or not self ._sb_adv_data
488+ or not self ._sb_adv_data .data .get ("data" )
489+ ):
486490 self ._sb_adv_data = advertisement
487491 self ._override_adv_data = None
488492
You can’t perform that action at this time.
0 commit comments