rtlamr2mqtt: state class exceeding 255 chars

So over night my gas sensor stopped working and my HomeAssistant logs began to fill with a repeated error:

2022-02-09 15:03:16 ERROR (MainThread) [homeassistant.util.logging] Exception in message_received when handling msg on 'rtlamr/98546445/state': '{"Time": "2022-02-09T23:03:16.552376855Z", "Offset": 0, "Length": 0, "Type": "SCM+", "Message": {"FrameSync": 5795, "ProtocolID": 30, "EndpointType": 156, "EndpointID": 98546445, "Consumption": "60090", "Tamper": 3592, "PacketCRC": 29813, "Predicted": 60110.93482659571, "Anomaly": false}}'
homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity ID: sensor.gas. State max length is 255 characters.

I’m not sure what changed to suddenly upset the state class limit, if it was my update to 2022.2.x or something else, but now my gas meter is no longer reporting any info, as it’s state class has ~280 some odd characters in it.

Am I doing something wrong that’s causing too much information to be dumped into the state, or was there a change in 2022.2.X that made it more sensitive to the output from rtlamr2mqtt that’s making the data in mqtt no longer valid to parse? (I did see there was a lot of MQTT work in 2022.2.1 through 4 so maybe that had something to do with this?)

Edit: It does seem the comment threads in Home Assistant are reporting a plethora of MQTT pains for users, so I’m leaning towards this not being something I am doing wrong, and I might need to just sit tight.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

Yes, this what I’ve asked! Thank you.

Well, I really cannot see anything wrong with anything you have sent…

I’m going to make a change to split state_value and attributes into 2 different topics. This is something I was planning to do in the future, but it will fix the problem you’re experiencing.

I will update this issue in a few hours and will let you know how to test it out.

Thank you and sorry for the inconvenience.

On Thu., Feb. 10, 2022, 7:09 p.m. J. Eckert, @.***> wrote:

Apologies, the work day has friend my brain and it’s not immediately clear to me what you are asking. Did you want me to grab the payload for that topic from HA in the same way? If so here ya go!

Message 0 received on homeassistant/sensor/rtlamr/gas_meter/config at 4:48 PM: { “name”: “gas_meter”, “unique_id”: “98546445”, “unit_of_measurement”: “m3”, “icon”: “mdi:gauge”, “availability_topic”: “rtlamr/status”, “state_class”: “total_increasing”, “state_topic”: “rtlamr/98546445/state”, “value_template”: “{{ value_json.Message.Consumption | float }}”, “json_attributes_topic”: “rtlamr/98546445/state”, “json_attributes_template”: “{{ value_json.Message | tojson }}”, “device_class”: “gas” }

— Reply to this email directly, view it on GitHub https://github.com/allangood/rtlamr2mqtt/issues/84#issuecomment-1035695398, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFY2XXC7AHKHKKPNALT4A3U2ROTRANCNFSM5N65PSEA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>