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 weeks ago

tofurky commented 2 weeks 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 1 week 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 1 week 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.