battery: low-battery alert module (v0.13.0)

BatteryAlertModule + BatteryAlertService wired into app.module like
the weather module. Every BATTERY_CHECK_INTERVAL_MS (default 60 s) the
service scans the node state backing GET /api/nodes and broadcasts a
single-packet '⚠️ @!<8-hex> battery low: <X>% (<name>)' alert for every
node at or below BATTERY_ALERT_THRESHOLD percent (default 20, <= on
purpose) not alerted within BATTERY_ALERT_COOLDOWN_MS (default 6 h,
in-memory map — resets on restart). Sends ride the pinned send channel
via MeshService.sendText like every other bot send.
This commit is contained in:
2026-09-25 12:39:45 +00:00
parent 8ddd91d4b5
commit d0b71e6e91
7 changed files with 339 additions and 2 deletions
+2 -1
View File
@@ -1,8 +1,9 @@
import { Module } from '@nestjs/common';
import { BatteryAlertModule } from './battery/battery.module.js';
import { MeshModule } from './mesh/mesh.module.js';
import { WeatherModule } from './weather/weather.module.js';
@Module({
imports: [MeshModule, WeatherModule],
imports: [MeshModule, WeatherModule, BatteryAlertModule],
})
export class AppModule {}