Skip to main content

Outage Detector

Simple module meant to notify user if a power outage has occured or if the internet has been down.

What it does

At every run it writes to a text file timestamps for power and internet, whether the last run was scheduled or at boot and the last calculated periodicity.

If the script was run after a boot up, it will assume there was a power outage (the system is meant to run 24/7, for example a Raspberry Pi Zero) and send a notification, approximating the power outage duration through the last known timestamp and calculated periodicity of the runs.

Internet downtime is detected if the 2 timestamps written to the file differ and the downtime is approximated again through the calculated periodicity. It is possible that an internet downtime is missed if the script is run too rarely.

How to run it

Install the module in a virtual environment with pip:

pip3 install Outage-Detector

Alternatively, you can also install the module by cloning this git repo and running setup.py

git clone https://github.com/fabytm/Outage-Detector.git
python3 setup.py install

Afterwards, all you need to do is to run the outage_detector command line interface for the initialization process:

outage_detector --init

From here you can choose the way you want to be notified and will be prompted to enter your e-mail information, PushBullet API key or IFTTT API key.

Additionally, it will also ask you if you want to set up scheduling for this module. Choosing to do so is recommended for inexperienced users (this will create 2 cron jobs, one running at boot time and one every 5 minutes, to check in on internet status and record timestamp if either the internet connection drops or a power outage happens).

Update the module to the latest version in a virtual environment with pip:

pip3 install Outage-Detector --upgrade

How to setup IFTTT

Install the IFTTT app and either create an account or sign in to an existing account and create a new applet.

Next, select the plus button beside the word This and choose the Webhooks service. Select Recieve a web request and click Connect. Choose an event name — you will need to remember this for later.

Select the plus button beside the word That and choose any action that you like. Clear everything from the message text box and choose Value1 from the Insert Ingredients menu. Enter any necessary information and press finish.

Select the Webhooks icon in the top left of the screen and press the Documentation button (in a web browser). This will give you a key which you will need for initialization.

Finally, complete the outage_detector initialization process by running the command above.

Release files for Outage-Detector 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Outage-Detector 1.1.2
File Size Uploaded
Outage Detector-1.1.2.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Outage-Detector 1.1.2
File Interpreter ABI Platform
Outage_Detector-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 17.6 kB

Release files / Outage Detector-1.1.2.tar.gz

Download URL Outage Detector-1.1.2.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7ea674d41e7e3666862e5732605cd9d7d2c769a0a0fed979c341c1013ec578a8
BLAKE2b-256 checksum
How to use checksums
49ecc74d7dce7a9945e549a3f629d3cea55f73affc8e73b650797f0f02b1be91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.6

Release files / Outage_Detector-1.1.2-py3-none-any.whl

Download URL Outage_Detector-1.1.2-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a89d60994d012367da2125c45789d02f3d74c2b8d2bde6c88b4d329d82037e32
BLAKE2b-256 checksum
How to use checksums
9b65a20474877ef2c6beb23c382e7882902bd37fb8a9f7672d781497ba625c92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.6

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page