"""Utilities for dealing with the webcams."""
import logging
+from typing import Optional
import scott_secrets
import smart_home.device as dev
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: