From ac84cda5bff40bae1b9f728e3ddb480e8153079f Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Wed, 3 Nov 2021 13:03:50 +0300 Subject: monitor: update battery level notifications --- src/inverter-bot | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/inverter-bot') diff --git a/src/inverter-bot b/src/inverter-bot index cb50b65..7f5e5db 100755 --- a/src/inverter-bot +++ b/src/inverter-bot @@ -63,7 +63,7 @@ _strings = { 'chrg_evt_disconnected': 'AC line disconnected.', 'chrg_evt_current_changed': 'AC charging current set to %dA.', 'chrg_evt_na_solar': 'AC line detected, but battery charging is unavailable due to active solar power line.', - 'battery_state_changed': 'Battery voltage state changed to %s (%0.1f V)' + 'battery_level_changed': 'Battery level: %s (%0.1f V under %d W load)' } logger = logging.getLogger(__name__) @@ -395,18 +395,18 @@ def monitor_charging_event_handler(event: ChargingEvent, **kwargs) -> None: notify_all(_(f'chrg_evt_{key}', *args)) -def monitor_battery_event_handler(state: BatteryState, v: float) -> None: +def monitor_battery_event_handler(state: BatteryState, v: float, load_watts: int) -> None: if state == BatteryState.NORMAL: - label = 'normal' - elif state == BatteryState.WARNING: - label = 'warning' + label = '✅ Normal' + elif state == BatteryState.LOW: + label = '⚠️ Low' elif state == BatteryState.CRITICAL: - label = 'critical' + label = '‼️ Critical' else: logger.error('unknown battery state:', state) return - notify_all(_('battery_state_changed', label, v)) + notify_all(_('battery_level_changed', label, v, load_watts)) if __name__ == '__main__': -- cgit v1.2.3