Hello.
The switch stopped working. Returns an error ‘value_json’ is undefined.
Request:
curl -X GET -u 'login:password' http://hitepro.local/rest/devices/65/
Answer:
{"id":"65","status":false}
YAML:
- platform: command_line
switches:
light_on_kitchen:
command_on: >
/usr/bin/curl -X PUT -u 'login:password' http://hitepro.local/rest/devices/65/1
command_off: >
/usr/bin/curl -X PUT -u 'login:password' http://hitepro.local/rest/devices/65/2
command_state: >
/usr/bin/curl -X GET -u 'login:password' http://hitepro.local/rest/devices/65/
value_template: >
{{value_json.status}}
command_timeout: 20
icon_template: >
{% if value_json.status == true %} mdi:toggle-switch-variant
{% else %} mdi:toggle-switch-variant-off
{% endif %}
friendly_name: Light on kitchen
Perhaps this is due to the lack of quotes for the status “state”: true, but I can’t affect a third-party device.
How to solve the problem?