dmatech1 / iot-stuff

Various IOT projects
0 stars 0 forks source link

Power failure tracking and power logging #2

Open dmatech1 opened 2 years ago

dmatech1 commented 2 years ago

I've got a bunch of UPS units around here, and they're all supported by NUT. I'd like to get a notification whenever power goes on and off, and I'd also like to have the voltage, current, frequency, and other stuff logged to a database just for fun.

In order for the alerts to actually get out, certain devices will need to be on the UPS (and even that's not a guarantee). To be extra certain, I could use a cheap cellular modem.

I'll need to determine exactly what's plugged into each UPS. Ideally, I'd also measure the power draw over a period of time, because it might be a good idea to rearrange some things.

Finally, I've got multiple devices plugged into each UPS, so I'd have to take advantage of the networking features of NUT if I want devices to shut down cleanly.

dmatech1 commented 1 year ago

For local-only use, just use the "standalone" mode in nut.conf. I'll need the driver and perhaps upsd, but I don't think I'll need upsmon. I really just want to be able to make queries and receive events like in the socket protocol and act on them.

dmatech1 commented 1 year ago

Work to be done:

  1. Setup documentation for a new device.
  2. Add more detailed logging (either via systemd or some sort of database).
  3. Move notifications to another component that can handle the multiple outbound interfaces.
  4. Improve the nut client to be more fully-featured. It doesn't currently do much.
dmatech1 commented 1 year ago

Looks a bit better.

image