Skip to content

Commit ee65fb6

Browse files
committed
add device_and_unit_id
1 parent c7e722f commit ee65fb6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pyfritzhome/devicetypes/fritzhomeentitybase.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ def _update_from_node(self, node):
4949
if self._has_feature(feature):
5050
self.supported_features.append(feature)
5151

52+
@property
53+
def device_and_unit_id(self):
54+
"""Get the device and possible unit id."""
55+
if self.ain.startswith("tmp") or self.ain.startswith("grp"):
56+
return (self.ain, None)
57+
elif self.ain.startswith("Z") and len(self.ain) == 19:
58+
return (self.ain[0:17], self.ain[17:])
59+
elif "-" in self.ain:
60+
return tuple(self.ain.split("-"))
61+
return (self.ain, None)
62+
5263
# XML Helpers
5364

5465
def get_node_value(self, elem, node):

0 commit comments

Comments
 (0)