Skip to content

HA autodiscover is not working after restart of the mqtt integration #292

@krombel

Description

@krombel

in #283 it was mentioned, that this extension was spamming logs so in #284 it was implemented to only publish messages once.

BUT the HomeAssistant docs states:

There are 2 common approaches to make sure the discovered items are set up at startup:

  • Using Birth and Will messages to trigger setup
  • Using retained messages

#284 lacks the case, that HomeAssistant reloads the mqtt connection. In that case all entities get unavailable and the only "solution" right now is to restart the gateway to make it publish the discovery messages anew.

As it seems to be the suggested solution* I would recommend to implement listening for the birth message (in default setup subscribe to homeassistant/status and send the discovery messages again if the message pushed there is online.

* from the docs:

A disadvantage of using retained messages is that these messages retain at the broker, even when the device or service stops working. They are retained even after the system or broker has been restarted. Retained messages can create ghost entities that keep coming back.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions