Skip to content

Commit 52afa72

Browse files
authored
Fix inheritance with smart plugs (#103)
1 parent 77c99d8 commit 52afa72

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

switchbot/devices/bot.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ async def get_basic_info(self) -> dict[str, Any] | None:
100100
"holdSeconds": _data[10],
101101
}
102102

103-
def switch_mode(self) -> bool | None:
104-
"""Return true or false from cache."""
105-
# To get actual position call update() first.
106-
return self._get_adv_value("switchMode")
107-
108103
def is_on(self) -> bool | None:
109104
"""Return switch state from cache."""
110105
# To get actual position call update() first.

switchbot/devices/device.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,11 @@ def _set_advertisement_data(self, advertisement: SwitchBotAdvertisement) -> None
441441
self._sb_adv_data = advertisement
442442
self._override_adv_data = None
443443

444+
def switch_mode(self) -> bool | None:
445+
"""Return true or false from cache."""
446+
# To get actual position call update() first.
447+
return self._get_adv_value("switchMode")
448+
444449

445450
class SwitchbotDevice(SwitchbotBaseDevice):
446451
"""Base Representation of a Switchbot Device.

0 commit comments

Comments
 (0)