From 10178a030cbb00f4f5eaa1dc80962e73217c0a67 Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Tue, 2 Jun 2026 18:01:35 +0200 Subject: [PATCH 1/5] add BatteryStatus enum --- meshtastic/telemetry.proto | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/meshtastic/telemetry.proto b/meshtastic/telemetry.proto index dccf1b6d..fe59ae52 100644 --- a/meshtastic/telemetry.proto +++ b/meshtastic/telemetry.proto @@ -8,12 +8,38 @@ option java_outer_classname = "TelemetryProtos"; option java_package = "org.meshtastic.proto"; option swift_prefix = ""; +/** + * Details about charging state of the battery. + * Added to preserve the battery percentage while it's charging. + */ +enum BatteryStatus { + /* + * No further information (yet) + */ + UNKNOWN = 0; + + /* + * Running on battery (not externally powered) + */ + DISCHARGING = 1; + + /* + * Externally powered and actively charging + */ + CHARGING = 2; + + /* + * Externally powered but not charging (already full, waiting, or out of temperature range) + */ + NOT_CHARGING = 3; +} + /* * Key native device metrics such as battery level */ message DeviceMetrics { /* - * 0-100 (>100 means powered) + * 0-100 */ optional uint32 battery_level = 1; @@ -36,6 +62,11 @@ message DeviceMetrics { * How long the device has been running since the last reboot (in seconds) */ optional uint32 uptime_seconds = 5; + + /* + * Details about powered and charging state + */ + optional BatteryStatus battery_status = 6; } /* From e5f7870abeb0c5f787dff6a2fabc8d19be9a5a87 Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Tue, 2 Jun 2026 18:29:26 +0200 Subject: [PATCH 2/5] fix complains about UNKNOWN --- meshtastic/telemetry.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshtastic/telemetry.proto b/meshtastic/telemetry.proto index fe59ae52..dcf9655f 100644 --- a/meshtastic/telemetry.proto +++ b/meshtastic/telemetry.proto @@ -16,7 +16,7 @@ enum BatteryStatus { /* * No further information (yet) */ - UNKNOWN = 0; + BATTERY_STATUS_UNKNOWN = 0; /* * Running on battery (not externally powered) From 04838acf2c4ac16114fd3ec6c3b78216adedd93b Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Thu, 4 Jun 2026 14:01:31 +0200 Subject: [PATCH 3/5] add FULLY_CHARGED, NOT_PRESENT, NOT_PRESENT --- meshtastic/telemetry.proto | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/meshtastic/telemetry.proto b/meshtastic/telemetry.proto index dcf9655f..76746b29 100644 --- a/meshtastic/telemetry.proto +++ b/meshtastic/telemetry.proto @@ -29,9 +29,24 @@ enum BatteryStatus { CHARGING = 2; /* - * Externally powered but not charging (already full, waiting, or out of temperature range) + *Externally powered and fully charged */ - NOT_CHARGING = 3; + FULLY_CHARGED = 3; + + /* + *Battery not present + */ + NOT_PRESENT = 4; + + /* + * Externally powered but not charging (charging disabled, not supported) + */ + NOT_CHARGING = 5; + + /* + * Externally powered but not charging due to anomaly (fault detected) + */ + CHARGE_FAILURE = 6; } /* From bb9ad2d9b2199adfe6ab9394c83ae73c9e5ae067 Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Thu, 4 Jun 2026 14:04:31 +0200 Subject: [PATCH 4/5] fix comments --- meshtastic/telemetry.proto | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meshtastic/telemetry.proto b/meshtastic/telemetry.proto index 76746b29..5f9db268 100644 --- a/meshtastic/telemetry.proto +++ b/meshtastic/telemetry.proto @@ -29,24 +29,24 @@ enum BatteryStatus { CHARGING = 2; /* - *Externally powered and fully charged + * Externally powered and fully charged */ FULLY_CHARGED = 3; /* - *Battery not present + * Battery not present */ NOT_PRESENT = 4; /* - * Externally powered but not charging (charging disabled, not supported) + * Externally powered but not charging (disabled, suspended, or not supported) */ NOT_CHARGING = 5; /* * Externally powered but not charging due to anomaly (fault detected) */ - CHARGE_FAILURE = 6; + NOT_PRESENT = 6; } /* From c3937e338e862b2792dda8db606f3e7634fcbfbc Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Thu, 4 Jun 2026 14:07:23 +0200 Subject: [PATCH 5/5] -_- --- meshtastic/telemetry.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshtastic/telemetry.proto b/meshtastic/telemetry.proto index 5f9db268..63260f4b 100644 --- a/meshtastic/telemetry.proto +++ b/meshtastic/telemetry.proto @@ -46,7 +46,7 @@ enum BatteryStatus { /* * Externally powered but not charging due to anomaly (fault detected) */ - NOT_PRESENT = 6; + CHARGE_FAILURE = 6; } /*