Hi there,
does anybody have an idea why my doorbell mqtt automation triggers once on each hassio startup even when the client (wemos d1 mini) is offline?
I guess it is because of a subscription message to the broker but I dont know how to change the trigger so that it doesn’t react to the subscription.
configuration.yaml
mqtt:
broker: core-mosquitto
automations.yaml
- alias: "Doorbell notification via telegram"
trigger:
platform: mqtt
topic: home/doorbell/button/pressed
payload: 'true'
action:
- service: notify.telegram
data:
message: "The doorbell is ringing."
You probably have “retain on” so the broker will resend the last state when HA restarts, just create an automation that turns off the notification one till HA has been on for a few minutes after a startup event.
Like I said, this happened even when the wemos was offline, @VDRainer.
But nevertheless thanks for the hint @keithh666 and @VDRainer, it was the retain flag. Turning on the automation after a delay didn’t help because the retain message is then just sent a little bit later.
But defining a mqtt binary sensor with the same topic and with retain = false did the job: