projects
/
python_utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Minor cleanup.
[python_utils.git]
/
smart_home
/
device.py
diff --git
a/smart_home/device.py
b/smart_home/device.py
index 04b0bfee8abee690ab857692b15e928abf3bae03..9675b7c66ed26527d6c389854a8cf488a012f530 100644
(file)
--- 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_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)
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
def get_keywords(self) -> Optional[List[str]]:
return self.kws