Switch to floats for the current power and total energy fields

This commit is contained in:
Paul van Tilburg 2023-01-10 15:37:38 +01:00
parent 093d062dd4
commit 2883f52249
Signed by: paul
GPG Key ID: C6DE073EDA9EEC4D
2 changed files with 4 additions and 4 deletions

View File

@ -41,9 +41,9 @@ struct Config {
#[derive(Clone, Copy, Debug, Serialize)]
struct Status {
/// Current power production (W)
current_w: u32,
current_w: f32,
/// Total energy produced since installation (kWh)
total_kwh: u32,
total_kwh: f32,
/// Timestamp of last update
last_updated: u64,
}

View File

@ -119,8 +119,8 @@ impl super::Service for Service {
};
Ok(Status {
current_w: api_power.pv_now,
total_kwh: api_energy.pv_to_date,
current_w: api_power.pv_now as f32,
total_kwh: api_energy.pv_to_date as f32,
last_updated,
})
}