summaryrefslogtreecommitdiff
path: root/smart_home
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2021-11-01 20:05:34 -0700
committerScott Gasch <[email protected]>2021-11-01 20:05:34 -0700
commite5da1fa6bab9ea6bf4394facbb29f13cdc3daf9a (patch)
tree67b7cdc67e9fbb656498513e29afc1b2a5af371d /smart_home
parentacacd9d2e942d084631e99e94ee430fd26ae9893 (diff)
Add device_utils.py
Diffstat (limited to 'smart_home')
-rw-r--r--smart_home/device_utils.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/smart_home/device_utils.py b/smart_home/device_utils.py
new file mode 100644
index 0000000..f79c734
--- /dev/null
+++ b/smart_home/device_utils.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python3
+
+import logging
+from typing import Any
+
+import smart_home.cameras as cameras
+import smart_home.chromecasts as chromecasts
+import smart_home.lights as lights
+import smart_home.outlets as outlets
+
+logger = logging.getLogger(__name__)
+
+
+def is_camera(device: Any) -> bool:
+ return isinstance(device, cameras.BaseCamera)
+
+
+def is_chromecast(device: Any) -> bool:
+ return isinstance(device, chromecasts.BaseChromecast)
+
+
+def is_light(device: Any) -> bool:
+ return isinstance(device, lights.BaseLight)
+
+
+def is_outlet(device: Any) -> bool:
+ return isinstance(device, outlets.BaseOutlet)