Skip to content

MQTT messages sometimes not delivered after Home Assistant reboots #6

@RobertD502

Description

@RobertD502

I started to notice that MQTT messages will sometimes fail to be delivered to Home Assistant if HA is rebooted. This doesn't always occur and I haven't been able to pin down the exact conditions since sometimes MQTT messages from the Neato are still being delivered after a HA reboot and at other times they are not. I tailed the log for the neatoserialmqtt.service and notice that it reports that it is continuing to send messages although the MQTT broker isn't receiving them. Whenever this happens, I manually connect to my broker and can see that the "vacuum/state" topic is not present. The only way to get MQTT messages to properly arrive to the broker and be seen by HA again is to restart the neatoserialmqtt service at which point the "vacuum/state" topic reappears and everything is functioning again. I'm not sure if this problem is specifically due to the broker on HA, but I did notice that the only MQTT device experiencing this problem is the Neato.

In case anyone else runs in to this problem, what I have done is:

  1. Generated a ssh key in HA and placed the files in /config/ssh.
  2. I then added the contents of the generated id_rsa.pub file on HA to the authorized_keys file on the pi running the neatoserialmqtt service.
  3. In HA, I created a shell command which restarts the neatoserialmqtt service when it is called:
    restart_bedroom_neato_mqtt_service: ssh -i /config/ssh/id_rsa -o StrictHostKeyChecking=no [email protected] -t 'sudo systemctl restart neatoserialmqtt.service'
  4. I then created an automation that runs the shell command if the vacuum's attribute "status" is "Unknown" for 30 seconds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions