3 """Utilities for dealing with the webcams."""
5 from abc import abstractmethod
13 from typing import Any, Dict, List, Optional, Set
18 import smart_home.device as dev
19 from google_assistant import ask_google, GoogleResponse
20 from decorator_utils import timeout, memoized
22 logger = logging.getLogger(__name__)
24 class BaseCamera(dev.Device):
26 'cabin_drivewaycam': 'cabin_driveway',
27 'outside_backyard_camera': 'backyard',
28 'outside_driveway_camera': 'driveway',
29 'outside_doorbell_camera': 'doorbell',
30 'outside_front_door_camera': 'frontdoor',
33 def __init__(self, name: str, mac: str, keywords: str = "") -> None:
34 super().__init__(name.strip(), mac.strip(), keywords)
35 self.camera_name = BaseCamera.camera_mapping.get(name, None)
37 def get_stream_url(self) -> str:
38 assert self.camera_name is not None
39 return f'http://10.0.0.56:81/mjpg/{self.camera_name}/video.mjpg?h=1024&q=99'