From 3a85922a94281e3b7b769b9e9ca63c1707756768 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Mon, 30 Aug 2021 10:53:23 +0200 Subject: [PATCH] Fix Shelly Dimmer 2 Energy calculation Fix Shelly Dimmer Energy calculation (#12815) --- tasmota/xdrv_45_shelly_dimmer.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasmota/xdrv_45_shelly_dimmer.ino b/tasmota/xdrv_45_shelly_dimmer.ino index ea9de57e3..32449faa8 100644 --- a/tasmota/xdrv_45_shelly_dimmer.ino +++ b/tasmota/xdrv_45_shelly_dimmer.ino @@ -536,7 +536,7 @@ bool ShdPacketProcess(void) Energy.current[0] = current; Energy.apparent_power[0] = voltage * current; if ((voltage * current) > wattage) - Energy.reactive_power[0] = sqrt((voltage * current) * (voltage * current) - wattage * wattage); + Energy.reactive_power[0] = sqrtf((voltage * current) * (voltage * current) - wattage * wattage); else Energy.reactive_power[0] = 0; if (wattage > (voltage * current)) @@ -552,7 +552,7 @@ bool ShdPacketProcess(void) #ifdef SHELLY_DIMMER_DEBUG AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Adding %i mWh to todays usage from %lu to %lu"), (int)(kWhused * 10), Shd.last_power_check, Rtc.utc_time); #endif // SHELLY_DIMMER_DEBUG - Energy.kWhtoday += kWhused; + Energy.kWhtoday_delta += kWhused; EnergyUpdateToday(); } Shd.last_power_check = Rtc.utc_time;