roomsense / firmware

4 stars 0 forks source link

"Long" location tags seem to send corrupt data in /homeassistant/ discovery topics #15

Open tofurky opened 2 months ago

tofurky commented 2 months ago

living and living room worked, living-roomsense is always sending:

"name": "living-roomsense���?-Temperature-C-83A4",
"unique_id": "living-roomsense���?_Temperature-C_83A4",

So it seems perhaps it's overflowing a buffer so the NULL terminating byte is missing and it's reading nearby data, hence the garbage.

Suggest the following:

  1. Increase buffer size; seems too small
  2. Add server-side (and optionally, JS) bounds check when submitting location tag via config interface
roomsense commented 2 months ago

The location tag can be up to 100 characters long, but Home Assistant may not fully support names of that length. It's recommended to keep names shorter for better compatibility.

tofurky commented 2 months ago

They're actually being corrupted when being sent via MQTT, so maybe it's an intermediate buffer. The garbage control characters prevent the data from even being accepted by Home Assistant.

roomsense commented 1 month ago

what is the Length of your name including the location tag?

tofurky commented 1 month ago

I don't see any option to give a name besides just the location tag; living-roomsense causes the issue with garbage characters being sent over MQTT. living is fine.