Cheap way of knowing about a black out (when you are far away)?

Any ideas?

A smart ups sending a signal, anything else?

Roll your own cellular power monitor:

  1. esp8266 board
  2. cellular modem
  3. power sensing hardware
1 Like
  1. how to?
  2. what is a cellular modem, and how to?
  3. yes I know those, this might be an option, although they are a bit expensive

I do have some PIR sensor made with an esp8266 board following BRUH DIY multisensor. But how would I use those (or any other?)
Connection status to the router? I think that is slow, I would prefer an almost instant trigger

Depends on your particular circumstances, if it’s somewhere with UPS or other battery protection for your HA server and internet connection, you could just use a 5v wall wart and sense the power from that, which could be done directly into a RPi for example, or in the same manner into an ESP8266.

A discussion about this is here:
https://www.raspberrypi.org/forums/viewtopic.php?f=45&t=22841

Otherwise you would need a cellular modem to do it.

yes my HASS is on a UPS (othe rbrand, now don’t remember which). But not sure if its possible to get a signal out of it. “5v wall wart” ???

The UPS will provide some form of notification about power outage - they all do. You’ll need to check the manual to see if that notification is provided over USB, serial, or something else.

If it’s supported by NUT, then the simplest approach is to connect your UPS’s monitoring port to a Pi (that’s powered by a something like this), and install NUT. Then you just need to sort out the GSM modem (assuming you’ve got GSM service) - something like this.

A quick Google for Raspberry Pi detect power outage found lots of articles. I’d advise you take the time to read through them, since it sounds like you’re looking for an “off the shelf” solution.

Wall wart:

image

But yeah, if you have a UPS, it should be possible to get a state from that. Presuming your internet access is also connected to the UPS, HA and your connection should survive a power outage, and be able to report the outage to you.

yes it is.

I have 2 cases

a) power down internet up (modem under UPS)
b) power down internet down (if all area power is down also the fiber optic provider tower will be down)

For now I am happy with case a)
In future would like also to solve case b)

why this?

My pi3 is connected to the UPS I could take the USB signal from, is this not ok?

I will look into this NUT. 3G I want to avoid since it would cost me like 5 Euro per month, not worth it.

Will try now to install NUT on my pi3 (I have 2 pi3), attach the USB to the pi3, but from NUT to HASS ???

Depends on your UPS. You need to read the documentation, and check to see if it’s supported by NUT

You’ll want to read the documentation for upsmon. Basically you’ll configure a notification command that writes the value of $NOTIFYTYPE to a file. You can then create a file_sensor that reads that file. That sensor can be used in an automation that sends you notifications when that sensor reports a state you’re interested in.

Mmmhhh ok, yes I understand, difficult part is to do it. Now on the same pi3 I have the NUT server and also NUT client.
If I run this command

upsc ups

I receive

pi@hassbian:~ $ upsc ups
Init SSL without certificate database
battery.charge: 100
battery.voltage: 13.80
battery.voltage.high: 13.00
battery.voltage.low: 10.40
battery.voltage.nominal: 12.0
device.type: ups
driver.name: blazer_usb
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.version: 2.7.2
driver.version.internal: 0.11
input.current.nominal: 3.0
input.frequency: 50.0
input.frequency.nominal: 50
input.voltage: 237.1
input.voltage.fault: 237.1
input.voltage.nominal: 230
output.voltage: 237.1
ups.beeper.status: enabled
ups.delay.shutdown: 30
ups.delay.start: 180
ups.load: 8
ups.productid: 5161
ups.status: OL
ups.type: offline / line interactive
ups.vendorid: 0665
pi@hassbian:~ $ ps -ef | grep ups

The values to be controlled are

input.voltage: 237.1 (it should be zero in case of power outage)

and

ups.status: OL

OL Power line, if changes to OB is running on battery

Ok I managed you need to create a log with

pi@hassbian:~ $ upslog -s ups -l /home/pi/upslog.txt

(ups is the name of my UPS)
result should be every 30 seconds

20170909 140536 100 235.6 5 [OL] NA 50.0
20170909 140606 100 236.6 9 [OL] NA 50.0
20170909 140636 100 235.1 8 [OL] NA 50.0
20170909 140706 100 233.6 6 [OL] NA 50.0

I guess we put this in configuration

  - platform: file
    file_path: /home/pi/upslog.txt

@Tinkerer can you tell me how to extract the value OL (or OB when on battery) from the file?

Also how to run this command every time the pi3 restarts
upslog -s ups -l /home/pi/upslog.txt

As I said before (with more emphasis this time):

You’ll want to read the documentation for upsmon. Basically you’ll configure a notification command that writes the value of $NOTIFYTYPE to a file. You can then create a file_sensor that reads that file. That sensor can be used in an automation that sends you notifications when that sensor reports a state you’re interested in.