ThingSpeak Integration Assistance

I’ve set up my first LoRa device and managed to transfer the data to TTN correctly. I’m using ttn-handler-eu. My “Payload Formats” code correctly interprets the data. Decoder returns a JSON object with the 4 fields shown, all 4 values are numbers, I’ve crosschecked that:
TTNpostImage

I’ve set up ThingSpeak integration according to the relevant documentation. Field names, channelId, write API key do match. ThingSpeak channel does get all the messages, I can follow that based on the “Entries” counter-field and on the “Last entry” time-field of the ThingSpeak screen. No data are shown on the graphs, however, and the payload fields are empty in the CSV file downloaded from ThingSpeak.
Manual write with the write API key was successful, the datapoint appeared everywhere.
Manual read shows, that ThingSpeak gets the names of the fields, instead of their values:
request: https://api.thingspeak.com/channels/1271033/fields/1.json?results=2
answer:{“id”:1271033,“name”:“realthch”,“description”:“TTN2SP”,“latitude”:“0.0”,“longitude”:“0.0”,“field1”:“studentid”,“field2”:“count”,“field3”:“temperature”,“field4”:“humidity”,“created_at”:“2020-12-28T00:20:30Z”,“updated_at”:“2020-12-28T03:10:34Z”,“last_entry_id”:84},“feeds”:[{“created_at”:“2021-01-03T14:30:46Z”,“entry_id”:83,“field1”:null},{“created_at”:“2021-01-03T14:35:48Z”,“entry_id”:84,“field1”:null}]}
(The “entry_id” on ThingSpeak is higher than on TTN, because I had some counter resets previously.)

Please give me a hint, what can cause the above phenomenon, how can I correct it.

Everything seems to be in order on the TTN side of things right up to the JS decoder with fields and values - perhaps you should make enquiries on the ThingSpeak forum?

Thank you for the confirmation. Wherever I’ve searched (Google, this forum, ThingSpeak forum) I’ve only found two potential reasons, none of which holds in my case:

  • decoder outputs string values
  • people using the meshed server in Australia had this problem, which suddenly healed after an update of that server. I will wait for a miracle to happen in Europe as well :slight_smile:
    In the meantime I can download my data directly from TTN manually for analysis, using the storage integration’s swagger document.
    (I’ve realized, that the data feed is in fact NULL. The above query contains field1 only, but it is null for all four fields. This does not bring me closer to the solution, though.)

I’m not sure that has any bearing whatsoever on this issue. You are getting the payload to the device data tab and in to data storage - it would appear to be an issue with the transfer of the information to ThingSpeak.

Can you expand upon this - you appear to have a JavaScript decoder working from the screen shots above, what is it you get from the Data Storage feed?

When I enter the Storage integration and click on “Platform”, it brings me to a swagger page. There I can do a manual authorization by copying my application’s access key. I can use the “try it out” feature of swagger then, which provides me my data in JSON format. Everything is perfect here. This is a small slice, I can retrieve my data several days back:
StrorageIntegrationS

If I query Thing speak (all fields) it returns nulls for the very same messages (identify the message based on the timestamp):
request: https://api.thingspeak.com/channels/1271033/feeds.json?results=2
answer: {“channel”:{“id”:1271033,“name”:“realthch”,“description”:“TTN2SP”,“latitude”:“0.0”,“longitude”:“0.0”,“field1”:“studentid”,“field2”:“count”,“field3”:“temperature”,“field4”:“humidity”,“created_at”:“2020-12-28T00:20:30Z”,“updated_at”:“2021-01-06T20:10:08Z”,“last_entry_id”:333},“feeds”:[{“created_at”:“2021-01-07T08:33:03Z”,“entry_id”:332,“field1”:null,“field2”:null,“field3”:null,“field4”:null},{“created_at”:“2021-01-07T08:38:05Z”,“entry_id”:333,“field1”:null,“field2”:null,“field3”:null,“field4”:null}]}

The link between TTN and ThingSpeak is a black box for me, I am not able to debug it.

Looks like you may have to name the fields “Field1”, “Field2” etc. See: LMIC Unknown event: 20

2 Likes

YEEESSSS!

Just with lowercase f. I’ve changed the field names in my decoder while my device was sending and the data started to appear in ThingSpeak.
Thanks a lot for your support.

I recommend making the field naming restriction explicit in the relevant documentation to help other newbies (https://www.thethingsnetwork.org/docs/applications/thingspeak/).

1 Like

At the top right of the page you will find the ‘edit index.md’ string, if you use that you’re able to make the changes yourself (and generate a pull request to have then integrated).

I aim to please. Sometime I hit the target!

2 Likes