From 495723fb32293f68e7fa9dc9dd9b37ed21a70fdb Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Tue, 16 Jul 2024 17:44:39 +0200 Subject: [PATCH] fix(deye): transmit solarEnergyDay as watt_hours --- lib/weewx_proxy/modbus/deye.ex | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/weewx_proxy/modbus/deye.ex b/lib/weewx_proxy/modbus/deye.ex index d4857bf..1506ad9 100644 --- a/lib/weewx_proxy/modbus/deye.ex +++ b/lib/weewx_proxy/modbus/deye.ex @@ -87,7 +87,13 @@ defmodule WeewxProxy.Modbus.Deye do defp handle_reading("deye/day_energy", reading, {:active, active}) do timestamp = DateTime.utc_now() |> DateTime.to_unix() - data = %{dateTime: timestamp, solarEnergyDay: reading, solarEnergyActive: active} + + data = %{ + dateTime: timestamp, + solarEnergyDay: reading * 1000.0, + solarEnergyActive: active + } + :ok = Publisher.publish("weewx/ingest_si", data) nil @@ -99,7 +105,13 @@ defmodule WeewxProxy.Modbus.Deye do defp handle_reading("deye/ac/active_power", reading, {:day, day}) do timestamp = DateTime.utc_now() |> DateTime.to_unix() - data = %{dateTime: timestamp, solarEnergyDay: day, solarEnergyActive: reading} + + data = %{ + dateTime: timestamp, + solarEnergyDay: day * 1000.0, + solarEnergyActive: reading + } + :ok = Publisher.publish("weewx/ingest_si", data) nil