Skip to content

Commit

Permalink
style: add typing hints to sentry mode
Browse files Browse the repository at this point in the history
  • Loading branch information
alandtse committed Jul 31, 2020
1 parent 8250fca commit 1942205
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions teslajsonpy/homeassistant/sentry_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
https://github.com/zabuldon/teslajsonpy
"""
import time
from typing import Optional

from teslajsonpy.homeassistant.vehicle import VehicleDevice

Expand Down Expand Up @@ -61,21 +62,22 @@ def refresh(self) -> None:
else:
self.__sentry_mode = False

def available(self):
def available(self) -> bool:
"""Return whether the sentry mode is available."""
return self.sentry_mode_available

def is_on(self) -> Optional[bool]:
"""Return whether the sentry mode is enabled, or None if sentry mode is not available."""
if not self.sentry_mode_available:
return None
return self.sentry_mode_available and self.__sentry_mode

@staticmethod
def has_battery():
def has_battery() -> bool:
"""Return whether the device has a battery."""
return False

async def enable_sentry_mode(self):
async def enable_sentry_mode(self) -> None:
"""Enable the sentry mode."""
if self.sentry_mode_available and not self.__sentry_mode:
data = await self._controller.command(
Expand All @@ -85,7 +87,7 @@ async def enable_sentry_mode(self):
self.__sentry_mode = True
self.__manual_update_time = time.time()

async def disable_sentry_mode(self):
async def disable_sentry_mode(self) -> None:
"""Disable the sentry mode."""
if self.sentry_mode_available and self.__sentry_mode:
data = await self._controller.command(
Expand Down

0 comments on commit 1942205

Please sign in to comment.