Closed Drasek closed 3 years ago
Thank you for writing the new decoders. Is there a reference for the mentioned hamonisation of valuenames? In most cases the payload temperature will contain ambient and not the cpu temperature. This can be misleading
Its just 2 values, one is "battery" (used in the plain decoder) which is now "voltage" (used in the packed decoder and now in both) and if you have a look in the if statement for port === 2 (plain decoder) there is the value named "temp" while it is the "cputemp" (packed decoder). It gets transmitted together with "uptime", "memory" - so we talk about the cpu or board temperature in this case and not the ambient temperature.
Thanks for your contribution! Unfortunately i am not yet into v3, need to find some time to dive in. Do your decoders work for v2 and v3, or is this a v3 only topic?
If they run with v2, shall we do a breaking change? Or offer them as additional option?
Its just 2 values, one is "battery" (used in the plain decoder) which is now "voltage" (used in the packed decoder and now in both) and if you have a look in the if statement for port === 2 (plain decoder) there is the value named "temp" while it is the "cputemp" (packed decoder). It gets transmitted together with "uptime", "memory" - so we talk about the cpu or board temperature in this case and not the ambient temperature.
Thank you for clarification. I did not realize that there is a difference between the two versions. When I first read it, I related the "harmonization" to the v3 stack.
The decoder only work for V3 (thats why i changed the name), i would add them into "src/TTN". In the first few lines inside the decoder, in the comment, there is a description where to put them on the v3 console (website). I can share a screenshot...
The new decoding function without content:
function decodeUplink(input) { return { data: { bytes: input.bytes }, warnings: [], errors: [] }; }
Now you get one object with port and bytes instead of two variables (v2) and as return value you can give warnings and errors as well. The functions i provide follow this new code and while i was at it is i ereased the differences between the plain and packed output. Ohh and i included one more decoding option for people who use the sds011 particle matter sensor with the paxcounter. the decoding from payloads containing this information was missing.
If TTN stay at their announcment: "Warning The Things Network is shutting down v2 clusters later this year. Start moving your applications and devices to a v3 cluster!" The breaking change will be forced by TTN. As far as i can see there are several services/integrations (TTN Mapper for Example) which does not work with v3 at the moment. Probably a new branch is an option. Espacially if there are more changes for the v3 specific documentation.
Added to new folder /src/TTNv3. Thanks for the contributing!
Hello Cyberman54,
the payload decoder in the things stack v3 works a bit different than the one in v2, so i do provide both decoders (packed and plain) further down. I made them V3 compatible and did harmonize some of the valuenames (battery -> voltage, temp -> cputemp) between both versions. I did include the converting faunctions into the decoder as well, because there is only one function in the backend in v3. I named them "packed_decodeUplink.js" and "plain_decodeUplink.js" after the new function, maybe you could commit them to this repo: