summaryrefslogtreecommitdiff
path: root/smart_home
diff options
context:
space:
mode:
Diffstat (limited to 'smart_home')
-rw-r--r--smart_home/lights.py12
-rw-r--r--smart_home/outlets.py12
-rw-r--r--smart_home/thermometers.py8
3 files changed, 9 insertions, 23 deletions
diff --git a/smart_home/lights.py b/smart_home/lights.py
index 240e7da..80bfffa 100644
--- a/smart_home/lights.py
+++ b/smart_home/lights.py
@@ -124,15 +124,11 @@ class GoogleLight(BaseLight):
@overrides
def turn_on(self) -> bool:
- return GoogleLight.parse_google_response(
- ask_google(f"turn {self.goog_name()} on")
- )
+ return GoogleLight.parse_google_response(ask_google(f"turn {self.goog_name()} on"))
@overrides
def turn_off(self) -> bool:
- return GoogleLight.parse_google_response(
- ask_google(f"turn {self.goog_name()} off")
- )
+ return GoogleLight.parse_google_response(ask_google(f"turn {self.goog_name()} off"))
@overrides
def status(self) -> str:
@@ -187,9 +183,7 @@ class GoogleLight(BaseLight):
@overrides
def make_color(self, color: str) -> bool:
- return GoogleLight.parse_google_response(
- ask_google(f"make {self.goog_name()} {color}")
- )
+ return GoogleLight.parse_google_response(ask_google(f"make {self.goog_name()} {color}"))
class TuyaLight(BaseLight):
diff --git a/smart_home/outlets.py b/smart_home/outlets.py
index d29fc4a..500ea05 100644
--- a/smart_home/outlets.py
+++ b/smart_home/outlets.py
@@ -221,15 +221,11 @@ class GoogleOutlet(BaseOutlet):
@overrides
def turn_on(self) -> bool:
- return GoogleOutlet.parse_google_response(
- ask_google(f'turn {self.goog_name()} on')
- )
+ return GoogleOutlet.parse_google_response(ask_google(f'turn {self.goog_name()} on'))
@overrides
def turn_off(self) -> bool:
- return GoogleOutlet.parse_google_response(
- ask_google(f'turn {self.goog_name()} off')
- )
+ return GoogleOutlet.parse_google_response(ask_google(f'turn {self.goog_name()} off'))
@overrides
def is_on(self) -> bool:
@@ -258,9 +254,7 @@ class MerossWrapper(object):
def __init__(self):
self.loop = asyncio.get_event_loop()
self.email = os.environ.get('MEROSS_EMAIL') or scott_secrets.MEROSS_EMAIL
- self.password = (
- os.environ.get('MEROSS_PASSWORD') or scott_secrets.MEROSS_PASSWORD
- )
+ self.password = os.environ.get('MEROSS_PASSWORD') or scott_secrets.MEROSS_PASSWORD
self.devices = self.loop.run_until_complete(self.find_meross_devices())
atexit.register(self.loop.close)
diff --git a/smart_home/thermometers.py b/smart_home/thermometers.py
index fe5eed1..dff84f6 100644
--- a/smart_home/thermometers.py
+++ b/smart_home/thermometers.py
@@ -1,8 +1,8 @@
#!/usr/bin/env python3
import logging
-from typing import Optional
import urllib.request
+from typing import Optional
logger = logging.getLogger()
@@ -21,9 +21,7 @@ class ThermometerRegistry(object):
'cabin_hottub': ('192.168.0.107', 'hottub_temp'),
}
- def read_temperature(
- self, location: str, *, convert_to_fahrenheit=False
- ) -> Optional[float]:
+ def read_temperature(self, location: str, *, convert_to_fahrenheit=False) -> Optional[float]:
record = self.thermometers.get(location, None)
if record is None:
logger.error(
@@ -37,7 +35,7 @@ class ThermometerRegistry(object):
temp = www.read().decode('utf-8')
temp = float(temp)
if convert_to_fahrenheit:
- temp *= (9/5)
+ temp *= 9 / 5
temp += 32.0
temp = round(temp)
except Exception as e: