A Python library to detect bad power supply on Raspberry Pi .
Project description
rpi-bad-power
A Python library to detect bad power supply on Raspberry Pi. This library is mainly built for the Raspberry Pi Power Supply Checker integration of HomeAssistant. It should also work for other purpose.
Compatibility
This library only works on kernel 4.14+. It supports getting the under voltage bit from different entries.
Related PRs:
- raspberrypi/linux#2397:
/sys/devices/platform/soc/soc:firmware/get_trottled
- raspberrypi/linux#2706:
/sys/class/hwmon/hwmon0/in0_lcrit_alarm
Usage
Here is an example on how to use this library.
from rpi_bad_power import new_under_voltage
under_voltage = new_under_voltage()
if under_voltage is None:
print("System not supported.")
elif under_voltage.get():
print("Under voltage detected.")
else:
print("Voltage is normal.")
Credits
Some of the code are based on custom-components/sensor.rpi_power maintained by @swetoast.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rpi-bad-power-0.1.0.tar.gz
(4.5 kB
view details)
Built Distribution
File details
Details for the file rpi-bad-power-0.1.0.tar.gz
.
File metadata
- Download URL: rpi-bad-power-0.1.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d9f6e2c3a4f213e4c61acf618880d6fd2a384fe26b4f35a64a9fdfa3a38d079 |
|
MD5 | b5dd900bd77b1debd33c8a3fc666d59c |
|
BLAKE2b-256 | 93e4e6ab9c81148da6d1cbb7237402df6713c8b53852678285ee8ac826063347 |
File details
Details for the file rpi_bad_power-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: rpi_bad_power-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6deedda247d48c44cd62d5c6c67c80d774eab34e706262b05f5e6518a00f19b |
|
MD5 | ef29e3329646b5e61907232cca1718e7 |
|
BLAKE2b-256 | 464d826fe801a1b6bc2fa352747a94f91fd4b85307ae962e226c208ec05046fd |