jantenhove / GoodWeLogger

ESP8266 based logger for GoodWe inverters. Can upload to pvoutput and publishes MQTT topics
GNU General Public License v3.0
98 stars 24 forks source link

Time is requested over NTP every minute, overkill? #22

Closed ThinkPadNL closed 5 years ago

ThinkPadNL commented 5 years ago

I was sniffing with tcpdump on my network, when i found out that the GoodWeLogger is requesting time over NTP every minute.

Proof:

me@EdgeRouterX:~$ sudo tcpdump dst port 123 -i switch0.6                                                                                                 
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on switch0.6, link-type EN10MB (Ethernet), capture size 262144 bytes
10:51:40.521114 IP 192.168.6.27.1337 > <redacted-for-privacy-of-server-owners>.ntp: NTPv4, Client, length 48
10:52:40.516794 IP 192.168.6.27.1337 > <redacted-for-privacy-of-server-owners>.ntp: NTPv4, Client, length 48
10:53:40.521509 IP 192.168.6.27.1337 > <redacted-for-privacy-of-server-owners>.ntp: NTPv4, Client, length 48
10:54:40.523239 IP 192.168.6.27.1337 > <redacted-for-privacy-of-server-owners>.ntp: NTPv4, Client, length 48
10:55:40.517112 IP 192.168.6.27.1337 > <redacted-for-privacy-of-server-owners>.ntp: NTPv4, Client, length 48

I know these IoT devices (ESP8266) are prone to timedrift because they have no realtime clock (RTC) but every minute seems like a bit overkill to me. Shouldn't once per hour also be enough? For now i redirected the NTP-requests with a DNAT rule in my router (EdgerouterX) so that the router answers these queries (it offers NTP) instead of forwarding them to external NTP-servers.

P.S. The NTP-address isn't configurable right now from the Settings.h , maybe change that also when looking into this. It is now hardcoded in GoodWeLogger.ino line 24