In this example we will add the possibility to stop the charge at 6 o'clock.
-
Save
You can do the same thing that we did in part one. You just have to change url to :
- http://localhost:5000/charge_control?vin=YOURVIN&percentage=100
- http://localhost:5000/charge_control?vin=YOURVIN&percentage=XX
If you want more precise control :
- Add a virtual switch
2. Edit the new switch 3. Get the idx
-
Open event configuration : configuration -> devices -> Event
-
Add this code and change the vin in the url
import domoticz
import DomoticzEvents as DE
import urllib.request
for name, value in DE.user_variables.items():
domoticz.log("var"+ str(name)+ "has value"+ str(value))
domoticz.log("The device that got changed is: "+DE.changed_device_name)
# changed_device.name is the same string
if DE.changed_device_name== "Seuil de charge":
urllib.request.urlopen('http://localhost:5000/charge_control?vin=YOURVIN&percentage='+str(DE.changed_device.s_value))
- Save