1
mirror of https://github.com/home-assistant/core synced 2024-07-12 07:21:24 +02: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:
jan iversen 2021-08-25 13:37:08 +02:00 committed by GitHub
parent 6b4e3bca6f
commit 504d23ac72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 7 deletions

View File

@ -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:

View File

@ -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

View File

@ -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.*",