[FIXED] Thingspeak publish template example

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
andy
Normal user
Posts: 65
Joined: 26 Jan 2016, 23:07

[FIXED] Thingspeak publish template example

#1 Post by andy » 07 Apr 2016, 19:21

Original Post:
I've been searching for example entries for the Publish Template to send data to a Thingspeak channel. So far all I've gotten is confused. :?

Anybody have a straight forward example of how this should be filled out? Maybe there's a wiki I haven't found?
Here’s how to do it:

ThingSpeak Configuration
1- Sign up with ThingSpeak
2- Create a channel
3- Create a chart for each ESP8266 output you want to record
4- Write down the Write API key

ESPEasy – Configuration
1- Set Protocol to ThingSpeak
2- Enter 184.106.153.149 as the Controller IP
3- Enter the Write API key from above into the Controller Password field

ESPEasy – Devices
1- Set the IDX/Variable for each task to the corresponding chart number in ThingSpeak. For instance, I have 1 entered for the Uptime task. This is how the data is routed to the correct chart.
2- If you have two readings for a given sensor, Temp will go the chart that matches the DHT IDX/Variable and Humidity will go to the IDX+1 chart. For instance, I have DHT11 set as IDX 5. In ThingSpeak, Temperature is displayed on chart 5 and Humidity on chart 6.

ESPEasy – Tools|Advanced
1- Set Message Delay (ms) to 15000
Last edited by andy on 11 Apr 2016, 22:56, edited 2 times in total.

andy
Normal user
Posts: 65
Joined: 26 Jan 2016, 23:07

Re: Thingspeak publish template example

#2 Post by andy » 08 Apr 2016, 22:39

Okay, slight brain fade on my part. I see there is a ThingSpeak protocol (see http://www.esp8266.nu/index.php/EasyPro ... ThingSpeak). I've added my API key and filled in the IP address and port as shown in the link. It's definitely writing something to ThingSpeak:
HTTP : connecting to 184.106.153.149 using port 80
HTTP/1.1 200 OK
HTTP : Succes!
Server: nginx/1.7.5
Date: Fri, 08 Apr 2016 20:37:07 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 2
Connection: close
Status: 200 OK
X-Frame-Options: ALLOWALL
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, OPTIONS, DELETE, PATCH
Access-Control-Allow-Headers: origin, content-type, X-Requested-With
Access-Control-Max-Age: 1800
ETag: "6f4922f45568161a8cdf4ad2299f6d23"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 44444265-86fa-4342-bba3-8213144578e9
Set-Cookie: request_method=POST; path=/

18
HTTP : closing connection
but I don't get any real data entered into any of my ThingSpeak charts.

For this test I'm recording System Events - Wifi strength, Uptime, and Free RAM - as the channels. Just not seeing any of this information appearing in my ThingSpeak charts.

Any suggestions out there?

andy
Normal user
Posts: 65
Joined: 26 Jan 2016, 23:07

Re: Thingspeak publish template example

#3 Post by andy » 11 Apr 2016, 19:08

Thanks to dduley for figuring this one out! :D

In ThingSpeak, you set up your channels as Field 1, Field 2, etc. You can add a name for each field, but the magic is the field number. You need to put the Field Number as the IDX/Variable for each device you want to chart.
ThingSpeak Configuration
ThingSpeak Configuration
Thingspeak Configuration.jpg (243.73 KiB) Viewed 16811 times

andy
Normal user
Posts: 65
Joined: 26 Jan 2016, 23:07

Re: Thingspeak publish template example

#4 Post by andy » 11 Apr 2016, 19:09

Here's what my ThingSpeak channel looks like:
Thingspeak Display.jpg
Thingspeak Display.jpg (135.04 KiB) Viewed 16811 times

andy
Normal user
Posts: 65
Joined: 26 Jan 2016, 23:07

Re: [FIXED] Thingspeak publish template example

#5 Post by andy » 11 Apr 2016, 19:46

Here's the ESPEasy Advanced setup:
ThingSpeak Advanced.jpg
ThingSpeak Advanced.jpg (229.16 KiB) Viewed 16805 times

andy
Normal user
Posts: 65
Joined: 26 Jan 2016, 23:07

Re: [FIXED] Thingspeak publish template example

#6 Post by andy » 11 Apr 2016, 19:47

Here's the ESPEasy Tasks setup:
ThingSpeak Tasks.jpg
ThingSpeak Tasks.jpg (230.4 KiB) Viewed 16805 times

andy
Normal user
Posts: 65
Joined: 26 Jan 2016, 23:07

Re: [FIXED] Thingspeak publish template example

#7 Post by andy » 11 Apr 2016, 19:49

Here's the ESPEasy Configuration page (I've edited out the API key, SSID & SSID Pword):
ThingSpeak Config1.jpg
ThingSpeak Config1.jpg (200.32 KiB) Viewed 16804 times

Zodiac69
Normal user
Posts: 85
Joined: 13 Jun 2016, 17:20

Re: [FIXED] Thingspeak publish template example

#8 Post by Zodiac69 » 03 Jul 2016, 15:57

Hi Andy

I am trying to connect to ThingSpeak, i used your example with my settings, but i get the following response on Debug:
HTTP : connecting to 184.106.153.149
HTTP/1.1 400 Bad Request
Server: nginx/1.7.5
Date: Sun, 03 Jul 2016 13:55:37 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: close
Status: 400 Bad Request
X-Frame-Options: ALLOWALL
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, OPTIONS, DELETE, PATCH
Access-Control-Allow-Headers: origin, content-type, X-Requested-With
Access-Control-Max-Age: 1800
Cache-Control: no-cache
X-Request-Id: f21bf833-e217-4478-9b40-1732e35a43f8
Set-Cookie: request_method=POST; path=/

1
0
0

HTTP : closing connection

Any idea where i can go looking?

andy
Normal user
Posts: 65
Joined: 26 Jan 2016, 23:07

Re: [FIXED] Thingspeak publish template example

#9 Post by andy » 06 Jul 2016, 19:43

A quick Google search turns up some recurring problems if you are sending more than 84 characters to ThingSpeak. See http://www.esp8266.com/viewtopic.php?f=8&t=1952 for a discussion on that. You may want to check the string length you're trying to send.

Zodiac69
Normal user
Posts: 85
Joined: 13 Jun 2016, 17:20

Re: [FIXED] Thingspeak publish template example

#10 Post by Zodiac69 » 06 Jul 2016, 19:54

Hi Andy

I only have one DHT22 connected to my unit.
Where can i see the string to determine if it is more than 84 characters?
I am using the standard ESPEasy R78

andy
Normal user
Posts: 65
Joined: 26 Jan 2016, 23:07

Re: [FIXED] Thingspeak publish template example

#11 Post by andy » 06 Jul 2016, 22:34

Okay, the R78 may be the problem. I'm using 105. If you look on the site now, you'll find version 108 is the latest stable version. Try uploading that and see if it helps.

Zodiac69
Normal user
Posts: 85
Joined: 13 Jun 2016, 17:20

Re: [FIXED] Thingspeak publish template example

#12 Post by Zodiac69 » 07 Jul 2016, 10:09

Hi Andy

Upgraded to R108, still the same error message

Zodiac69
Normal user
Posts: 85
Joined: 13 Jun 2016, 17:20

Re: [FIXED] Thingspeak publish template example

#13 Post by Zodiac69 » 08 Jul 2016, 17:24

Hi Andy

I just setup WireShark to listen to my ESP and it seems that it is not transmitting anything to ThingSpeak.
When i access the web setup, i can see the communications, but when it sits on the network "Talking" to ThingSpeak there is no packets shown by WireShark.

The Serial terminal is indicating there should be data, but it seems to be false???

Any idea where i can look?

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: [FIXED] Thingspeak publish template example

#14 Post by costo » 09 Jul 2016, 02:25

Probably you have to tick the box 'Send Data' in the task settings of your device.
(But I do not use thingspeak so I'm just guessing)

nicolas
New user
Posts: 3
Joined: 02 Jun 2017, 18:26

Re: [FIXED] Thingspeak publish template example

#15 Post by nicolas » 02 Jun 2017, 18:29

Can an admin make this thread a sticky, its Very useful.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 8 guests