X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=smart_home%2Fdevice.py;h=82f1fa6eb89943d03a4f348621767a857d944418;hb=7627b3efb55f489f92fb718394b5651a137974f5;hp=02717a343f433414398425c7d16e4939414ecf2a;hpb=6ba90a1f30f1c0cf4df12fcd0c62181f29bc3668;p=python_utils.git diff --git a/smart_home/device.py b/smart_home/device.py index 02717a3..82f1fa6 100644 --- a/smart_home/device.py +++ b/smart_home/device.py @@ -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 = []