-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
Red Reactor is configured via a YAML file (default: config.yaml). A fully annotated example is available in the repository at extras/config.yaml.
Download it to get started:
curl -fsSL https://raw.githubusercontent.com/mreditor97/redreactor/master/extras/config.yaml \
-o config.yamlmqtt:
broker: 192.168.1.100 # MQTT broker IP or hostname
port: 1883 # Default MQTT port
user: your_username
password: your_password
version: 5 # Protocol version: 3 or 5
client_id: Red Reactor
base_topic: redreactor # Root prefix for all MQTT topics
transport: tcp
timeout: 120
exit_on_fail: true # Exit if the broker is unreachable on startup| Key | Default | Description |
|---|---|---|
mqtt.broker |
127.0.0.1 |
MQTT broker address |
mqtt.port |
1883 |
MQTT broker port |
mqtt.version |
3 |
Protocol version (3 = MQTTv3.1.1, 5 = MQTTv5) |
mqtt.base_topic |
redreactor |
Root topic prefix |
mqtt.exit_on_fail |
true |
Exit the service if the broker is unreachable |
Controls the device name used in MQTT topics and the Home Assistant device registry.
hostname:
name: redreactor-pi # Slug — used in MQTT topics, e.g. redreactor/redreactor-pi/state
pretty: Red Reactor Pi # Human-readable name shown in Home AssistantThe name must be unique if you are running multiple Red Reactor devices on the same broker.
homeassistant:
discovery: true # Publish MQTT discovery messages for auto-discovery
topic: homeassistant # HA discovery topic prefix
discovery_interval: 120 # Re-publish discovery config every N seconds
expire_after: 120 # Seconds before HA marks a sensor unavailable| Key | Default | Description |
|---|---|---|
homeassistant.discovery |
true |
Enable MQTT auto-discovery |
homeassistant.topic |
homeassistant |
HA discovery topic prefix |
homeassistant.discovery_interval |
120 |
Re-publish interval (seconds) |
homeassistant.expire_after |
120 |
Sensor expiry timeout (seconds) |
The commands sent to the OS when a shutdown or restart is triggered via MQTT.
system:
shutdown: sudo shutdown 0 -h
restart: sudo shutdown 0 -rOn Linux/Docker, the redreactor user must have a sudoers rule for /sbin/shutdown. See the Ubuntu / Standard Linux OS guide for setup details.
logging:
console: INFO # Log level for stdout: DEBUG, INFO, WARNING, ERROR, CRITICAL
file: WARNING # Log level for the log fileThese values should match your Red Reactor hardware revision. The defaults are correct for the standard Red Reactor board.
ina:
address: 0x40 # I2C address of the INA219
shunt_ohms: 0.05 # Shunt resistor value
max_expected_amps: 5.5
monitor_interval: 5 # How often to read the sensor (seconds)Once running, the service publishes to the following topics (using the configured base_topic and hostname.name):
| Topic | Description |
|---|---|
redreactor/{name}/state |
JSON payload with all sensor readings |
redreactor/{name}/status |
online or offline
|
redreactor/{name}/set/{command} |
Inbound command topic |
{
"voltage": 4.164,
"current": 2.18,
"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.9,
"battery_voltage_maximum": 4.2,
"report_interval": 30
}Send a JSON value to redreactor/{name}/set/{command}:
| Command | Type | Description |
|---|---|---|
battery_warning_threshold |
integer | Warn and publish immediately below this % |
battery_voltage_minimum |
float | Shutdown threshold voltage |
battery_voltage_maximum |
float | Full charge voltage |
report_interval |
integer | Seconds between state publishes (5–300) |
restart |
any | Restart the device immediately |
shutdown |
any | Shut the device down immediately |