diff --git a/main.py b/main.py index 71541f3..e03c6f9 100644 --- a/main.py +++ b/main.py @@ -79,17 +79,19 @@ class Cloud: def net_up(self): if not self.wifi.isconnected(): + print("Connexion au WIFI...") self.wifi.active(True) self.wifi.connect("Livebox-BDC6", "KFQSn7PDCMSgPpM2Ws") while not self.wifi.isconnected(): print(".") + time.sleep(0.2) def zoe(self) -> int: try: + self.net_up() self.maintenant = time.ticks_ms() - if time.ticks_diff(self.maintenant, self.dernier_appel_zoe) > self.ttl: + if self.derniere_val_zoe == 0 or time.ticks_diff(self.maintenant, self.dernier_appel_zoe) > self.ttl: self.dernier_appel_zoe = self.maintenant - self.net_up() debug("appel sensor.zoe_batterie") response = urequests.get("https://ha-demo.arbi.fr/api/states/sensor.zoe_batterie", headers=self.headers) data = response.json() @@ -102,10 +104,10 @@ class Cloud: def HC(self) -> bool: try: + self.net_up() self.maintenant = time.ticks_ms() if time.ticks_diff(self.maintenant, self.dernier_appel_HC) > self.ttl: self.dernier_appel_HC = self.maintenant - self.net_up() debug("appel sensor.compteur_linky_ptec") response = urequests.get("https://ha-demo.arbi.fr/api/states/sensor.compteur_linky_ptec", headers=self.headers) data = response.json() diff --git a/utils/webrepl_setup.py b/utils/webrepl_setup.py deleted file mode 100644 index d5e6dfc..0000000 --- a/utils/webrepl_setup.py +++ /dev/null @@ -1 +0,0 @@ -import webrepl_setup \ No newline at end of file