I have a script that runs a rest_command and then sends me a notification about it’s success. But obviously it will only fail if there’s a serious error in rest_command, and I’d be oblivious to other possible response-errors that it may have.
Is there a way to get response of the rest_command (post in my case) and then show it in notification? Or write it to disk into a file or whatever. With hass tools.
I suppose worst case scenario I can instead use an approach like:
Run external python script that POSTs to a website and writes response on disk into a txt file
Delay up to 10 seconds to give time for POST to complete (whatever timeout time is set)
Read the file and send it’s contents in notification
But it would be cool if I could avoid using python for this
Sure. Here’s how I’ve done it. The general idea is that python script is called as shell_command, it then does it’s thing and then reports back to Homeassistant by calling a Script through API and passing some variables to it.