summaryrefslogtreecommitdiff
path: root/smart_home/cameras.py
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2022-04-30 10:59:48 -0700
committerScott Gasch <[email protected]>2022-04-30 10:59:48 -0700
commitf2901184ccb5415cf40b3ec61c128a6a59ab3aa7 (patch)
treef9c29997f888de27fe129728b65c854b8454de89 /smart_home/cameras.py
parent6fd34b009eec9cda18f1bdd9d8184b7a317a156d (diff)
Add some docs and doctests to things that have 0% coverage.
Diffstat (limited to 'smart_home/cameras.py')
-rw-r--r--smart_home/cameras.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/smart_home/cameras.py b/smart_home/cameras.py
index 8643611..e8f164b 100644
--- a/smart_home/cameras.py
+++ b/smart_home/cameras.py
@@ -5,6 +5,7 @@
"""Utilities for dealing with the webcams."""
import logging
+from typing import Optional
import scott_secrets
import smart_home.device as dev
@@ -29,9 +30,12 @@ class BaseCamera(dev.Device):
super().__init__(name.strip(), mac.strip(), keywords)
self.camera_name = BaseCamera.camera_mapping.get(name, None)
- def get_stream_url(self) -> str:
+ def get_stream_url(self) -> Optional[str]:
+ """Get the URL for the webcam's live stream. Return None on error."""
+
name = self.camera_name
- assert name is not None
+ if not name:
+ return None
if name == 'driveway':
return f'http://10.0.0.226:8080/{scott_secrets.SHINOBI_KEY1}/mjpeg/{scott_secrets.SHINOBI_KEY2}/driveway'
else: