Home Assistant Add-on events?

I’m just taking a wild swing here. Has anybody written an Add-on in Home Assistant incorporating Events?

I am writing an MQTT gateway Add-on to pull data from an external source. The gateway works but I need to know when HA reloads a config so that I can force a refresh. Currently I do the Helper method from within HA to reload the whole Add-on but I think it would be better if the Add-on refreshes when it receives a “reload_all” event from HA.

event_type: call_service
  domain: homeassistant
  service: reload_all

There doesn’t seem to be much information on the web wrt Add-on’s.

I googled for you. Assuming, you meant integration instead of add-on. Because add-ons don’t need to listen for config changes. Integrations on the other hand…

Anyways I found: Listening for events | Home Assistant Developer Docs
I suspect the event you want to listen for is: EVENT_CORE_CONFIG_UPDATE

Again, I highly doubt add-ons can listen for events, but integrations can.

Nope, an Add-on specifically. I saw the Integrations part but that didn’t apply to my Add-on.

What actually happens is that when you do a YAML Reload All Configuration (not full reload) is that all entities on the dashboard are refreshed. My Add-on, using MQTT, does not send states using persistent so the values go Unknown at that point until the next update. I made it that way for a reason so you could immediately see if something goes haywire. The entities are ‘volatile’ so don’t want HA to cache the state even when there is no comms to the add-on for whatever reason.

If I then refresh my add-on it updates the states again from the add-on side towards HA. I just need that trigger to do the refresh. I have a workaround but it’s not as ‘neat’ as I want it.

Someone mentioned on another forum “the Add-on is in it’s own docker”, which is fair but, I see there is internal API comms possible to the Supervisor so there must be something I can work with - I just don’t know what/how.

Ah it sounds like it is behaving correctly then. You probably want to look in to if HA MQTT sends a mqtt message then. Could be something as simple as it sends an update to the mqtt server in the clients prefix. That way, your software will be able to update even when running standalone and not as an addon

Either way, I think, your best bet for an answer is the Home Assistant discord server. Home Assistant