How to monitor if addon is started or not?

What would be the best way to monitor if certain addons are running?
I’ve had 2-3 cases where deconz wasn’t running and I’d like to monitor that so I can react if necessary.

I was thinking possibly through a sensor which I can use in automations, I’m open to other options though.

This is how I check if letsdnsocloud is running :

sensor :

#--------------------------------------------------------------------------------------
# letsdnsocloud
#--------------------------------------------------------------------------------------

  - platform: rest
    resource: https://home.mydomain.com:8123/api/hassio/addons/3983e8d8_letsdnsocloud/info
    name: letsdnsocloud
    value_template: '{{ value_json.data.state }}'
    scan_interval: 
      minutes: 10
    headers:
      Authorization: 'Bearer xxxxxJpc3MiOiI1YWYyYTBmZjAyZmU0ZWIxOTY1NTcwZTY4YWQwZjRjYyIsImlhdCI6MTU5NTA3NjE1NiwiZXhwIjoxOTEwNDM2MTU2fQ.zQtxKpAvsV0RPmQBE_83iXh3A0NOreGmXcoabxuzdrs'
      Content-Type: application/json

Thanks for the recommendations. I just noticed that I might also be able to use the command line sensors, will need to look into that.

@francisp you may want to remove the Authorization header from your post.

I replaced the first 30 characters with xxxxx. I don’t anyone can reconstruct it :slight_smile:

Another idea… you could consider Portainer. I run it as a separate Docker container, but there is also an HA Addon which you could install. It shows all the Docker containers and their status. Also gives access to the logs which can be handy.

With supervisor 236+ enable both “Start on boot” and “Watchdog”
image

2 Likes

236? Still in beta or? Don’t see it, am on 235

Currently it’s on dev channel only

Thanks for sharing . This code worked for me. For your information I use it as a condition to only show certain input fields in my Lovelace interface when node red is started.

- platform: rest
  resource: http://<local ip address>:8123/api/hassio/addons/a0d7b954_nodered/info
  name: status nodered
  value_template: '{{ value_json.data.state }}'
  headers:
    Authorization: !secret rest_command_secret
    Content-Type: application/json

I do not use https as as this is all local for me. Also I have stored my authorization key in my secrets file as I use it for other api calls as well.

1 Like

For some reason this API is not working right now.
The address /api/hassio/addons/a0d7b954_nodered/info returns empty.

What should I do? I also need to check if NodeRed is running.

See the supervisor entities, but you will probably need to enable them.

1 Like

Where to see? And how to turn it on?

Settings → Devices & Entities → Home Assistant Supervisor → on the screen xxx entities (click on these) →
Search for binary_sensor.xxx_running, where xxx will be something like nodered or a0d7b954_nodered → Click on that → Cog wheel right upper corner → enable → update

2 Likes

Found! Thanks a lot!