Template to extract Hassio Addon API state

Hi
Im trying to extract the state value of a hassio addon via api.
E.g http://hassio.local:8123/api/hassio/addons/name/status

Maybe via a template but wasnt sure how to. Then add to a binary sensor to display in the frontend

Thanks

First place to start would be to create a rest sensor to get the state attributes of the addon in question. I am currently travelling OS with the family so bit hard to give an example on the phone let me know if you get stuck. I have examples of using the rest api in my repo if you want to check it out.

I could do with some help if you have examples please. I tried to get the state of a hassio addon by going to this:
http://192.168.1.199:8123/api/hassio/addons/a0d7b954_homebridge/info
which was sucessful but when trying to get the state in a value template I got:

Error parsing value: 'value_json' is undefined (value: , template: {{value_json['data']['state']}})

Thanks

ok have you created your rest sensor for the homebridge addon?

Firstly add sensor and then reboot.

sensor:
  - platform: rest
    resource: http://192.168.1.199:8123/api/hassio/addons/a0d7b954_homebridge/info
    name: HomeBridge Addon
    value_template: '{{ value_json.state }}'

Ok I’ll try that
Thank you

1 Like

I’m still getting the same error. However, I’m also getting max retry’s in the log for my url and connection refused.

sounds like an auth issue I’m still using legacy API for mine maybe someone more verse in the new auth system can way in on how to add it to the api call?

Should I add api_password to url

either that or you may need to create an auth token and use that in your url, you had better check the rest api docs for correct string

Thanks for the help. I’ve got it working by including the api_password in the url.

1 Like