Skip to content

Commit

Permalink
add device_and_unit_id
Browse files Browse the repository at this point in the history
  • Loading branch information
mib1185 committed Jan 14, 2024
1 parent c7e722f commit ee65fb6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pyfritzhome/devicetypes/fritzhomeentitybase.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ def _update_from_node(self, node):
if self._has_feature(feature):
self.supported_features.append(feature)

@property
def device_and_unit_id(self):
"""Get the device and possible unit id."""
if self.ain.startswith("tmp") or self.ain.startswith("grp"):
return (self.ain, None)
elif self.ain.startswith("Z") and len(self.ain) == 19:
return (self.ain[0:17], self.ain[17:])
elif "-" in self.ain:
return tuple(self.ain.split("-"))
return (self.ain, None)

# XML Helpers

def get_node_value(self, elem, node):
Expand Down

0 comments on commit ee65fb6

Please sign in to comment.