Skip to content

Commit

Permalink
Typing relaxed to allow a return value of "None".
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Sep 5, 2017
1 parent ca10a8b commit e99be3b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions mirobo/fan.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
from .device import Device
from typing import Any, Dict
from typing import Any, Dict, Optional
import enum

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -42,22 +42,20 @@ def humidity(self) -> int:
return self.data["humidity"]

@property
def temperature(self) -> float:
def temperature(self) -> Optional[float]:
if self.data["temp_dec"] is not None:
return self.data["temp_dec"] / 10.0
else:
return None
return None

@property
def led(self) -> bool:
return self.data["led"] == "on"

@property
def led_brightness(self) -> LedBrightness:
def led_brightness(self) -> Optional[LedBrightness]:
if self.data["led_b"] is not None:
return LedBrightness(self.data["led_b"])
else:
return None
return None

@property
def buzzer(self) -> bool:
Expand Down

0 comments on commit e99be3b

Please sign in to comment.