From b833cd7f981e96e2d89ef3cb0841e45d7147b01d Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Tue, 17 Jan 2023 18:02:43 +0100 Subject: detect all meters the device has --- ShellyPy/gen1.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ShellyPy/gen1.py b/ShellyPy/gen1.py index 13e9c2d..e3df549 100644 --- a/ShellyPy/gen1.py +++ b/ShellyPy/gen1.py @@ -27,7 +27,7 @@ class ShellyGen1(ShellyBase): super().__init__(ip, port, *args, **kwargs) self.__generation__ = 1 - def update(self, index = 0): + def update(self): """ @brief update the Shelly attributes @@ -48,8 +48,16 @@ class ShellyGen1(ShellyBase): self.emeters = status.get("emeter", []) - # Request meter information - self.meter = self.meter(index) + self.meters = [] + meter_index = 0 + # Meters are not returned as part of the settings + while True: + try: + # Request meter information + self.meter.append(self.meter(meter_index)) + meter_index += 1 + except: + break def post(self, page, values = None): """ -- cgit v1.2.3