projects
/
python_utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix Arper, make IP address a property of device
[python_utils.git]
/
smart_home
/
device.py
diff --git
a/smart_home/device.py
b/smart_home/device.py
index 27860c5bbcc75bdbb97defabf820f0a601a9e0f6..04b0bfee8abee690ab857692b15e928abf3bae03 100644
(file)
--- a/
smart_home/device.py
+++ b/
smart_home/device.py
@@
-1,7
+1,10
@@
#!/usr/bin/env python3
import re
#!/usr/bin/env python3
import re
-from typing import Any, List, Optional, Tuple
+from typing import List, Optional
+
+import arper
+
class Device(object):
def __init__(
class Device(object):
def __init__(
@@
-13,6
+16,7
@@
class Device(object):
self.name = name
self.mac = mac
self.keywords = keywords
self.name = name
self.mac = mac
self.keywords = keywords
+ self.arper = arper.Arper()
if keywords is not None:
self.kws = keywords.split()
else:
if keywords is not None:
self.kws = keywords.split()
else:
@@
-24,6
+28,9
@@
class Device(object):
def get_mac(self) -> str:
return self.mac
def get_mac(self) -> str:
return self.mac
+ def get_ip(self) -> str:
+ return self.arper.get_ip_by_mac(self.mac)
+
def get_keywords(self) -> Optional[List[str]]:
return self.kws
def get_keywords(self) -> Optional[List[str]]:
return self.kws