Help with Automation/command line to check if Image Recognition server service is running

I’m trying to monitor the Google coral Rest server service to see if it’s operational and notify me if it fails, whic it does from time to time, even though I reboot the server each night. It’s easy enough to check on the service. I’ve tried various methods without success and am looking for some help to figure out the best method, hopefully one that returns results that I can display in a Lovelace card.

This is the switch I tried:

#  - platform: command_line
#    switches:
#      google_coral_svc:
#        command_on: "/usr/bin/curl -X POST -F image=@/config/www/truck.jpg 'http://localhost:5000/v1/vision/detection'|grep true"
#        command_off: "/usr/bin/curl -X POST -F image=@/config/www/truck.jpg 'http://localhost:5000/v1/vision/detection' |grep true"
#        command_state: "/usr/bin/curl -X POST -F image=@/config/www/truck.jpg 'http://localhost:5000/v1/vision/detection' |grep speed"
#        value_template: '{{ value == "Speed" }}'
#        friendly_name: Google Coral Service

Command_state ended up hitting the server ever 30 seconds, and I can see the results in the servers log, but the switch didn’t return anything usable. I also tried using the TCP service call, but I don’t know how to elicit a usable response.

Here’s the output I get from the server service Using the command line:

I think I need to use the command line function somehow and extract the result “true” at the end of the output to show the service is up and working.

So, anyone have any ideas I can try? I successfully ported Rob Coles code to my NUC, but I’m just not very good with json and templates… and this all goes deeper than my current knowledge base.

Jeff

Is there no API endpoint that shows the status? As I understand, now you let it process an image and if it’s sucessful it returns true. I think its a bit overkill just to get the status. Also you probably better use a command line sensor instead of a switch and set a large scan interval.

No api endpoint. This is early stuff. But it works really, really well. When it’s working.it returns data if it works. There is no error checking in Automations for failed Or empty calls to services that I’m aware of.

Calling the service either returns data or not, no error if the Svc isn’t running.

The “tensor” object is then updated if the service is running. Otherwise it’s empty.

Nobody? I know there a way to do this,I just need a push in the right direction…