Red Reactor Battery Monitoring service with MQTT, and Home Assistant support
Project description
Red Reactor MQTT Client for Home Automation
This is a Red Reactor MQTT Client service that is designed to run as a background application to monitor battery status, and to publish that data to a MQTT broker.
Installation instructions can be found here.
Functionality includes:
- Background application that continuously monitors the battery status, and will safely shutdown if required
- The configuration file can be used to override specific topics and entities
- Connects to a MQTT broker, and publishes the service status, data and enables command topics
- Published data includes:
- Voltage
- Current
- Battery Level
- External Power Status
- CPU Temperature
- CPU Status
- CPU Status Raw
- Battery Warning Threshold
- Battery Voltage Minimum and Maximum
- Report Interval
- Commands:
- Immediate Shutdown
- Immediate Restart
- Change the Battery Warning Threshold
- Change the Battery Voltage Minimum and Maximum
- Change the Report Interval
- Provides
systemdservice example, so it can be started as a service on system boot
If you haven't already got yourself a Red Reactor (An uninterruptible battery powered backup for your Raspberry Pi), one can be purchased from there website.
Home Assistant
Connecting your Home Assistant instance to the same MQTT Broker as your Red Reactor will allow your Red Reactor to be auto discovered by your Home Assistant instance. It will give you access to all the readings available from the Red Reactor sensors, and allows full configuration of the Red Reactor on the fly - it even adds the ability to reboot and shutdown your device at the push of a button.
There is also a Home Assistant Add-on available for Supervisor users. Installation instructions can be found in the wiki.
MQTT
State
Topic redreactor/your-configured-hostname/state
{
"voltage": 4.164,
"current": 2.1799,
"battery_level": 100,
"external_power": "ON",
"cpu_temperature": 49.1,
"cpu_stat": "OK",
"cpu_stat_raw": 0,
"battery_warning_threshold": 10,
"battery_voltage_minimum": 2.6,
"battery_voltage_maximum": 4.2,
"report_interval": 30
}
State Description
voltageis the Voltage of the connected batteriescurrentis the Current draw from the batteriesbattery_levelis the percentage value of charge left in the batteriesexternal_poweris whether the batteries are connected to an external power source or notcpu_temperatureread viacat /sys/class/thermal/thermal_zone0/tempgets the CPU Temperaturecpu_statread viacat /sys/devices/platform/soc/soc:firmware/get_throttledgets the CPU Stat in a human readable formatcpu_stat_rawread viacat /sys/devices/platform/soc/soc:firmware/get_throttledgets the CPU Statbattery_warning_thresholdis a percentage value below 100% that once crossed will initiate a safe shutdown of the devicebattery_voltage_minimumis the voltage at which is to be considered the lowest allowable before initiating a safe shutdownbattery_voltage_maximumis the voltage at which is to be considered the maximum at which the battery can be (this is used in the calculation of thebattery_level)report_intervalis the reporting interval at which the data will be published onto the state topic
Status
Topic redreactor/hostname/status
Data online or offline
Command
Topic redreactor/your-configured-hostname/set/chosen-command
Command topic | value:
battery_warning_threshold| value (int)battery_voltage_minimum| value (float)battery_voltage_maximum| value (float)report_interval| value (int)restart| no value requiredshutdown| no value required
If there are more features that you would like to see supported, let me know!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file redreactor-0.1.6.tar.gz.
File metadata
- Download URL: redreactor-0.1.6.tar.gz
- Upload date:
- Size: 19.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2448fff251395ee1bba6d2d41c3f5a5bef32e26860f6d839d5f9f372672e2341
|
|
| MD5 |
dcb4a940e90a260cdde9f2ed686b88fd
|
|
| BLAKE2b-256 |
1a45a6169a7d3ec235377050f91404b00ed9be2ce84187a21524f93965eb8fd4
|
File details
Details for the file redreactor-0.1.6-py3-none-any.whl.
File metadata
- Download URL: redreactor-0.1.6-py3-none-any.whl
- Upload date:
- Size: 25.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ed8656bc87ec953ed97078ae9b48f40f54531f220f7dbdec53eb3b4ad7a5a90
|
|
| MD5 |
395420d6eb4c1fc5d2f6b04ea2f3c886
|
|
| BLAKE2b-256 |
64c5f6f1aaa134c1af228beb59757238c5c68d4308326ed1ad7dfca49c29f2b2
|