Hi,
I am now switching my EVSE car charger on using a command line switch. Would there be any benefit using a RESTful Switch instead?
json from http://192.168.207.98/getParameters:
{"type":"parameters","list":[{"vehicleState":2,"evseState":false,"maxCurrent":20,"actualCurrent":18,"actualPower":0,"duration":0,"alwaysActive":false,"lastActionUser":"","lastActionUID":"","energy":0,"mileage":0,"meterReading":0,"currentP1":0,"currentP2":0,"currentP3":0}]}
switch:
- platform: command_line
switches:
evse:
friendly_name: EVSE activeren
command_on: "curl http://192.168.207.98/setStatus?active=true"
command_off: "curl http://192.168.207.98/setStatus?active=false"
command_state: "/usr/bin/curl -X GET http://192.168.207.98/getParameters"
value_template: "{{ value_json.list[0].evseState == True}}"
I’ve been trying to convert this into a rest switch using this example, but I can’t get it working…
switch:
- platform: rest
name: evse
scan_interval: 5
resource: http://192.168.207.98/setStatus?active=
body_on: 'true'
body_off: 'false'
is_on_template: '{{ value_json.list[0].evseState == True}}'
headers:
content-type: application/x-www-form-urlencoded