FIX : vitesse 1ere récup info

This commit is contained in:
Raymond Bourges 2026-01-02 15:46:35 +01:00
parent c87352c540
commit 109424fc50
2 changed files with 5 additions and 4 deletions

View File

@ -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()

View File

@ -1 +0,0 @@
import webrepl_setup