I have HASS Agent, Node Red (with MQTT server info in the settings) and the Home assistant MQTT addon installed and my broker is an external EMQX broker (proxmox, so Home Assistant is on same machine, just different VM/IP).
Now if I needed to update my HA install, I would reboot HA after updating. When I log back into HA after reboot, the MQTT sensors provided by HASS agent are unavailable until I restart HASS executable on my windows machine. This also affects my PS5 MQTT and Node Red addons and my Playnite MQTT addon (the dev for this one has not implemented reconnection so I’m aware of this issue). All clients are using the same client login for EMQX. Is there a setting in EMQX or HA that I need to enable to have it properly display? Inside HA MQTT I have set to retain 0, and also in Node Red addon, the MQTT server listens to the ‘homeassistant/status’ topic with birth and will retain true at 0.
This means when Home Assistant reconnects to the broker then the broker will send the last retained values to update the sensors.
If your broker is not doing that then there is probably something wrong with it.
You can use MQTT explorer to connect to the broker to inspect the messages to make sure they are being received with the retained flag set. I doubt it is an issue with Hass Agent though as it works for me using the Mosquitto broker.