diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2023-01-17 18:02:43 +0100 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2023-01-17 18:04:36 +0100 |
commit | b833cd7f981e96e2d89ef3cb0841e45d7147b01d (patch) | |
tree | 729d8e4da0a1f20f70e7b89cee04b312df641894 | |
parent | b474c41d944b7ad02233d744509c5d2390c92553 (diff) | |
download | ShellyPy-b833cd7f981e96e2d89ef3cb0841e45d7147b01d.tar.gz ShellyPy-b833cd7f981e96e2d89ef3cb0841e45d7147b01d.zip |
detect all meters the device has
-rw-r--r-- | ShellyPy/gen1.py | 14 |
1 files 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): """ |