summaryrefslogtreecommitdiff
path: root/smart_home/device.py
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2021-10-31 13:08:51 -0700
committerScott Gasch <[email protected]>2021-10-31 13:08:51 -0700
commiteb9e6df32ed696158bf34dba6464277b648f5c74 (patch)
tree54ae278562008b0ffa834b2d34b2158d9119dc65 /smart_home/device.py
parent05a26ae305adfc47f38b8534ec8f35640df3955e (diff)
Ugh, a bunch of things. @overrides. --lmodule. Chromecasts. etc...
Diffstat (limited to 'smart_home/device.py')
-rw-r--r--smart_home/device.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/smart_home/device.py b/smart_home/device.py
index 04b0bfe..9675b7c 100644
--- a/smart_home/device.py
+++ b/smart_home/device.py
@@ -28,9 +28,20 @@ class Device(object):
def get_mac(self) -> str:
return self.mac
- def get_ip(self) -> str:
+ def get_ip(self) -> Optional[str]:
return self.arper.get_ip_by_mac(self.mac)
+ def has_static_ip(self) -> bool:
+ for kw in self.kws:
+ m = re.search(r'static:([\d\.]+)', kw)
+ if m is not None:
+ ip = m.group(1)
+ assert self.get_ip() == ip
+ return True
+ return False
+
+ # Add command -> URL logic here.
+
def get_keywords(self) -> Optional[List[str]]:
return self.kws