-
-
Notifications
You must be signed in to change notification settings - Fork 30.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 InvalidStateError with length 320 #117861
Comments
Hey there @emontnemery, @jbouwh, @bdraco, mind taking a look at this issue as it has been labeled with an integration ( Code owner commandsCode owners of
(message by CodeOwnersMention) mqtt documentation |
Can you share the MQTT info (if possible in JSON format). You can find this at the MQTT device info page. |
MQTT discovery data:
Subscribed topics: Is this what you needed? There is a bit more but I think this was what you were asking for specifically. Let me know |
No, I need the config for the entity that causes the failure (in JSON format, there is a switch), the config is probably the correct one, and the state payload (at topic |
{ I was advised to try here first |
is this enough info? |
possible, I'll have a look later |
@jnewland I have enough information. The issue is that a sensor or text entity cannot have a state with more then 255 chars. If the length exceeds this limit we should log a better error message showing the entity causing the issue. That the state exceeds the limit is not an issue of MQTT. This is just a bad configuration. |
was this reply intended for me? |
my bad, I meant to address @contactmetherenow. The attached PR will improve the error logging and close this issue. It will not solve the Z2M issue BTW. |
The error is caused by the |
Should I be contacting Z2M to address the sensor error? if so what is the correct github for Z2M because i see quite a few. (FYI I am running Z2M as a docker container) |
Yes, you can submit an issue here: https://github.com/Koenkk/zigbee2mqtt/issues |
The problem
I noticed an issue in my log files regarding the following: homeassistant.exceptions.InvalidStateError: Invalid state with length 320. State max length is 255 characters. This is in regards to a ir blaster device (ZS06) using MQTT. The device does function properly even though I receive this problem but I wanted to see a resolution can be found to eliminate the error message that occurs any time i restart my HA.
The complete error message is listed below under the log file section.
What version of Home Assistant Core has the issue?
2024.5.4
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
MQTT
Link to integration documentation on our website
https://www.home-assistant.io/integrations/mqtt/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
2024-05-21 15:56:30.710 ERROR (MainThread) [homeassistant.helpers.entity] Failed to set state for sensor.0x385cfbfffe3e3594_learned_ir_code, fall back to unknown Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1203, in _async_write_ha_state hass.states.async_set( File "/usr/src/homeassistant/homeassistant/core.py", line 2310, in async_set state = State( ^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 1788, in __init__ validate_state(state) File "/usr/src/homeassistant/homeassistant/core.py", line 228, in validate_state raise InvalidStateError( homeassistant.exceptions.InvalidStateError: Invalid state with length 320. State max length is 255 characters.
Additional information
No response
The text was updated successfully, but these errors were encountered: