From b3759dadd318c48b8f84b04a2b94ff0c230008f1 Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Mon, 22 Jan 2024 06:40:22 +0100 Subject: [PATCH] Fix oder of magnitude reported for current in HA plugin (#86) --- hms2mqtt/src/home_assistant.rs | 2 +- hms2mqtt/src/protos/RealData.proto | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hms2mqtt/src/home_assistant.rs b/hms2mqtt/src/home_assistant.rs index 05e5ad90..de11b07a 100644 --- a/hms2mqtt/src/home_assistant.rs +++ b/hms2mqtt/src/home_assistant.rs @@ -101,7 +101,7 @@ impl HMSStateResponse { json[format!("pv_{}_vol", port.pv_port)] = format!("{:.2}", port.pv_vol as f32 * 0.1).into(); json[format!("pv_{}_cur", port.pv_port)] = - format!("{:.2}", port.pv_cur as f32 * 0.1).into(); + format!("{:.2}", port.pv_cur as f32 * 0.01).into(); json[format!("pv_{}_power", port.pv_port)] = format!("{:.2}", port.pv_power as f32 * 0.1).into(); json[format!("pv_{}_energy_total", port.pv_port)] = port.pv_energy_total.into(); diff --git a/hms2mqtt/src/protos/RealData.proto b/hms2mqtt/src/protos/RealData.proto index 23b6ccdc..d8ecc1c1 100644 --- a/hms2mqtt/src/protos/RealData.proto +++ b/hms2mqtt/src/protos/RealData.proto @@ -26,7 +26,7 @@ message PortState { int64 pv_sn = 1; // serial number int32 pv_port = 2; // id of the port int32 pv_vol = 3; // [V], factor 0.1 - int32 pv_cur = 4; // [A], factor 0.1 + int32 pv_cur = 4; // [A], factor 0.01 int32 pv_power = 5; // [W], factor 0.1 int32 pv_energy_total = 6; // [Wh] int32 pv_daily_yield = 7; // [Wh]