I have a Microchip LoRa Technology Mote on the TTN, but data is not showing, my Cayenne dashboard is not populating.
I can receive the data on my Android with MQTT dash, so TTN to MQTT works.
The DevEUI is 70696E6770696E67, can you check what’s wrong?
Thanks a lot
Werner
figured it out myself, forgot to put in the process ID in the TTN setup.
running fine now.
Thanks for updating us @wm1 !
~B
Same problem here. Data shows up in TTN, but not Cayenne dashboard. I have two devices in Cayenne and TTN.
Things Node Device EUI: 0004A30B001B7AB5
Things Uno Device EUI: 0004A30B001C02B2 (Added a DHT11 Temp and Humidty Sensor)
I have read through this thread and have two suspicions:
-
It has been mentioined that you must copy the Process ID from Cayenne to the TTN Cayenne Integration. I’m not actually sure what exactly needs to happen. There is no mention in the documentation.
-
It has also been mentioned that I must use a specific payload decoder so the data is in the correct format. I am using a simple Payload Function to the data is visible on the TTN console. If this is the case, can you give me the correct Payload Function. I read your documentation and am still a bit confused.
Things Uno Payload Function:
function Decoder(bytes, port) {
var temperature = ((bytes[0] << 8) | bytes[1]);
var humidity = ((bytes[2] << 8) | bytes[3]);
return {
humidity: humidity/100,
temperature: temperature/100
}
}
Things Node Payload Function:
function Decoder(bytes, port) {
var decoded = {};
var events = {
1: ‘setup’,
2: ‘interval’,
3: ‘motion’,
4: ‘button’
};
decoded.event = events[port];
decoded.battery = ((bytes[0] << 8) + bytes[1])/1000;
decoded.light = (bytes[2] << 8) + bytes[3];
if (bytes[4] & 0x80)
decoded.temperature = ((0xffff << 16) + (bytes[4] << 8) + bytes[5]) / 100;
else
decoded.temperature = ((bytes[4] << 8) + bytes[5]) / 100;
return decoded;
}
tagging @eptak for this.
While I don’t have it working yet, I found these docs and links that explain what I need to do:
Apparently, Cayenne expects the data bytes coming from the node to be formatted in a very specific way. This can be accomplished on the Arduino platform (The Things Uno in my case) using the CayenneLPP.h library that is included in TheThingsNetwork library. Here is the documentation and an example.
See documentation here: CayenneLPP | The Things Network, and example here: arduino-device-lib/CayenneLPP.ino at master · TheThingsNetwork/arduino-device-lib · GitHub
I allowed myself to be led astray because the Cayenne documentation here (Cayenne Docs) does not make any mention of the need for formatting the data in a very specfic way.
And it is working!
Here is the sketch I used with The Things Uno:
#include <TheThingsNetwork.h>
#include <CayenneLPP.h>
#include <DHT.h>
// Set your AppEUI and AppKey
const char *appEui = "xxxxxxxxxxxxxxxxx";
const char *appKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
#define loraSerial Serial1
#define debugSerial Serial
// Replace REPLACE_ME with TTN_FP_EU868 or TTN_FP_US915
#define freqPlan TTN_FP_US915
#define DHTPIN 2
//Choose your DHT sensor moddel
#define DHTTYPE DHT11
//#define DHTTYPE DHT21
//#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
TheThingsNetwork ttn(loraSerial, debugSerial, freqPlan);
CayenneLPP lpp(51);
void setup()
{
loraSerial.begin(57600);
debugSerial.begin(9600);
// Wait a maximum of 10s for Serial Monitor
while (!debugSerial && millis() < 10000)
;
debugSerial.println("-- STATUS");
ttn.showStatus();
debugSerial.println("-- JOIN");
ttn.join(appEui, appKey);
}
void loop()
{
debugSerial.println("-- LOOP");
float humidity = dht.readHumidity(false);
float temperature = dht.readTemperature(false);
debugSerial.print("Temperature: ");
debugSerial.println(temperature);
debugSerial.print("Humidity: ");
debugSerial.println(humidity);
lpp.reset();
lpp.addTemperature(1, temperature);
lpp.addRelativeHumidity(2, humidity);
// Send it off
ttn.sendBytes(lpp.getBuffer(), lpp.getSize());
delay(10000);
}
Nice to hear that you were able to find the solution on your own and now have a working project. can you share you projects with the community so t can be helpful for other users doing same project. Projects Made with Cayenne - myDevices Cayenne Community
Are there any simple ways to send Fahrenheit temperature data to a widget instead of Celsius? I know how to make the DHT11 read Fahrenheit, but I don’t see any CayenneLPP Arduino commands for sending it to a Cayenne widget through TTN.
on dashboard try changing the widget setting from Celsius to Fahrenheit.
I don’t see an option for changing the widget. That would be a simple solution. I will look again.
now change it and also change C to f in your code.
can you add debug lines in code to check out how many times the value is send.
I did not have to change my Arduino code in order to change data to Farenheit. I stilll need to send the data in C. I Changing the widget from C to F triggers a conversion.
Looking at my code in the TTN gateway,I can see that the data is only being sent once every 2 minutes. I don’t know where the duplication is, it it seems like it is within Cayenne.
let me check with the team.
Here is the same data at the same time as the duplicate screenshot I sent you yesterday. It no longer shows duplicates. I think the problem musat have been somewhere within Cayenne, but it is OK now.
So, I have clearly documented 2 dashboard problems that went away without me changing anything. As long as it doesn’t break again for me, I am happy. You may still want to look into it. I’ll let you know if the problem returns. Thanks so much for your help.
-
The dashboard did not show an option for changing the temperature type from F to C. Now it does.
-
The dashboard was showing duplicate data from my device. Now it doesn’t show duplicate for new or old data.
thank you @Tonylweil, and lets us know if you have any further problem.