weewx crash for EcowittHttp driver if network is unavailable

62 views
Skip to first unread message

Michael Waldor

unread,
Aug 5, 2026, 2:18:32 AM (6 days ago) Aug 5
to weewx-user
Of course the driver EcowittHttp relies on a working network connection. But during boot weewx might be started too early before network is up. In that exceptional  case weewx will crash:

CRITICAL __main__: **** File "/etc/weewx/bin/user/ecowitt_http.py", line 6775> CRITICAL __main__: **** if self.collector.device.model is not None: CRITICAL __main__: **** File "/etc/weewx/bin/user/ecowitt_http.py", line 13722> CRITICAL __main__: **** version_data = self.api.get_version() CRITICAL __main__: **** File "/etc/weewx/bin/user/ecowitt_http.py", line 7224> CRITICAL __main__: **** raise DeviceIOError(f"Failed to obtain 'get_version' data: {e}")> CRITICAL __main__: **** user.ecowitt_http.DeviceIOError: Failed to obtain 'get> CRITICAL __main__: **** Exiting.

I myself have resolved that issue on my raspberry pi4 by enabling "wait on network" before starting other services.

John Smith

unread,
Aug 5, 2026, 7:21:49 AM (6 days ago) Aug 5
to weewx...@googlegroups.com
Do you have loop_on_init = True at the top of your weewx.conf file?

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/weewx-user/8abdb32e-9590-40c9-9649-664daaafd85cn%40googlegroups.com.

Michael Waldor

unread,
Aug 5, 2026, 7:30:22 AM (6 days ago) Aug 5
to weewx...@googlegroups.com
Yes. And that's necessary because typically the driver gets a connection only after its second try.

W.r.t. the error message/crash: This only happens IF IP network is not available (I now avoid that situation by an improved systemd setup of my raspberry pi4). Otherwise there is no such crash. Thus a fix is not really mandatory, it's only recommended to improve on sane error recovery.

You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/yhzIxvDzpy8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/weewx-user/CAGTinV7sD6FCXFZkz0ThEnmZ8V89omRg-v-A7SLRGr%2Bx99uvoQ%40mail.gmail.com.

John Smith

unread,
Aug 5, 2026, 7:38:20 AM (6 days ago) Aug 5
to weewx...@googlegroups.com
If you're using systemd and once the network recovers things work again just do the following

systemctl edit weewx.service 

[Unit]
...
StartLimitIntervalSec=0

[Service]
...
WatchdogSec=2s
Restart=always
RestartSec=2s

Then systemd will just keep trying to load the program until manually stopped

John Smith

unread,
Aug 5, 2026, 7:42:13 AM (6 days ago) Aug 5
to weewx...@googlegroups.com
Alternatively I have the following service file that does a ping and if it succeeds mounts network shares, maybe some combination might work for you

[Unit]
Description=Mount NFS shares if 192.168.1.1 is pingable
After=network-online.target
Wants=network-online.target

[Service]
Type=oneshot
RemainAfterExit=yes

ExecStartPre=/bin/ping -c1 -W1 192.168.1.1

ExecStart=/bin/mount -t nfs ...
ExecStart=/bin/mount -t nfs ...
ExecStart=/bin/mount -t nfs ...

ExecStop=/bin/umount /media/smb1
ExecStop=/bin/umount /media/smb2
ExecStop=/bin/umount /media/smb3

[Install]
WantedBy=multi-user.target

Michael Waldor

unread,
Aug 5, 2026, 9:03:57 AM (6 days ago) Aug 5
to weewx-user
Thanks for your hints. But I only had to engage "wait for network" within my raspberry operating system osmc to resolve my problem.
I'd only suggest to improve EcowittHttp to handle such exceptional situations to avoid crashes.

matthew wall

unread,
Aug 5, 2026, 9:45:47 AM (6 days ago) Aug 5
to weewx...@googlegroups.com
this behavior is by design. when a driver fails during initialization, it is *supposed* to fail hard - that way you can figure out what is happening and fix it.

in this particular case, the solution is to either set "loop_on_init=True", or fix your system configuration so that networking is established before weewx starts up.

details:

there are some drivers and weewx installations that never use networking. in those cases, they do not need the system to have networking before weewx starts.

there are some installations of the ecowitt driver that are bound to a specific ip address, others use the discovery option to automatically find an ecowitt station on the network. there are some installations that have multiple weewx instances, each of which talks to a different ecowitt station. this requires binding to an address instead of discovery. in the binding case, it is useful to have the driver fail hard when it cannot contact the ecowitt station - that indicates that the ip address of the station has changed, or the station is not online, or ...



Reply all
Reply to author
Forward
0 new messages