-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Entities Unavailable after HASS Restart #55
Comments
I am getting the same issue. One thing that works for me as a temporary fix is changing the device name to anything then changing it back. HA will then pick the entities back up. |
Your workaround got it re-integrated for me for now. Cheers! |
Same problem, restart octoprint helps. |
I've been noticing this same issue, a reboot of OctoPrint usually corrects the issue and it shows back up in Home Assistant, issue is when you're in the middle of a print and can't do such a thing... To double check, I have MQTT subscribed in Node-RED and it still is seeing communication so it isn't that it goes away, just seems what ever method Home Assistant and this Plugin is using to communicate is not reconnecting when HA reboots but does when OctoPrint reboots. |
That's what I noticed as well when I was troubleshooting. Octoprint is still publishing new messages. It just seems that the advertisement that associates the devices/entities with the MQTT topics is failing for some reason. |
I'm having the same issue. However i get almost bogus MQTT messages if I don't restart Octoprint, as if it stuck at some sort of timestamp. Funny enough some of the sensors work though. Notably sensor.octoprint_job_percentage, |
Can you provide samples of the bogus message please. |
Would someone confirm for me, when this happens, does restarting the home assistant server by itself fix the issue? Which MQTT integration are you using? Mosquito, or the built-in MQTT service? Also, please check the MQTT information from the device, in particular the "MQTT" topic, see the screenshot: Expand the messages and copy and paste here please. The latest message you received should always be connected. |
Restarting home assistant (or just waiting a few days) is what breaks it.
I'm using Mosquito hosted on the same server as HomeAssistant for the MQTT broker. The only integration I know of is the one built into Home Assistant, I couldn't find one specific to Mosquito.
Looks like the "octoPrint/mqtt" topic says "Disconnected", but directly below you can see that values are still being updated to MQTT. Thanks for getting back to us! |
Lol, note I'm changing my password now :D |
Ha, you sacrificed your password for a good cause, though. While smiling about that i realized i had not supplied user/password. Entered credentials: everything showed up in the sensors as it should :) |
My "enable retain flag" button was not checked, so I enabled that. I also rebooted HomeAssistant and so far everything still seems to be loaded and happy. I'll give it a few days and a few reboots to see if that fixes it! One other thing of note: the "static client id" setting on my MQTT settings page is checked where yours is not. So I'm not sure if I should mimic that setting or just ride it out and see if it is good now. |
I suspect that the retained flag setting is going to be the common cause of issue, unfortunately a fix for this needs to come from the OctoPrint-MQTT plugin. I'll investigate if I can add a warning or something in the mean time, and add a note to documentation to help anyone else seeing the same issue. Thanks for the help everyone. |
So far so good. I'm several reboots into HomeAssistant and it's holding steady. I'm just a little worried about some of my automation getting caught on a retained message and messing up a print (which is why I had that off in the first place). But I'll cross that bridge if it happens at this point. |
PR is pushed to OctoPrint-MQTT to help address this: OctoPrint/OctoPrint-MQTT#100 |
I have another problem when HASS restarts not only my entities become unavailable but when I'm printing the printer stops until HASS is fully started again. Anybody has the same problem? |
This issue persists for me, even with the latest build and setting set as above. Setup: |
Sounds like a problem with retain sending a pause command on startup. I would recommend that you disable the use of retain in the MQTT plugin, and you might have to manually delete the topics on your MQTT server to clear the retained status. |
Ok, Will make the change and report back, Thank you |
Made the changes but the problem persist. I get other messages from Octoprint, but not from the Plugin (hass) |
I started a print (which I was getting updated information (after a Octoprint restart of course)) and re-started HA. Sure enough everything went "Unavailable" in HA, but I'm still seeing the OctoPrint plugin sending information. Inside HA, Listening to topic Message 0 received on mk3octoprint/hass/printing at 12:41 PM:
Inside HA |
@cmroche as I understand it, MQTT devices should periodically re-send the device registration although I could be wrong there. I'm not a fan of having the systemwide retain flag on though so with a small patch to your code I made a HA automation to re-send device registration periodically and when entities become unavailable: alias: '[Ender] Fix Unavailable MQTT'
description: ''
trigger:
- platform: template
value_template: '{{ is_state(''binary_sensor.octoprint_printing'', ''unavailable'') }}'
- platform: time_pattern
minutes: /8
condition: []
action:
- service: mqtt.publish
data:
topic: octoPrint/mqtt
payload: connected
mode: single The only change required was this one to decode the message bytes to string: |
@TheHolyRoger Merged, thanks for looking into this. |
@cmroche thank you! |
I'm not sure if this is an issue with my Octoprint setup, HASS setup, or MQTT setup, but since this is where those three meet, I figured I'd start looking around here to see if you can help.
When I restart Home Assistant, OR if I go for too long without printing anything, the entities that this plugin allows Home Assistant to discover become unavailable.
Once this happens, the only way to fix it is to restart Octoprint. Not even starting a new print or having one going at the time will refresh things. (Which isn't ideal if I happen to restart Home Assistant during a multi-day print)I believe the issue is that the MQTT messages time out after a while or get discarded and for some reason it stops pulling in new ones that may be published? However, I am honestly not sure whether it is this plugin or the main MQTT plugin that causes the majority of information to be published to the broker.EDIT: I just restarted OctoPrint and used HomeAssistant to listen to the MQTT events for temperature to verify that messages are coming in. Everything seems like it should be working, but everything is still showing unavailable. I'm at a bit of a loss here.
Any help is appreciated. Let me know what logs if any I can get you. Thanks!
The text was updated successfully, but these errors were encountered: