time server

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
uxhamby
Normal user
Posts: 132
Joined: 29 Dec 2016, 18:13
Location: Toronto Canada

time server

#1 Post by uxhamby » 25 Aug 2018, 04:09

I just found one of my espeasy esp8266 clock's set to 1970 01 01, despite being NTP enabled with a known good NTP server address supplied.

24 hours ago this unit was sane and I was relying on it to turn on a patio light at sunset, which worked last night but not this evening.
Build
20102 - Mega
Libraries
ESP82xx Core 2_4_1, NONOS SDK 2.2.1(cfd48f3), LWIP: 2.0.3
GIT version
mega-20180809
Plugins
73 [Normal] [Testing] [Development]
Build time
Aug 9 2018 02:21:03
Binary filename
ESP_Easy_mega-20180809_dev_ESP8266PUYA_1024_VCC.bin
I tried all kind of obvious things like rebooting, changing the NTP server name, turning off NTP rebooting and then turning ntp back on again. Nothing 'soft' seemed to make any difference to the time setting.

Eventually I got up out of my chair and went down to hard reset the unit. Hard restart by a power cycle seemed to make the unit return to sanity.

I am wondering if:

A) Is this a known espeasy issue? (Is this perhaps more likely an issue with an ebay esp8266 from China?)

B) Is there is a guaranteed way to force an esp to check in with its appointed NTP server via the web interface?


Thanks,

Brian H,

TD-er
Core team member
Posts: 8748
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: time server

#2 Post by TD-er » 25 Aug 2018, 16:06

NTP is one of the few services for the ESP node to connect outside your own network.
So then it really needs a proper gateway address.
Also unless you've setup NTP to use an IP address, it also needs DNS.
Could it be the network settings have been changed?
Do you use static IP or DHCP?

hamster
Normal user
Posts: 62
Joined: 27 Sep 2015, 21:01
Location: UK

Re: time server

#3 Post by hamster » 25 Aug 2018, 16:12

I have the same issue, where the NTP loses time occasionally
Hence I do not rely on it to use it

I use a big timer in node red to post when its dark
Capture.PNG
Capture.PNG (63.6 KiB) Viewed 9753 times
this updates a dummy device as to whether its night or day
I then use a rule to make the switch

Code: Select all

on porchlighton do
if [dark#dark]=1
mcpgpio,1,1
timerSet,1,300
endon

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: time server

#4 Post by Shardan » 25 Aug 2018, 22:59

Hello all,

I think this is an issue with the ESP.
As only one device runs into problems all others running it is not very likely that
Internet or NTP server causes a problem.

For me it looks like the NTP client in the device was hanging.
It's not too surprising that rebooting does not help but power cycling does.
We all know this behaviour from our PC's sometimes, don't we?

This kind of behaviour can have a lot of different reasons.
Might be a bug in ESPEasy - not too likely as this would give a lot of complaints.
I don't think it's the chip either - ESP's all come from china and also there would be many complaints. Remember PUYA....?
Far more likely for me: Power supply. A brownout or a spike at the wrong moment may cause this.

So I'd wait if that occurs again. If so, I'd check the Environment around the ESP carefully
for things like power supply and other sources that may disturb the ESP.

Just BTW:
It is not a best practice to use external NTP servers for every single device in a local network.
If it's just one or two pc's it's ok, but today's networks usually hold a lot more devices.. (Tablet, smartphone, notebook, TV, IoT......)
The small time requests pile up to a big load at server side nowadays.
Check if your router has a built-in NTP service. A Fritz!Box for example has it. Many other home routers too.
These NTP servers can be set to pull time from one or (preferred) 2..4 external servers and give you a local NTP server for your network.
This has shown to be a very stable way to offer NTP to all devices in your local network.
Regards
Shardan

User avatar
uxhamby
Normal user
Posts: 132
Joined: 29 Dec 2016, 18:13
Location: Toronto Canada

Re: time server

#5 Post by uxhamby » 04 Sep 2018, 05:50

Well, it has happened again, same unit. This time cycling the power did nothing to correct the clock. I changed NTP servers and did a soft reboot and that cleared it up this time. I suspect a hardware fault of some kind with this particular ESP.

FWIW, here is what the logs said just after I re established correct time.
4385: Webserver: start
4534: Current Time Zone: DST time start: 2018-03-25 02:00:00 offset: -240 minSTD time start: 2018-10-28 03:00:00 offset: -300 min
4535: EVENT: Time#Initialized
4552: EVENT: Clock#Time=Mon,23:28
4703: MQTT : Intentional reconnect
4820: MQTT : Connected to broker with client ID: ESPClient_84:F3:EB:B3:53:D9
4820: Subscribed to: /Home/#
4822: EVENT: MQTT#Connected
6466: EVENT: Clock#Time=Mon,23:29
32021: WD : Uptime 1 ConnectFailures 0 FreeMem 11400
Thanks,

Brian H.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 50 guests