Rest Api comand check response

Hi fellow tinkerers,

I made a rest api command, command is working as I intended, but sometimes it fails to send the message.
HA log says :
2021-11-29 17:08:56 ERROR (MainThread) [homeassistant.components.rest_command] Client error http://localip:port/?command=set&proxyID=744&variableID=1150&newValue=18.0

Now if I paste this command in a webbrowser everything triggers fine and I get this message in the browser: {“success”:“true”}

9 out of 10 times Home Assistant is triggering this command fine but I’d like to know if I can add something to the restcommand to check for the {“success”:“true”} message.

this is the code I’m currently using;

rest_command:
 slaapkamer_set_to_c4:
   url: 'http://IP:PORT/?command=set&proxyID=744&variableID=1150&newValue={{ state_attr("climate.slaapkamer", "temperature") }}'

again, above part works fine but is there a way to check if the command was a succes?

Kind regards,
Colin

a good question - i have the same issue

The short answer is: no.

The long answer is: There is no programmatic way to automatically check the JSON response. There is however a debug log message that captures the result, or logs a warning message if the command fails.

logger:
  default: info
  logs:
    homeassistant.components.rest_command: debug

And, maybe you could then use the System Log integration and create an automation that sends you a notification or change a state or something like that?

1 Like