mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Activate mypy for switchbot (#55196)
* Please mypy. * Update homeassistant/components/switchbot/switch.py Co-authored-by: Franck Nijhof <frenck@frenck.nl> Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
parent
6b4e3bca6f
commit
504d23ac72
@ -37,8 +37,8 @@ class SwitchBot(SwitchEntity, RestoreEntity):
|
||||
def __init__(self, mac, name, password) -> None:
|
||||
"""Initialize the Switchbot."""
|
||||
|
||||
self._state = None
|
||||
self._last_run_success = None
|
||||
self._state: bool | None = None
|
||||
self._last_run_success: bool | None = None
|
||||
self._name = name
|
||||
self._mac = mac
|
||||
self._device = switchbot.Switchbot(mac=mac, password=password)
|
||||
@ -75,7 +75,7 @@ class SwitchBot(SwitchEntity, RestoreEntity):
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return true if device is on."""
|
||||
return self._state
|
||||
return bool(self._state)
|
||||
|
||||
@property
|
||||
def unique_id(self) -> str:
|
||||
|
3
mypy.ini
3
mypy.ini
@ -1609,9 +1609,6 @@ ignore_errors = true
|
||||
[mypy-homeassistant.components.stt.*]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.switchbot.*]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.system_health.*]
|
||||
ignore_errors = true
|
||||
|
||||
|
@ -125,7 +125,6 @@ IGNORED_MODULES: Final[list[str]] = [
|
||||
"homeassistant.components.sonos.*",
|
||||
"homeassistant.components.spotify.*",
|
||||
"homeassistant.components.stt.*",
|
||||
"homeassistant.components.switchbot.*",
|
||||
"homeassistant.components.system_health.*",
|
||||
"homeassistant.components.system_log.*",
|
||||
"homeassistant.components.tado.*",
|
||||
|
Loading…
x
Reference in New Issue
Block a user