Skip to content

Thingspeak Read Last Value Fail #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
anthonyjclarke opened this issue Sep 23, 2018 · 8 comments
Closed

Thingspeak Read Last Value Fail #134

anthonyjclarke opened this issue Sep 23, 2018 · 8 comments
Labels

Comments

@anthonyjclarke
Copy link

anthonyjclarke commented Sep 23, 2018

8<------------------------ BUG REPORT -----------------------------------------

Expected behavior

Used to read last values from Thingspeak

Actual behavior

Returning Blank values

Now reading Ext Temp from Thingspeak

Requesting URL: /channels/294484/feeds.json?results=1&api_key=DLBZRS1W9WYYBP5P
.
Ext Temp =  - Humid = 

Test code

// add code here


const String THINGSPEAK_CHANNEL_ID = "294484";
const String THINGSPEAK_API_READ_KEY = "DLBZRS1W9WYYBP5P";

// These are Public - I'm ok to share :) just the temperature on my side deck on the house!

thingspeak.getLastChannelItem(THINGSPEAK_CHANNEL_ID, THINGSPEAK_API_READ_KEY);
  ext_temperature = thingspeak.getFieldValue(0);
  ext_humidity = thingspeak.getFieldValue(1);
  
  Serial.println("Ext Temp = "+ String(ext_temperature) +" - Humid = "+String(ext_humidity));

Weather Station version

Which branch are you on? If you know the Git revision then add it here as well.

Hardware

Describe whether you run the code on the ThingPulse Weather Station Color kit or on some custom hardware.

8<------------------------ END BUG REPORT -------------------------------------

@Matz88
Copy link

Matz88 commented Oct 11, 2018

same issue here, TSclient stopped working...

@marcelstoer
Copy link
Member

Instead we should maybe use the official lib https://github.com/mathworks/thingspeak-arduino

@Matz88
Copy link

Matz88 commented Oct 20, 2018

No...the official library is not a good choice because it retrieves only one field per connection then disconnects therefore the download time became worst case 8 times longer...

@karmacoma92
Copy link

Same issue, ....
Let me know if you need any further testing

@Matz88
Copy link

Matz88 commented Oct 20, 2018

I have temporarily solved not keeping the cycle till the client is connected, see the rows commented below, from ThingspeakClient.cpp

//while(client.connected()) {
while((size = client.available()) > 0) {
c = client.read();
if (c == '{' || c == '[') {
isBody = true;
}
if (isBody) {
parser.parse(c);
}
}
//}

It is working but it is not the best because now if the download from TS is faster than the parsing with Jason (I have noticed that the data are not coming all in one time), it is not completed and part of the value can be not updated... I would like to understand the reason why it is working only commenting out this check. Maybe TS has changed something...

@marcelstoer
Copy link
Member

Ahh, I see...The TS client is affected by the same as this 038c4da, read up on #140 for details.

@Matz88
Copy link

Matz88 commented Oct 20, 2018

I will try this fix too good to know, thanks

@marcelstoer
Copy link
Member

Just pushed a commit that fixes this for all files that were'n included in the previous commit: dddb014

Will be in the next release (1.6.4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants