refactor/mqtt-data-serialization #23

Merged
EmpirePhoenix merged 5 commits from refactor/mqtt-data-serialization into develop 2026-05-25 19:42:15 +02:00
Collaborator

This PR changes the structure of most states send to mqtt. Previous iterations had some issues in terms of guaranteeing that relevant datapoints did not move across the structure depending on state. This MR introduces more consistent json structures.

This PR changes the structure of most states send to mqtt. Previous iterations had some issues in terms of guaranteeing that relevant datapoints did not move across the structure depending on state. This MR introduces more consistent json structures.
judge added 5 commits 2026-05-24 18:34:47 +02:00
- use tagged enum serialization for BatteryError
- flatten BatteryInfo telemetry with consistent field names and typed error
- fix: use tagged enum serialization for MoistureSensorError and PumpError
- fix: flatten PlantInfo sensors to SensorTelemetry with top-level moisture_pct
- fix: use tagged enum serialization for TankError
- fix: rename TankInfo fields for consistent naming (volume_ml, pct, water_temp_c)
- renamed some fields for better clarity on contained value
judge requested review from EmpirePhoenix 2026-05-24 18:34:55 +02:00
EmpirePhoenix reviewed 2026-05-25 19:40:20 +02:00
@@ -640,3 +640,3 @@
let deep_sleep_duration_minutes: u32 =
// if battery soc is unknown assume battery has enough change
if matches!(battery_state, BatteryState::Info(data) if data.state_of_charge < 10) {
if matches!(battery_state, BatteryState::Info(data) if data.soc_pct.is_some_and(|soc| soc < 10.)) {

TODO: check against config, if a battery is to be expected? Eg. with usb power module instead of solar?

TODO: check against config, if a battery is to be expected? Eg. with usb power module instead of solar?
EmpirePhoenix merged commit 7078af5713 into develop 2026-05-25 19:42:15 +02:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: C3MA/PlantCtrl#23