Hi
Yeah, the string could be a bit confusing.
"GET /api/timezone/europe/brussels HTTP/1.1\r\nHost: www.worldtimeapi.org\r\n\r\n" is the actual string, but I could have explained it a bit better.
I have a variable populated with a bit of your code (coz I was lazy and copied it) and then added the remaining structure.
First off we connect to the server, which in this case is www.worldtimeapi.org (thanks for finding that site, very handy to all I'm sure).
Once connected we then send the GET string as above which is made up of the following in a calculation:-
String variable Send which is already initialised with "GET /api/timezone/europe/brussels" (Send = "GET /api/timezone/europe/brussels")
We then add " HTTP/1.1\r\nHost: " (Send is now = "GET /api/timezone/europe/brussels HTTP/1.1\r\nHost: " )
We then add "www.worldtimeapi.org" (Send is now "GET /api/timezone/europe/brussels HTTP/1.1\r\nHost: www.worldtimeapi.org" )
We then add "\r\n\r\n" (Send is now "GET /api/timezone/europe/brussels HTTP/1.1\r\nHost: www.worldtimeapi.org\r\n\r\n" )
Using another calculation Len=Length$(Send) gives us the length of the Send string (74 bytes: note that \r and \n are single bytes not double so \r\n are two bytes, \r\n\r\n is four). It is very important to use this calculation as you must tell the server exactly how many bytes to expect.
You should try simulating as it allows you to see what is happening in real time. I can step through the chart reading the value of every variable as I go. You could instead enable the UART and send out "Status" messages at key points such as "Connecting to SSID - " before you attempt connecting and then "OK if successful or such like.
I only have this as a "one-shot", needing a reset to rerun the code (pressing button on chip) but you can of course modify to do anything. As the site is free and not for commercial use, there may be restrictions on how many times you will be allowed to connect in a given time frame and it isn't guaranteed to actually be available, but I think it's great for hobby purposes. I think Benj mentioned somewhere in a previous post that the RTC inside the ESP32 wasn't too accuarate, but if updating every hour then it keeps time well enough.
Hope this helps.
Regards
ESP32 no reply: SSL/TLS connection failed (worldtimeapi.org)
-
- Valued Contributor
- Posts: 1528
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 353 times
- Been thanked: 549 times
-
- Valued Contributor
- Posts: 1528
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 353 times
- Been thanked: 549 times
Re: ESP32 no reply: SSL/TLS connection failed (worldtimeapi.org)
Hi
Just a thought. As you are using an ESP32 you could maybe use the RTC component for such, found under Component Linbraries / Storage. Initialise, connect to your SSID, then using the component macro "QueryTimeServer" and then GetTimeString.
You can add in offsets for GMT+1 etc. It won't provide location or the like but maybe still good enough for your needs?
Regards
Just a thought. As you are using an ESP32 you could maybe use the RTC component for such, found under Component Linbraries / Storage. Initialise, connect to your SSID, then using the component macro "QueryTimeServer" and then GetTimeString.
You can add in offsets for GMT+1 etc. It won't provide location or the like but maybe still good enough for your needs?
Regards
Re: ESP32 no reply: SSL/TLS connection failed (worldtimeapi.org)
Thank you, I use the RTC component often, but the calculation for DST or leapyear/weekday is a bit much work.
It is my goal to read all these parameters from the API.
It is my goal to read all these parameters from the API.
chipfryer27 wrote: ↑Sat Dec 28, 2024 9:01 amHi
Just a thought. As you are using an ESP32 you could maybe use the RTC component for such, found under Component Linbraries / Storage. Initialise, connect to your SSID, then using the component macro "QueryTimeServer" and then GetTimeString.
You can add in offsets for GMT+1 etc. It won't provide location or the like but maybe still good enough for your needs?
Regards
Re: ESP32 no reply: SSL/TLS connection failed (worldtimeapi.org)
Thank you once again!
I almost literally copied your code and inserted it into a stripped-down version of one of my charts.
I deleted almost all the code from my project, leaving only the part for the display (ILI9488).
Then, I practically pasted your code into this stripped-down project.
Still no clear response, even though I was receiving data via UART with your code.
However, the UART data I’m reading is as follows:
This is not what I get from the website: http://worldtimeapi.org/api/ip
Then, I modified your project and added only a display.
I left the rest of the code untouched, but again, no usable data.
After that, I redirected the response from NetworkComms Receive to the UART, but it reads nothing.
There’s a good chance my WiFi reception isn’t working properly, but in my own version, I’ve added checks for this, and they indicate the connection is established correctly.
This little project is driving me almost to despair
I’ve also modified the GET request to /api/ip, but this gives the same result.
I think I’ll set it aside for now because this seems like such a simple project, but it has already cost me a lot of time.
Chipfryer27, once again my deepest gratitude for all your responses and the effort you put in.
I almost literally copied your code and inserted it into a stripped-down version of one of my charts.
I deleted almost all the code from my project, leaving only the part for the display (ILI9488).
Then, I practically pasted your code into this stripped-down project.
Still no clear response, even though I was receiving data via UART with your code.
However, the UART data I’m reading is as follows:
Code: Select all
23:23:07.523 ->
23:23:07.557 ->
23:23:07.557 ->
23:23:07.557 -> Time Zone =
23:23:07.557 -> Day of Week = 9
23:23:07.557 -> Day of Year = 9
23:23:07.557 -> Date and Time =
Then, I modified your project and added only a display.
I left the rest of the code untouched, but again, no usable data.
After that, I redirected the response from NetworkComms Receive to the UART, but it reads nothing.
There’s a good chance my WiFi reception isn’t working properly, but in my own version, I’ve added checks for this, and they indicate the connection is established correctly.
This little project is driving me almost to despair

I’ve also modified the GET request to /api/ip, but this gives the same result.
I think I’ll set it aside for now because this seems like such a simple project, but it has already cost me a lot of time.
Chipfryer27, once again my deepest gratitude for all your responses and the effort you put in.
chipfryer27 wrote: ↑Sat Dec 28, 2024 6:53 amHi
Yeah, the string could be a bit confusing.
"GET /api/timezone/europe/brussels HTTP/1.1\r\nHost: www.worldtimeapi.org\r\n\r\n" is the actual string, but I could have explained it a bit better.
I have a variable populated with a bit of your code (coz I was lazy and copied it) and then added the remaining structure.
First off we connect to the server, which in this case is www.worldtimeapi.org (thanks for finding that site, very handy to all I'm sure).
Once connected we then send the GET string as above which is made up of the following in a calculation:-
String variable Send which is already initialised with "GET /api/timezone/europe/brussels" (Send = "GET /api/timezone/europe/brussels")
We then add " HTTP/1.1\r\nHost: " (Send is now = "GET /api/timezone/europe/brussels HTTP/1.1\r\nHost: " )
We then add "www.worldtimeapi.org" (Send is now "GET /api/timezone/europe/brussels HTTP/1.1\r\nHost: www.worldtimeapi.org" )
We then add "\r\n\r\n" (Send is now "GET /api/timezone/europe/brussels HTTP/1.1\r\nHost: www.worldtimeapi.org\r\n\r\n" )
Using another calculation Len=Length$(Send) gives us the length of the Send string (74 bytes: note that \r and \n are single bytes not double so \r\n are two bytes, \r\n\r\n is four). It is very important to use this calculation as you must tell the server exactly how many bytes to expect.
You should try simulating as it allows you to see what is happening in real time. I can step through the chart reading the value of every variable as I go. You could instead enable the UART and send out "Status" messages at key points such as "Connecting to SSID - " before you attempt connecting and then "OK if successful or such like.
I only have this as a "one-shot", needing a reset to rerun the code (pressing button on chip) but you can of course modify to do anything. As the site is free and not for commercial use, there may be restrictions on how many times you will be allowed to connect in a given time frame and it isn't guaranteed to actually be available, but I think it's great for hobby purposes. I think Benj mentioned somewhere in a previous post that the RTC inside the ESP32 wasn't too accuarate, but if updating every hour then it keeps time well enough.
Hope this helps.
Regards
-
- Valued Contributor
- Posts: 1528
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 353 times
- Been thanked: 549 times
Re: ESP32 no reply: SSL/TLS connection failed (worldtimeapi.org)
Hi
Try this
You need to provide credentials for variables SSID and Pword.
The string associated with the GET is a predefined variable called Send and the server we connect to is predefined as Host.
This chart outputs Status Messages on the UART and any associated response. For example "CONNECT TO SSID - " followed by "OK" if successful. Note that any status message we send is in capitals to easily differentiate from other ESP "dump" data.
If you download, then run a terminal program and reboot your ESP (in my case press the button) you will get a data dump interspersed with our "status messages". If successful we will print out the reply from the server then extract relevant data.
Below is a copy of mine and anything highlighted in yellow is associated with our status and reply.
Hopefully this may help to identify where things are going wrong for you.
Regards
Try this
You need to provide credentials for variables SSID and Pword.
The string associated with the GET is a predefined variable called Send and the server we connect to is predefined as Host.
This chart outputs Status Messages on the UART and any associated response. For example "CONNECT TO SSID - " followed by "OK" if successful. Note that any status message we send is in capitals to easily differentiate from other ESP "dump" data.
If you download, then run a terminal program and reboot your ESP (in my case press the button) you will get a data dump interspersed with our "status messages". If successful we will print out the reply from the server then extract relevant data.
Below is a copy of mine and anything highlighted in yellow is associated with our status and reply.
Hopefully this may help to identify where things are going wrong for you.
Regards
Re: ESP32 no reply: SSL/TLS connection failed (worldtimeapi.org)
Hi there, thanks again.
Here is my logfile.
Here is my logfile.
chipfryer27 wrote: ↑Sun Dec 29, 2024 11:15 amHi
Try this
MJU20_Time_Machine_ESP32_test.fcfx
You need to provide credentials for variables SSID and Pword.
The string associated with the GET is a predefined variable called Send and the server we connect to is predefined as Host.
This chart outputs Status Messages on the UART and any associated response. For example "CONNECT TO SSID - " followed by "OK" if successful. Note that any status message we send is in capitals to easily differentiate from other ESP "dump" data.
If you download, then run a terminal program and reboot your ESP (in my case press the button) you will get a data dump interspersed with our "status messages". If successful we will print out the reply from the server then extract relevant data.
Below is a copy of mine and anything highlighted in yellow is associated with our status and reply.
Log-File.pdf
Hopefully this may help to identify where things are going wrong for you.
Regards
-
- Valued Contributor
- Posts: 1528
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 353 times
- Been thanked: 549 times
Re: ESP32 no reply: SSL/TLS connection failed (worldtimeapi.org)
Hi
OK, you are connecting to the server but aren't getting a reply, or more likely timing out before receiving.
Try increasing the delay after sending the "GET" from 250mS to 350mS. Over the internet latency can be problematic, especially so if using cellular or satellite services. If still nothing in the reply try increasing again.
Regards
OK, you are connecting to the server but aren't getting a reply, or more likely timing out before receiving.
Try increasing the delay after sending the "GET" from 250mS to 350mS. Over the internet latency can be problematic, especially so if using cellular or satellite services. If still nothing in the reply try increasing again.
Regards
Re: ESP32 no reply: SSL/TLS connection failed (worldtimeapi.org)
I have played (and I’m not exaggerating) maybe 100 different versions of this project.
I’ve tried every suggestion you’ve made, but still no reply.
Are you using the latest version of the components? WiFi/NetworkComm?
This project feels cursed!
I have recent projects that successfully use GET requests for other APIs, so I know they work without any issues.
The only thing I can’t get working is this damn Time API!
I wish I could monitor the exact data being sent and received after the NetworkComm component.
That way, I could see the precise request being generated and the response coming back.
I know my WiFi is working perfectly. I also know that GET requests in previous projects work fine.
It’s just this GET call that seems cursed...
Chipfryer27: I sincerely hope you’re having a great time ringing in the New Year!
I’ve tried every suggestion you’ve made, but still no reply.
Are you using the latest version of the components? WiFi/NetworkComm?
This project feels cursed!

I have recent projects that successfully use GET requests for other APIs, so I know they work without any issues.
The only thing I can’t get working is this damn Time API!
I wish I could monitor the exact data being sent and received after the NetworkComm component.
That way, I could see the precise request being generated and the response coming back.
I know my WiFi is working perfectly. I also know that GET requests in previous projects work fine.
It’s just this GET call that seems cursed...
Chipfryer27: I sincerely hope you’re having a great time ringing in the New Year!
-
- Valued Contributor
- Posts: 1528
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 353 times
- Been thanked: 549 times
Re: ESP32 no reply: SSL/TLS connection failed (worldtimeapi.org)
Hi
Try this
Previously we saw you didn't get a reply but I hadn't included seeing what we sent. As before include SSID/Pword etc.
As before I highlighted my log, but this time only the area of interest. Green is what will be sent to the server only if we connect to SSID and Open a socket etc with yellow as any reply etc.
Regards
EDIT.....
I have that delay between sending and looking for reply through force of habit when using AT on ESP8266 devices and it is unecessary really as you can set timeout in the ReceiveReply component. I find it handy to include though as often I'm over satellite / cell links that can have a lot of latency. I tried it with no delay (relying on component timeout of 750mS) up to 1200mS (still with component delay) and got results.
Try this
Previously we saw you didn't get a reply but I hadn't included seeing what we sent. As before include SSID/Pword etc.
As before I highlighted my log, but this time only the area of interest. Green is what will be sent to the server only if we connect to SSID and Open a socket etc with yellow as any reply etc.
Regards
EDIT.....
I have that delay between sending and looking for reply through force of habit when using AT on ESP8266 devices and it is unecessary really as you can set timeout in the ReceiveReply component. I find it handy to include though as often I'm over satellite / cell links that can have a lot of latency. I tried it with no delay (relying on component timeout of 750mS) up to 1200mS (still with component delay) and got results.