From 804747c3703d93f73e54b3b7a166d28bfd6efd49 Mon Sep 17 00:00:00 2001 From: Hans Erik van Elburg Date: Sun, 3 Jan 2021 19:58:19 +0100 Subject: [PATCH] add value and unit properties to ProfileGenericObject to make sure that code like iterators that rely on that do not break --- dsmr_parser/objects.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dsmr_parser/objects.py b/dsmr_parser/objects.py index 4cd987d..dcadfce 100644 --- a/dsmr_parser/objects.py +++ b/dsmr_parser/objects.py @@ -155,6 +155,16 @@ class ProfileGenericObject(DSMRObject): super().__init__(values) self._buffer_list = None + @property + def value(self): + # value is added to make sure the telegram iterator does not break + return self.__str__() + + @property + def unit(self): + # value is added to make sure all items have a unit so code that relies on that does not break + return None + @property def buffer_length(self): return self.values[0]['value']