Hi Helge,
Just arrived home ...
I am not expert, but will try to help. I hope I can. I just edited:
-Readkey not needed, only private channels (My channel is public)
-Response edited only for less blank lines (note NaN 3,4 channels)
Try THIS code read MY channel to see what happens. Your channel is stopped for the last ~5 hours. 13:36:55 my local time. random number ... Check??
Then comment if sumi -- end to activate the email
t1 = datetime('now','TimeZone','America/Lima') % use your TimeZone What time is it "right now" (local) when running this
t = t1 - minutes(9) - seconds(second(t1))
% Hour 5 min less 00 sec i.e. before "right now"
% 'ReadKey','9KEQ8XZZZZZXNYD1WDOR3L'
[Data, Taim] = thingSpeakRead(58826,'numminutes',9, 'fields', [1,2,3,4])
% As I check every 5 minutes then I read the last 5 minutes
lin=length(Taim)
% How many lines in Taim array (if I send each minute must be 5 lines if all O.K.)
sumi=sum(Taim>t)
% Count how many lines in Taim array are "newer" than t i.e. data arrived
%So sumi tells me how many data points recognize ThingSpeak. Now tell me, in my case via SMS to my phone (regular 2G, no 3G needed)
if sumi<=5
response = webwrite('http://api.pushingbox.com/pushingbox?devid=vZZZZZ1104BF','data','tekstfeZZZZZke')
end
t1 =
19-May-2016 18:21:02
t =
19-May-2016 18:12:00
Data =
24.5000 66.2500 NaN NaN
24.4400 66.0900 NaN NaN
24.3400 66.2000 NaN NaN
24.3800 66.3500 NaN NaN
24.3800 66.4200 NaN NaN
24.2800 66.4600 NaN NaN
24.3100 66.4000 NaN NaN
24.3100 66.5400 NaN NaN
24.3800 66.3500 NaN NaN
Taim =
19-May-2016 18:12:10
19-May-2016 18:13:11
19-May-2016 18:14:12
19-May-2016 18:15:13
19-May-2016 18:16:15
19-May-2016 18:17:16
19-May-2016 18:18:17
19-May-2016 18:19:19
19-May-2016 18:20:20
lin =
9
sumi =
9