cleanup tasmota formatting

This commit is contained in:
Robin Appelman 2026-06-27 00:13:40 +02:00
commit 7955380859
3 changed files with 398 additions and 373 deletions

View file

@ -4,7 +4,7 @@ mod mqtt;
mod topic;
use crate::config::{Config, ListenConfig};
use crate::device::{Device, DeviceStates, format_device_state};
use crate::device::{Device, DeviceStates};
use crate::mqtt::mqtt_stream;
use crate::topic::Topic;
use clap::Parser;
@ -78,8 +78,9 @@ async fn serve(device_states: Arc<Mutex<DeviceStates>>, listen: ListenConfig) {
.map(move |state: Arc<Mutex<DeviceStates>>| {
let state = state.lock().unwrap();
let mut response = String::new();
for (device, state) in state.devices() {
format_device_state(&mut response, device, state).unwrap();
for (_, state) in state.devices() {
write!(&mut response, "{}", state.format_open_metrics())
.expect("formatting failed");
}
for (_, state) in state.dsmr_devices() {
write!(&mut response, "{}", state.format_open_metrics())