Since this thing is on the innerwebs I suppose it should have a
[python_utils.git] / smart_home / device.py
index 9675b7c66ed26527d6c389854a8cf488a012f530..64302ad791b35131e597472547e81027c6ec4451 100644 (file)
@@ -1,5 +1,13 @@
 #!/usr/bin/env python3
 
+# © Copyright 2021-2022, Scott Gasch
+
+"""Most basic definition of a smart device: it must have a name and a
+MAC address and may have some optional keywords.  All devices have
+these whether they are lights, outlets, thermostats, etc...
+
+"""
+
 import re
 from typing import List, Optional
 
@@ -7,18 +15,22 @@ import arper
 
 
 class Device(object):
+    """Most basic definition of a smart device: it must have a name and a
+    MAC address and may have some optional keywords.  All devices have
+    these whether they are lights, outlets, thermostats, etc..."""
+
     def __init__(
-            self,
-            name: str,
-            mac: str,
-            keywords: Optional[List[str]],
+        self,
+        name: str,
+        mac: str,
+        keywords: Optional[str] = "",
     ):
         self.name = name
         self.mac = mac
         self.keywords = keywords
         self.arper = arper.Arper()
         if keywords is not None:
-            self.kws = keywords.split()
+            self.kws: List[str] = keywords.split(' ')
         else:
             self.kws = []