I have two API calls to the same end point. One is with the RESTful switch, and another is from a RESTful sensor.
The sensor works, but the switch fails.
The switch fails with log entries:
Template variable warning: 'value_json' is undefined when rendering '{{ value_json }}'
The actual response from all of these API calls is the same:
{"status":true}
or {"status":false}
switch:
- platform: rest
name: "LED light switch"
method: POST
resource: http://octopi.local/api/plugin/octorelay
body_on: '{"command": "update", "pin":"r1", "cmd":"on" }'
body_off: '{"command": "update", "pin":"r1", "cmd":"off" }'
is_on_template: "{{ value_json.status }}"
verify_ssl: false
device_class: switch
headers:
X-Api-Key: 'LONGABC0'
Content-Type: 'application/json'
sensor:
- platform: rest
name: "LED printer api"
method: POST
resource: http://octopi.local/api/plugin/octorelay
payload: '{"command": "getStatus", "pin":"r1" }'
value_template: "{{ value_json.status }}"
headers:
X-Api-Key: 'LONGABC0'
Content-Type: 'application/json'
scan_interval: 15
Any ideas of what I might be doing wrong?