summaryrefslogtreecommitdiff
path: root/smart_home
diff options
context:
space:
mode:
authorScott <[email protected]>2022-02-02 13:47:36 -0800
committerScott <[email protected]>2022-02-02 13:47:36 -0800
commit7ff2af6fe7bffea90dc4a31c93140c189917c659 (patch)
tree34cb138c3a572037b5bc1d1b52ad9d25a2604ccb /smart_home
parent6ba90a1f30f1c0cf4df12fcd0c62181f29bc3668 (diff)
Let's be explicit with asserts; there was a bug in histogram
caused by assert foo when foo was an int with valid valid 0.
Diffstat (limited to 'smart_home')
-rw-r--r--smart_home/cameras.py2
-rw-r--r--smart_home/chromecasts.py2
-rw-r--r--smart_home/outlets.py10
3 files changed, 7 insertions, 7 deletions
diff --git a/smart_home/cameras.py b/smart_home/cameras.py
index 2cf2de4..712d73f 100644
--- a/smart_home/cameras.py
+++ b/smart_home/cameras.py
@@ -28,6 +28,6 @@ class BaseCamera(dev.Device):
name = self.camera_name
assert name is not None
if name == 'driveway':
- return f'http://10.0.0.226:8080/Umtxxf1uKMBniFblqeQ9KRbb6DDzN4/mjpeg/GKlT2FfiSQ/driveway'
+ return 'http://10.0.0.226:8080/Umtxxf1uKMBniFblqeQ9KRbb6DDzN4/mjpeg/GKlT2FfiSQ/driveway'
else:
return f'http://10.0.0.226:8080/Umtxxf1uKMBniFblqeQ9KRbb6DDzN4/mp4/GKlT2FfiSQ/{name}/s.mp4'
diff --git a/smart_home/chromecasts.py b/smart_home/chromecasts.py
index bd2a80c..bec8461 100644
--- a/smart_home/chromecasts.py
+++ b/smart_home/chromecasts.py
@@ -38,7 +38,7 @@ class BaseChromecast(dev.Device):
BaseChromecast.ccasts,
BaseChromecast.browser,
) = pychromecast.get_chromecasts(timeout=15.0)
- assert BaseChromecast.browser
+ assert BaseChromecast.browser is not None
atexit.register(BaseChromecast.browser.stop_discovery)
BaseChromecast.refresh_ts = now
diff --git a/smart_home/outlets.py b/smart_home/outlets.py
index d4a4886..d29fc4a 100644
--- a/smart_home/outlets.py
+++ b/smart_home/outlets.py
@@ -307,23 +307,23 @@ class MerossOutlet(BaseOutlet):
@overrides
def turn_on(self) -> bool:
self.lazy_initialize_device()
- assert self.meross_wrapper
- assert self.device
+ assert self.meross_wrapper is not None
+ assert self.device is not None
self.meross_wrapper.loop.run_until_complete(self.device.async_turn_on())
return True
@overrides
def turn_off(self) -> bool:
self.lazy_initialize_device()
- assert self.meross_wrapper
- assert self.device
+ assert self.meross_wrapper is not None
+ assert self.device is not None
self.meross_wrapper.loop.run_until_complete(self.device.async_turn_off())
return True
@overrides
def is_on(self) -> bool:
self.lazy_initialize_device()
- assert self.device
+ assert self.device is not None
return self.device.is_on()
@overrides