Iâm not sure about detecting individual addons, but if you use the Glances addon with the Glances sensor, you can get that to tell you the number of running containers. If you know how many should be running you could make an automation to alert you if that number changes.
That would worked if I were interested on monitoring all the addons, but not sure if that fits when focusing on a specific one. Letâs have a look into Glances though, thanks
Iâve checked at your Github and definitelly looks to be what I need!
However, tried to make a sample for duckdns using this info at my secrets.yaml generates a sensor.duckdns entity with âUnknownâ state. Do these secrets look fine at your sight?
Error fetching data: <PreparedRequest [GET]> from https://mydomain.duckdns.org:8123/hassio/addon/core_duckdns failed with HTTPSConnectionPool(host=âmydomain.duckdns.orgâ, port=8123): Max retries exceeded with url: /hassio/addon/core_duckdns (Caused by NewConnectionError(â<urllib3.connection.VerifiedHTTPSConnection object at 0x7576ec70>: Failed to establish a new connection: [Errno 111] Connection refusedâ))
Look good. I assume you chagned âmydomainâ to your actual domain?
Does the call to your domain loop back to your HA server? Ie, in a browser can you enter https://mydomain.duckdns.org:8123 and get to your frontend? Or do you need to enter the actual IP?
Also, I will get that error sometimes when things are starting up, I think the supervisor isnât ready to respond to requests or something while homeassistant is making the requests at startup. It will populate the status after a minute.
Yes, mydomain is just for sanity, I se my own, and I always access that URL to access my FE (have that NATed at my router).
When HA starts up, I get a diferent error, which looks like it being unable to use rest API at startup: âPlatform rest not ready yet. Retrying in 30 seconds.â
NOw I can see more recent errors like: " Error fetching data: <PreparedRequest [GET]> from https://mydomain.duckdns.org:8123/hassio/addon/core_duckdns failed with HTTPSConnectionPool(host=âmydomain.duckdns.orgâ, port=8123): Max retries exceeded with url: /hassio/addon/core_duckdns (Caused by NewConnectionError(â<urllib3.connection.VerifiedHTTPSConnection object at 0x6e80ce10>: Failed to establish a new connection: [Errno -3] Try againâ))"
Took me way longer than I wanted to spend on this, but here is a custom component that can get the state:
USE AT YOUR OWN RISK
Itâs pretty hacky at the moment. I was even so lazy as to modify the object the hassio component uses by adding some methods to it directly. Make sure you have a way to access your configs without the hassio component and disable this custom component if you run into issues.
Put all of those files under custom_components/hassio_info/ and then add to your config:
hassio_info:
It will find your installed addons automatically and create two sensors and a switch for each one:
sensor.hass_io_addon_name_version: current version
sensor.hass_io_addon_name_last_version: latest available version
switch.hass_io_addon_name: switch to turn on/off
You currently have to restart whenever you install an addon for it to get picked up.
After following your instructions, I created a sensor as:
sensor:
platform: hassio_info
addon: duckdns
and I get the following error. I guess the issue comes from the addon ID (âduckdnâ in my sample avobe), mabe I have to use an alternate ID? Where should I get it from?
2019-03-14 23:22:36 ERROR (MainThread) [homeassistant.components.sensor] hassio_info: Error on device update!
Traceback (most recent call last):
File â/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.pyâ, line 248, in _async_add_entity
await entity.async_device_update(warning=False)
File â/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity.pyâ, line 346, in async_device_update
await self.async_update()
File â/config/custom_components/hassio_info/sensor.pyâ, line 67, in async_update
info = await self._hassio.get_addon_info(self._addon)
File â/usr/local/lib/python3.7/site-packages/homeassistant/components/hassio/handler.pyâ, line 43, in _wrapper
raise HassioAPIError(data[âmessageâ])
homeassistant.components.hassio.handler.HassioAPIError: Addon does not exist
Incredible!! Great, thank you very much!! Works perfectly for me! Just tested and created an entity for each addon with all those sensors. I cannot see the switchesâŚbut seems youâre still modifying code
We keep check it later, man. This was much more I expected to get for free!!
Just finished making sure everything was updated. There should be four files now. If theyâre still not showing up with all of those . If you get an error in the logs I can look into it though.
I wanted an excuse to write a custom component anyway and since I use hassio it sounded like a good idea to have a way to be notified if something goes wrong. It was a win win.
I probably wonât do much more for now. Maybe at some point Iâll clean it up and make a separate post for everyone to use or try to get it merged into the core components somehow. I wouldnât mind if someone else took over and did that for me though
Hi silvrr,
I would like to integrate the addon status in my config using your way, but I have the same issue described by fgsalvado ([Errno 111] Connection refusedâ).
I noticed that if I try to connect via browser for example to https://xyz.duckdns.org:8123/hassio/addon/core_samba/info
after the login page I see a warning page (Warning: Protection mode is disabled!), but if I hit âEnable protection modeâ nothing happens.
Any help?
Thanks a lot
I assume this would work with a proxy but I havenât tested it with one. I wonder if the request is stopping at the proxy? Can you see in the proxy logs if the requests are going through?