espruino / EspruinoHub

A BLE -> MQTT bridge for Raspberry Pi and other Embedded devices
Other
238 stars 62 forks source link

Binary data from BLE device's notification gets wrong encoding #111

Open kopierschnitte opened 1 year ago

kopierschnitte commented 1 year ago

I was struggeling about wrong binary values returned from one of my BLE endpoints. Somehow, they've been converted or encoded in a wrong way. This was an issue long time ago: #42

https://github.com/espruino/EspruinoHub/blob/9c9b817d8445b8b363b10c6ed3b6d621d206fb2e/lib/connect.js#L425

If I remove the "binary" argument of the conversion, the values are correct. At least for my use case. Maybe someone is facing similar problems ;-)

gfwilliams commented 1 year ago

Thanks for the update! Please could you let us know what the values were that you were having trouble with, and maybe what you saw on MQTT?

kopierschnitte commented 1 year ago

That's a little bit complicated: The device (pool chemical sensor) sent back 12 bytes (as expected) and the values were simply wrong. I saw nothing special in the logs, even with DEBUG enabled. I guess that the data got somehow treatend as UTF8?