I have a problem updating an uservariable with python in Domoticz IDE.
In the python script below the New value is still not correct after 30 seconds of waiting!
Code: Select all
import DomoticzEvents as DE
import requests
import time as time
if DE.changed_device_name == "Test Python":
New= 35050
url= "http://192.168.0.45:18080/json.htm?type=command¶m=updateuservariable&vname=Test entier&vtype=0&vvalue=" + str(New)
CLE64 = {"Authorization" : "Basic RG9tb0JvZ2dpeTUwRFMhYWZ5MTk1MA=="}
try:
rc = requests.get(url, timeout=(1,1), headers= CLE64) # sans AUT erreur 401
print(rc.raise_for_status())
except requests.exceptions.RequestException as err:
print ("R-OOps: Something Else",err)
except requests.exceptions.HTTPError as errh:
print ("R-Http Error:",errh)
except requests.exceptions.ConnectionError as errc:
print ("R-Error Connecting:",errc)
except requests.exceptions.Timeout as errt:
print ("R-Timeout Error:",errt)
time.sleep(30)
print ("Nouvelle valeur: " + DE.user_variables["Test entier"])
DE.Log("Nouvelle valeur: " + DE.user_variables["Test entier"])
I think it's an update problem but how to do it in Python?
Thanks in advance