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