Replies: 3 comments 4 replies
-
Currently Theengs Decoder isn't able to specify how to decode dynamic structures. So we would probably need some changes in Theengs Decoder before a SensorBug decoder can be implemented. We have the same issue with the BTHome format. Maybe you could work around it by trying to check all possible orders of the three properties, but I guess that would make the decoder quite complex. |
Beta Was this translation helpful? Give feedback.
-
Thanks @NateEaton I implemented this now, based on your script above, as a script, pre-commit hook and GitHub Actions job in the decoder repository: #380 |
Beta Was this translation helpful? Give feedback.
-
Glad to be able to help!
…On Thu, Jun 29, 2023 at 10:16 AM Koen Vervloesem ***@***.***> wrote:
Thanks @NateEaton <https://github.com/NateEaton> I implemented this now,
based on your script above, as a script, pre-commit hook and GitHub Actions
job in the decoder repository: #380
<#380>
—
Reply to this email directly, view it on GitHub
<#255 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABNGQYOSLFFG2LUTXOYC2TXNWL45ANCNFSM6AAAAAATWD52DA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I have a device that's likely not something widely used (SensorBug, reports temperature, light level and accelerometer data) but I've previously adopted other code to add a worker for it to bt-mqtt-gateway and now I'm in the process of switching over to Theengs Gateway so I'm looking into creating a decoder for it.
I've already drafted a json structure that includes property for battery level. For the other three, one challenge is that while they are included in the manufacturer data, it's a dynamic structure: three properties but can be in any order so for a given property (e.g., light) it takes checking the code in first position and if it indicates that property, decode using the next few bytes but otherwise checking further into the dynamic data block, iterating till finding the code for that property.
It's complicated a bit because for one property the data can be either 2 or 3 bytes so there is another check to do before decoding.
Just thought before I charge ahead and risk ending up thrashing about for days on this I would check in for suggestions.
Here's the spec for the device:
http://www.blehome.com/SensorBug%20Interface%20Specification%20v1.3.0.0a.pdf
Also, a question on creating a decoder: is there a specific tool/technique for going from raw json to the c++ const char* with escaped quotes?
Beta Was this translation helpful? Give feedback.
All reactions