Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix if not all sensors are available #70

Merged
merged 1 commit into from
Oct 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions mytoyota/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Hood:
warning: bool = False
closed: bool = True

def __init__(self, hood):
def __init__(self, hood: dict) -> None:
self.warning = hood.get(WARNING, None)
self.closed = hood.get(CLOSED, None)

Expand All @@ -31,7 +31,7 @@ class Door:
closed: bool = True
locked: bool = True

def __init__(self, door) -> None:
def __init__(self, door: dict) -> None:
self.warning = door.get(WARNING, None)
self.closed = door.get(CLOSED, None)
self.locked = door.get(LOCKED, None)
Expand Down Expand Up @@ -61,11 +61,11 @@ class Doors:
def __init__(self, doors: dict):
self.warning = doors[WARNING]

self.driverseat = Door(doors.get("driverSeatDoor", None))
self.passengerseat = Door(doors.get("passengerSeatDoor", None))
self.rightrearseat = Door(doors.get("rearRightSeatDoor", None))
self.leftrearseat = Door(doors.get("rearLeftSeatDoor", None))
self.trunk = Door(doors.get("backDoor", None))
self.driverseat = Door(doors.get("driverSeatDoor", {}))
self.passengerseat = Door(doors.get("passengerSeatDoor", {}))
self.rightrearseat = Door(doors.get("rearRightSeatDoor", {}))
self.leftrearseat = Door(doors.get("rearLeftSeatDoor", {}))
self.trunk = Door(doors.get("backDoor", {}))

def __str__(self) -> str:
return str(self.as_dict())
Expand Down Expand Up @@ -113,13 +113,13 @@ class Windows:

warning: bool = False

def __init__(self, windows):
def __init__(self, windows: dict) -> None:
self.warning = windows[WARNING]

self.driverseat = Window(windows.get("driverSeatWindow", None))
self.passengerseat = Window(windows.get("passengerSeatWindow", None))
self.rightrearseat = Window(windows.get("rearRightSeatWindow", None))
self.leftrearseat = Window(windows.get("rearLeftSeatWindow", None))
self.driverseat = Window(windows.get("driverSeatWindow", {}))
self.passengerseat = Window(windows.get("passengerSeatWindow", {}))
self.rightrearseat = Window(windows.get("rearRightSeatWindow", {}))
self.leftrearseat = Window(windows.get("rearLeftSeatWindow", {}))

def __str__(self) -> str:
return str(self.as_dict())
Expand All @@ -141,7 +141,7 @@ class Light:
warning: bool = False
off: bool = True

def __init__(self, light):
def __init__(self, light: dict) -> None:
self.warning = light.get(WARNING, None)
self.off = light.get(OFF, None)

Expand All @@ -164,12 +164,12 @@ class Lights:
hazard: Light
warning: bool = False

def __init__(self, lights):
def __init__(self, lights: dict) -> None:
self.warning = lights.get(WARNING, None)

self.front = Light(lights.get("headLamp", None))
self.back = Light(lights.get("tailLamp", None))
self.hazard = Light(lights.get("hazardLamp", None))
self.front = Light(lights.get("headLamp", {}))
self.back = Light(lights.get("tailLamp", {}))
self.hazard = Light(lights.get("hazardLamp", {}))

def __str__(self) -> str:
return str(self.as_dict())
Expand All @@ -190,7 +190,7 @@ class Key:
warning: bool = False
in_car: bool = False

def __init__(self, key):
def __init__(self, key: dict) -> None:
self.warning = key.get(WARNING, None)
self.in_car = key.get(INCAR, None)

Expand Down