FIX : vitesse 1ere récup info
This commit is contained in:
parent
c87352c540
commit
109424fc50
10
main.py
10
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.maintenant = time.ticks_ms()
|
||||
if time.ticks_diff(self.maintenant, self.dernier_appel_zoe) > self.ttl:
|
||||
self.dernier_appel_zoe = self.maintenant
|
||||
self.net_up()
|
||||
self.maintenant = time.ticks_ms()
|
||||
if self.derniere_val_zoe == 0 or time.ticks_diff(self.maintenant, self.dernier_appel_zoe) > self.ttl:
|
||||
self.dernier_appel_zoe = self.maintenant
|
||||
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()
|
||||
|
||||
@ -1 +0,0 @@
|
||||
import webrepl_setup
|
||||
Loading…
Reference in New Issue
Block a user