40a7b70ed3d357797fa979bd1d0f8554abc0d789
[python_utils.git] / smart_home / device_utils.py
1 #!/usr/bin/env python3
2
3 """General utility functions involving smart home devices."""
4
5 import logging
6 from typing import Any
7
8 from smart_home import cameras, chromecasts, lights, outlets
9
10 logger = logging.getLogger(__name__)
11
12
13 def is_camera(device: Any) -> bool:
14     return isinstance(device, cameras.BaseCamera)
15
16
17 def is_chromecast(device: Any) -> bool:
18     return isinstance(device, chromecasts.BaseChromecast)
19
20
21 def is_light(device: Any) -> bool:
22     return isinstance(device, lights.BaseLight)
23
24
25 def is_outlet(device: Any) -> bool:
26     return isinstance(device, outlets.BaseOutlet)