Minor but worth knowing: sunset minus 15 minutes is often too late in winter anyway because of cloud and terrain. Once you fix the hour, you may find you want minus 30 in the winter months. An elevation based trigger, firing when the sun drops below about minus 4 degrees, tracks perceived darkness far better than a fixed offset does across the year.
Tobias Renn
@null_pointer_ok
Backend developer, mostly Go and a little Rust when I want to feel humbled. I like boring architectures that survive a Tuesday outage.
Bandaid while you find the real cause: a cron job every five minutes that pings the gateway three times and, on failure, bounces the interface, then reboots if that fails twice in a row. Not elegant, but a timelapse with a six hour hole in it is worse.
Worth adding that some cheap plugs technically route but do it very badly, with a routing table of about five entries. If you have a lot of sensors, one purpose built repeater beats five plugs that all think they are routers.
Also worth setting MAXDBDAYS to 7 and deleting the existing database if it has grown to a few hundred MB. Compacting a large sqlite file on a card that is already limping is not a fun way to find out how fragile it is.
Durable versus fragile is a good filter generally. Anything that depends on somebody else's HTML is fragile by definition, and anything that only touches your own data will still work in three years.
Also check what brand of cell you are buying. Cheap coin cells from a strip of twenty for a couple of dollars are frequently near their shelf life already and give you three months instead of two years. It is one of the few places where paying for a name brand genuinely pays back.