]> git.basschouten.com Git - openhab-addons.git/commit
[mqtt.homeassistant] ensure availability topics get subscribed (#13466)
authorCody Cutrer <cody@cutrer.us>
Sat, 8 Oct 2022 07:12:28 +0000 (01:12 -0600)
committerGitHub <noreply@github.com>
Sat, 8 Oct 2022 07:12:28 +0000 (09:12 +0200)
commit98677c18b3ab275f6a95bf353908e04954f739e3
treef734c5b51854fae16633ff302a89d95ca874474e
parent959e65814b93aa7514b3ce36b3f7e37bd742d42c
[mqtt.homeassistant] ensure availability topics get subscribed (#13466)

HASS registers availability topics before calling start(), so
the AbstractMQTTThingHandler was never subscribing/starting the
availability channel(s). So do so in start() of the base class.

I checked other implementations, and either they already handle
re-registering availabilityTopics in their start()
(GenericMQTTThingHandler), or they don't use availabilityTopics
at all from the base class and manage it themselves (Homie).

Note that this shows up as newly-added HASS things not having
a problem (because the components aren't discovered until after
the ThingHandler is started), but if you restart OpenHAB or
disable/enable the thing, the channels (and components) are
cached, thus how availabilityTopics are known before starting.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/AbstractMQTTThingHandler.java
bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/handler/HomeAssistantThingHandler.java