That would be great indeed. Unfortunately, the payload functions expect an object as the result. When just trying to return an array of (modified) bytes, one cannot save the Decoder function:
function Decoder(bytes, port) {
return bytes;
}
Error(“Could not dry-run uplink on Handler: Decoder not valid: does not return an object”)
So, even if the payload functions are executed before the integration is invoked (I don’t know for Cayenne; they are certainly called for the Data Storage integration), then currently one cannot enhance/convert the node’s payload into a Cayenne LPP.
Great work TTN ! Thanks for pushing Cayenne LPP !
Per the JS decoder function, we are going to open source ou Cayenne LPP decoder.
We’ll be able to provide you the code then
Hi All, great discussion and great reads on Cayenne LPP.
Thank you so much…
I tried to combine the TTN Build your own Sensor Workshop, with an implementation of Cayenne LPP.
I think the payload looks ok, but Cayenne does not accept it, since on the dashboard I only see the RSSI and SNR.
Question:
Is there an cayenne LPP Decoder online available that I can feed my byte string and then see what I did wrong?
(My guess is that you’re missing xx 88 at the start of the last section, for GPS location. Any online decoder would fail as well, so is of little help…)
I first build a hardcoded message with the existing code
and then used the example functions to build up payload with the sensor data
and now it works!
I needed some reading on Hex Decimals and and Byte Array… and learned a lot.
Thanks for the nudge into the right direction
I have a TTN/Cayenne device integration. This device has a DHT11 sensor and the payload is in LPP format.
The application data in the TTN Console looks fine to me: 036700C804684400
channel 03, type 67, tempvalue: 20C and channel 04, type 68, humvalue: 34%
My problem; I only see the RSI and SNR widget in Cayenne and reading the answers in previous posts there must be something wrong with my payload but I have no idea. Anyone else?
// Check if there is not a current TX/RX job running
if (LMIC.opmode & OP_TXRXPEND) {
Serial.println(F(“OP_TXRXPEND, not sending”));
} else {
// Prepare upstream data transmission at the next possible time.
//LMIC_setTxData2(1, buffer, sizeof(buffer)/sizeof(buffer[0]), 0);
LMIC_setTxData2(1, buffer, 7, 0); //brute force
I’d really like to know this as well. Cayenne seems like a great tool and i want to use it but use more efficient payloads. The channel is inferred from the node ID, node sensor has a fixed structure so there is no need to repeat the meta data for the sensor data every time etc.
I have installed your library, copied your example changed the two keys and uploaded the code but i see not registration attemps in TTN or any data flowing.
The example in TheThingsNetwork Arduino library are specifically for Arduinos with the Microchip RN2xx3 module. With the 32u4 LoRa feather I’d suggest using LMiC. And then, indeed, you need to reverse the byte order.
Code is not very easy to read. Maybe use the lpp library in the sketch? TTN LPP GitHub . Check if message is received on gateway and application. If so try a manual upload of the data from console and see if it is received by mydevices.
…but it seems to me you’re not filling the whole buffer with data.
So, maybe something like:
LMIC_setTxData2(1, buffer, cursor, 0);
for (byte b = 0; b < cursor; b++) {
Serial.print(buffer[b]);
}
Also, if I understand your code formatting correctly then it seems the return cursor; exits the function prematurely (and Serial.println(F("Sending: ")); is never even invoked), but I’ll leave proper formatting to you, before asking again…
I made a CayenneLPP to JSON decoder (C++), but it could of course also be used as a start template for your own code.
Maybe it could be of use for some reading this topic