From 2883f52249568700ff80cbc7dea1b65b6000b38a Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Tue, 10 Jan 2023 15:37:38 +0100 Subject: [PATCH] Switch to floats for the current power and total energy fields --- src/lib.rs | 4 ++-- src/services/my_autarco.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7817ac6..710a691 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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, } diff --git a/src/services/my_autarco.rs b/src/services/my_autarco.rs index 24d26d4..2b8b120 100644 --- a/src/services/my_autarco.rs +++ b/src/services/my_autarco.rs @@ -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, }) }