Teach site_location about the .local hostname suffix that the mac
[python_utils.git] / smart_home / device.py
index 02717a343f433414398425c7d16e4939414ecf2a..82f1fa6eb89943d03a4f348621767a857d944418 100644 (file)
@@ -1,5 +1,9 @@
 #!/usr/bin/env python3
 
+"""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 +11,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]],
+        keywords: Optional[str] = "",
     ):
         self.name = name
         self.mac = mac
         self.keywords = keywords
         self.arper = arper.Arper()
         if keywords is not None:
-            self.kws = keywords
+            self.kws: List[str] = keywords.split(' ')
         else:
             self.kws = []