News for hackers. Stuff that matters.
Re:Run Your Home on a Raspberry Pi by sokoloff on Wednesday February 02, 2022 @06:43PM (#30185993)
> my house has race conditions after power outages

I'd be inclined to find something with an SNMP counter that counts up either "seconds since boot" or "megabits of traffic passed" or whatever else and have a script that runs shortly after the RPi boots to reboot the Pi if that counter if below some threshold.

Running this from the pi will query the uptime on my router in milliseconds:

  snmpwalk -v 2c -On -c public 192.168.2.1 .1.3.6.1.2.1.25.1.1.0
You could have a startup script on the Pi do something like "wait until you get a valid reading of this uptime and if that reading is less than 180000 [3 minutes], then sleep for N minutes [long enough to not double/triple reboot on a power outage] and reboot the RPi (or restart HA)"

If HomeAssistant needs to be recycled after every router reboot (not just on a power dump), have that script run in a cron job looking for an uptime less than some threshold and rebooting the Pi.

It might feel inelegant or even "gross", but I look at it as just reliably automating the fix and therefore better than what you're doing manually already.

There are no comments on this comment yet.