-
Notifications
You must be signed in to change notification settings - Fork 639
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
"NTP server not reachable", compromises time-based features #452
Comments
The thing is that the NTP module has been heavily modified in the current dev branch and meant to be released with next version due to an update in the NTPClientLib library to support timezones with minutes and not only full hours. Germán has completely reworked the library and I'm even using a fork of it with some critical improvements to make it work smoothly with ESPurna. I'd suggest you to test the dev branch and provide feedback. But I don't think it makes sense to debug this issue over the old implementation. |
It looks like the "NTP server not reachable" compromises OTA updates. I have numerous devices that fails OTA updates and become corrupted (only upgradable by wired flashing), the NTP module also causes MQTT message delays. For now all my devices that are not time critical I compile without NTP to get them stable. |
There are two possible solutions for this:
The first option is simply changing this line: Line 38 in f8907d6
to:
Of course this should be done with a setting in general.h etc. |
Hi, Xose, can you post a list of all libraries that have a relation with NTP i found that all versions you compiled and that are in Releases don't have the issues I see with the once I compiled myself. I have these libraries installed: I'm starting to get the idea somehow I compile with a wrong Library |
You can check the exact version/revision of the libraries I use to compile the release images in the platformio.ini file: Lines 13 to 34 in f8907d6
The main difference is that I use a fork of German's library that introduces some improvements to the first sync with the NTP server. Likely to be your problem. I did a PR with the changes and German has already merged it but it's in his dev branch, not master yet. My fork also removes explicit dependency on the Margolis' Time library to use another fork of mine for that one since there is an issue compiling it in Windows machines. |
I spend a few hours experimenting with the "Error: NTP server not reachable" issue and found setting the NTP_TIMEOUT to 2000 in NtpClientLib.h solved the issue for me. With the setting on its original value of 1500 it was reasonable stable at my own local NTP server but not on any remote. Placed a issue in gmag11/NtpClient#56 |
I guess your mileage will vary but 2 seconds is plenty of time... Anyway it would be great if @gmag11 could make this setting configurable. |
Closing since there is nothing left to be done atm from the ESPurna point of view. Changes done here are staged for release. |
Originally reported by: P.B. (Bitbucket: PieBru, GitHub: PieBru)
Hi Xose, sorry for the partial #238 revival, but the problem persists randomly also in 1.12.1 and it may be crytical for time-based features.
When the error appears, usually immediately at boot, it doesn't recover until the next reset. If it depends on an external library a workaround could be force a reset after N consecutive NTP errors.
No benefits from NTP.setInterval(NTP_UPDATE_INTERVAL / 20, NTP_UPDATE_INTERVAL);
Despite the error, the time is initialized. I added this code at the bottom of loop():
and this is the OK output:
but often I get the NTP error (Wemos D1 Mini, default config):
This NTP error does not recover even after hours of successful Wifi and MQTT connection, so any time-based feature checking ntpConnected() would not work.
I didn't investigate further, as a trivial solution could be a forced reset.
Piero
The text was updated successfully, but these errors were encountered: