FIX : vitesse 1ere récup info
This commit is contained in:
parent
c87352c540
commit
109424fc50
8
main.py
8
main.py
@ -79,17 +79,19 @@ class Cloud:
|
|||||||
|
|
||||||
def net_up(self):
|
def net_up(self):
|
||||||
if not self.wifi.isconnected():
|
if not self.wifi.isconnected():
|
||||||
|
print("Connexion au WIFI...")
|
||||||
self.wifi.active(True)
|
self.wifi.active(True)
|
||||||
self.wifi.connect("Livebox-BDC6", "KFQSn7PDCMSgPpM2Ws")
|
self.wifi.connect("Livebox-BDC6", "KFQSn7PDCMSgPpM2Ws")
|
||||||
while not self.wifi.isconnected():
|
while not self.wifi.isconnected():
|
||||||
print(".")
|
print(".")
|
||||||
|
time.sleep(0.2)
|
||||||
|
|
||||||
def zoe(self) -> int:
|
def zoe(self) -> int:
|
||||||
try:
|
try:
|
||||||
|
self.net_up()
|
||||||
self.maintenant = time.ticks_ms()
|
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.dernier_appel_zoe = self.maintenant
|
||||||
self.net_up()
|
|
||||||
debug("appel sensor.zoe_batterie")
|
debug("appel sensor.zoe_batterie")
|
||||||
response = urequests.get("https://ha-demo.arbi.fr/api/states/sensor.zoe_batterie", headers=self.headers)
|
response = urequests.get("https://ha-demo.arbi.fr/api/states/sensor.zoe_batterie", headers=self.headers)
|
||||||
data = response.json()
|
data = response.json()
|
||||||
@ -102,10 +104,10 @@ class Cloud:
|
|||||||
|
|
||||||
def HC(self) -> bool:
|
def HC(self) -> bool:
|
||||||
try:
|
try:
|
||||||
|
self.net_up()
|
||||||
self.maintenant = time.ticks_ms()
|
self.maintenant = time.ticks_ms()
|
||||||
if time.ticks_diff(self.maintenant, self.dernier_appel_HC) > self.ttl:
|
if time.ticks_diff(self.maintenant, self.dernier_appel_HC) > self.ttl:
|
||||||
self.dernier_appel_HC = self.maintenant
|
self.dernier_appel_HC = self.maintenant
|
||||||
self.net_up()
|
|
||||||
debug("appel sensor.compteur_linky_ptec")
|
debug("appel sensor.compteur_linky_ptec")
|
||||||
response = urequests.get("https://ha-demo.arbi.fr/api/states/sensor.compteur_linky_ptec", headers=self.headers)
|
response = urequests.get("https://ha-demo.arbi.fr/api/states/sensor.compteur_linky_ptec", headers=self.headers)
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
import webrepl_setup
|
|
||||||
Loading…
Reference in New Issue
Block a user