Posted: 10:29pm 16 Apr 2024 Copy link to clipboard
OA47 Guru
When I use "WEB NTP +10" and get the message "got ntp response: 17/04/2024 08:26:04" how do I access this info to set the RTC? or does it automatically update the Time$ and Date$ and I can use that to RTC SETTIME ?
0A47 Edited 2024-04-17 08:34 by OA47
Posted: 10:34pm 16 Apr 2024 Copy link to clipboard
TassyJim Guru
No need. That should happen automatically. I haven't tried with an external RTC but it works for the built-in RTC.
Jim
Posted: 10:56pm 16 Apr 2024 Copy link to clipboard
phil99 Guru
After "got ntp response: 17/04/2024 08:26:04" has set Time$ and Date$ do:-
RTC SETTIME DateTime$(now)
Posted: 10:58pm 16 Apr 2024 Copy link to clipboard
OA47 Guru
Thanks Jim, on thinking about it, I dont think I need an external RTC if I can keep the clock updated from the WEB.
Posted: 11:34pm 16 Apr 2024 Copy link to clipboard
OA47 Guru
Thanks Phil, I will try to remember DateTime$(Now)
0A47
Posted: 12:41am 17 Apr 2024 Copy link to clipboard
OA47 Guru
Can someone help me with this response?
"[CYW43] do_ioctl(2, 263, 16): timeout"
I believe it is related to the WEB NTP command.
0A47
Posted: 05:07am 17 Apr 2024 Copy link to clipboard
Malibu Senior Member
...is a problem I've been chasing for ages, but it's not just restricted to the NTP command. Can't narrow it down any more than that for you, sorry... I'm still trying to nut the 'inner workings' out thus far...
Posted: 05:32am 17 Apr 2024 Copy link to clipboard
OA47 Guru
Thanks Malibu I will plod on.
0A47
Posted: 05:39am 17 Apr 2024 Copy link to clipboard
OA47 Guru
Here is my next stumbling block:
mm.ver=5.08
Dim Web$="api.openweathermap.org" Const Key="???????????????????????????" Const Query="GET/data/2.5/WEATHER?q=Paris,fra&APPID="+Key+Chr$(13)+Chr$(10)
Dim buff%(4096/8) Dim temp
WEB OPEN TCP CLIENT Web$, 80 WEB TCP CLIENT REQUEST Query, buff%() WEB CLOSE TCP CLIENT
Posted: 07:21am 17 Apr 2024 Copy link to clipboard
TassyJim Guru
GET /data
You need a space between GET and the /
and the returned temperature might be in Kelvin so -273
Jim Edited 2024-04-17 17:22 by TassyJim
Posted: 07:38am 17 Apr 2024 Copy link to clipboard
Mixtel90 Guru
"[CYW43] do_ioctl(2, 263, 16): timeout" was a problem for me too. I don't think it's WEB NTP though as you can trap a connection error there very effectively (and connections usually work first time for me). IIRC it was related to using Telnet and I had to shut Tera Term down and reconnect. (It was just one of the problems so I may be confused about what I did in each case!).
Most problems needed a reset button on the Pico W.
Posted: 08:19am 17 Apr 2024 Copy link to clipboard
OA47 Guru
Thanks Mick.
Thanks Jim, I re-inserted the space after GET and the error is no longer but the string returned is still empty.
Print Json$(buff%(),"main.temp")
Does not print anything
Where would I find a list of the key words that should be stored in the string? 0A47 Edited 2024-04-17 18:22 by OA47
Posted: 08:25am 17 Apr 2024 Copy link to clipboard
matherp Guru
add the line
LONGSTRING PRINT buff%()
Then you can see what, if anything, has been received
Posted: 08:38am 17 Apr 2024 Copy link to clipboard
OA47 Guru
Thanks Peter, I found the list of JSON words on the website and somewhere along the line I had typed the word weather in caps and that wasn't liked.
I am making progress again 0A47
tcp address 38.89.70.158 Connected {"coord":{"lon":-80.6081,"lat":28.0836},"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02n"}],"base":"stations","main":{"temp":294.09,"feels_like":294.35,"temp_min":290.39,"temp_max":296.46,"pressure":1020,"humidity":81},"visibility":10000,"wind":{"speed":4.63,"deg":130},"clouds":{"all":20},"dt":1713343124,"sys":{"type":1,"id":4922,"country":"US","sunrise":1713351278,"sunset":1713397720},"timezone":-14400,"id":4163971,"name":"Melbourne","cod":200} Current Temp 21.09 degrees
Edited 2024-04-17 18:41 by OA47
Posted: 02:46pm 17 Apr 2024 Copy link to clipboard
NPHighview Senior Member
OA47: Very nice!
Are you using openweathermap's free 1,000 calls per day service?
This looks like a very nice addition to a digital clock app, now that you've worked out the bulk of the bugs :-)
Posted: 10:32pm 17 Apr 2024 Copy link to clipboard
but I cannot get the syntax correct. Further from the site.
I have tried using "weather.main" and "weather.description" but I only get a blank.
Ideas please. 0A47 Edited 2024-04-18 08:41 by OA47
Posted: 11:30pm 17 Apr 2024 Copy link to clipboard
lizby Guru
From some effort two and a half years ago, I have
Print json$(m%(),"weather[0].description")
If I recall correctly, the [0] is because of the square brackets following "weather:".
Posted: 11:33pm 17 Apr 2024 Copy link to clipboard
OA47 Guru
Thankyou very much lizby that fixed the problem for "weather.main" and "weather.description"
0A47 Edited 2024-04-18 09:38 by OA47
Posted: 12:14am 18 Apr 2024 Copy link to clipboard
OA47 Guru
NPHighwiew,
Is this what you were thinking?
0A47
Posted: 01:37am 18 Apr 2024 Copy link to clipboard
NPHighview Senior Member
Almost exactly! I have an analog clock, patterned after Swiss railway clock face, and will be very happy to add this to it. It picks up UTP once an hour. I think picking up weather once every 5 to 15 minutes to stay well below the 1k per day charge limit.