-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
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
mqtt: Exception in availability_message_received #40166
Comments
mqtt documentation |
Hey there @home-assistant/core, @emontnemery, mind taking a look at this issue as its been labeled with an integration ( |
Please enable MQTT debug logging and share a log from HA startup until the issue is reproduced. Log settings: logger:
default: info
logs:
homeassistant.core: debug
homeassistant.components.mqtt: debug |
Unfortunately I wasn't able to reproduce error - both turning Z2M off and reinstalling it twice. While you're on it - could you please also take a look @ issue linked in "Additional info"? |
This could be a problem related to MQTT discovery update, but it's a bit tricky to debug without a log. Do you know if zigbee2mqtt has implemented support for multiple availability topics as suggested here: Koenkk/zigbee2mqtt#775 (comment) |
OK, but the code doesn't seem to be updated to support both: Have you enabled zigbee2mqtt's availability timeout: https://www.zigbee2mqtt.io/information/availability.html ? |
Yes, I did. |
OK, did you recently enable that option, without restarting HA? |
I've enabled it yesterday and it's possible I didn't restart in meanwhile, yes. |
OK, can you then try to reproduce the problem by:
This will trigger an attempt by zigbee2mqtt to reconfigure the availability settings on HA side, which may be triggering the exceptions. |
I've tried these steps, for one of sensors similiar error occured. Full log from few seconds before and after: https://pastebin.com/pRbWHdix Logger: homeassistant.util.logging
Source: util/logging.py:108
First occurred: 16:28:34 (3 occurrences)
Last logged: 16:28:40
Exception in state_message_received when handling msg on 'zigbee2mqtt/Xiaomi Door Pokój Mniejszy Uchylenie': '{"battery":100,"contact":false,"linkquality":95,"voltage":3025}' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 35, in wrapper msg_callback(msg) File "/usr/src/homeassistant/homeassistant/components/mqtt/binary_sensor.py", line 190, in state_message_received payload = value_template.async_render_with_possible_json_value( File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 274, in async_render_with_possible_json_value self._ensure_compiled() File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 300, in _ensure_compiled assert self.hass is not None, "hass variable not set on template" AssertionError: hass variable not set on template
Exception in state_message_received when handling msg on 'zigbee2mqtt/CC2591 Extender Garaż': '{"led":false,"linkquality":95}' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 35, in wrapper msg_callback(msg) File "/usr/src/homeassistant/homeassistant/components/mqtt/binary_sensor.py", line 190, in state_message_received payload = value_template.async_render_with_possible_json_value( File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 274, in async_render_with_possible_json_value self._ensure_compiled() File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 300, in _ensure_compiled assert self.hass is not None, "hass variable not set on template" AssertionError: hass variable not set on template
Exception in state_message_received when handling msg on 'zigbee2mqtt/Xiaomi Door Pokój Mniejszy Uchylenie': '{"battery":100,"contact":true,"linkquality":95,"voltage":3025}' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 35, in wrapper msg_callback(msg) File "/usr/src/homeassistant/homeassistant/components/mqtt/binary_sensor.py", line 190, in state_message_received payload = value_template.async_render_with_possible_json_value( File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 274, in async_render_with_possible_json_value self._ensure_compiled() File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 300, in _ensure_compiled assert self.hass is not None, "hass variable not set on template" AssertionError: hass variable not set on template |
OK, very good that it can be reproduced! However, as mentioned here: #40166 (comment) a full log from HA startup until the issue happens is needed. Btw, no need to use pastebin, you can zip+attach the log file directly in github, just drag it to the comment field. |
I hope you've downloaded file. |
@andriej Yes, I downloaded the log. The problem is a race when the MQTT entity config is changed. |
Did this ever go anywhere? I'm having issues with my Tasmota devices disappearing after upgrading to 0.117.5 or creating multiple entries and the original one I use in automations being dead (for instance, light.credenza_led_strip is dead, but light.credenza_led_strip_2 is working.) I see these in my home-assistant.log:
|
@dennyreiter I don't think your problem is related to the problem reported by @andriej |
I have not had the problem, but I've switched over to the Tasmota integration since then, along with upgrading the Tasmota devices. |
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. |
I'm not sure if it has been fixed |
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. |
I am seeing this issue as well, same error message, different content:
Using no yaml. direct HA discovery. |
@pkishino Please open a new issue for your problem 👍 |
The problem reported by @andriej is because of a race when handling a discovery update. For example, the MQTT availability mixin does this: async def availability_discovery_update(self, config: dict):
"""Handle updated discovery message."""
self._availability_setup_from_config(config)
await self._availability_subscribe_topics() If MQTT messages are received after calling There are several variations of this, but the problem is always that we may handle MQTT messages before the entity is fully setup. |
The problem reported by @andriej should be fixed by #65415 The problem reported by @dennyreiter here: #40166 (comment) may be a different issue. |
The problem
While upgrading my zigbee sitck I did shutdown zigbee2mqtt add-on and found out this spam in log:
Environment
Problem-relevant
configuration.yaml
n/a
Traceback/Error logs
404 times...
Additional information
Right now I still have MQTT in yaml as previous issue is still valid - I don't know if it's possible to migrate MQTT flawlessly to configflow.
#39860
The text was updated successfully, but these errors were encountered: