Increase MQTT state max length from 255 to something bigger

Some devices that broadcast on MQTT send more than 255 chars, creating an Invalid state error on HA. Can you please increase the state max length to cope with this, e.g. over 300.

So set the mqtt to attributes instead


I’m using a RF receiver which posts various RF device data streams into MQTT. I cannot edit these, so I use HA templates already to pick out the various device ids, reformat the data and repost to MQTT so that I can get the right data to the correct HA entity cleanly. Unfortunately the received raw data generates the overflow error when certain devices generate more than 255 chars. I can usually extract the necessary data, however one still gets the error when the raw data comes in. Would be nice not to get this, even if data is extracted ok via templating.

All states are always limited to 255 characters.

I doubt that will change.

Maybe NodeRed can handle it.
I have never tried so long data inputs, but NR should be able to connect directly to the MQTT broker and bypass HA.

Can you post the templates that you’re using to pick out the data? Maybe there’s an alternate way if we can see what you’re doing.

Yes Node red can handle larger strings than HA. But there is no need for it. Look at the link I posted.
You just place the data in the attributes

Thanks for the suggestions - I reconfigured some templates and ditched templating on the raw data which has cured my issue.

But still looking to the future, it could be a useful idea to have a special double length state variable for large character sets.