mirror of
https://codeberg.org/icewind/taspromto.git
synced 2026-08-02 12:14:45 +02:00
cleanup dsmr
This commit is contained in:
parent
16993948cf
commit
74463cc56e
5 changed files with 114 additions and 85 deletions
13
src/main.rs
13
src/main.rs
|
|
@ -4,7 +4,7 @@ mod mqtt;
|
|||
mod topic;
|
||||
|
||||
use crate::config::{Config, ListenConfig};
|
||||
use crate::device::{Device, DeviceStates, format_device_state, format_dsmr_state};
|
||||
use crate::device::{Device, DeviceStates, format_device_state};
|
||||
use crate::mqtt::mqtt_stream;
|
||||
use crate::topic::Topic;
|
||||
use clap::Parser;
|
||||
|
|
@ -81,14 +81,17 @@ async fn serve(device_states: Arc<Mutex<DeviceStates>>, listen: ListenConfig) {
|
|||
for (device, state) in state.devices() {
|
||||
format_device_state(&mut response, device, state).unwrap();
|
||||
}
|
||||
for (device, state) in state.dsmr_devices() {
|
||||
format_dsmr_state(&mut response, device.hostname.as_str(), state).unwrap();
|
||||
for (_, state) in state.dsmr_devices() {
|
||||
write!(&mut response, "{}", state.format_open_metrics())
|
||||
.expect("formatting failed");
|
||||
}
|
||||
for (_, state) in state.mi_temp() {
|
||||
write!(&mut response, "{}", state.format_prometheus()).expect("formatting failed");
|
||||
write!(&mut response, "{}", state.format_open_metrics())
|
||||
.expect("formatting failed");
|
||||
}
|
||||
for (_, state) in state.rf_temp() {
|
||||
write!(&mut response, "{}", state.format_prometheus()).expect("formatting failed");
|
||||
write!(&mut response, "{}", state.format_open_metrics())
|
||||
.expect("formatting failed");
|
||||
}
|
||||
response
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue