From 00d48d11595c363690ea9f59a7f14895f411ccd6 Mon Sep 17 00:00:00 2001 From: JeroenSt Date: Mon, 2 Dec 2024 15:26:13 +0100 Subject: [PATCH] Expanded option72 for Shelly 3EM (ADE7880)) to only count import energy in today, yesterday and total. --- tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino b/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino index baec24922247..97f73116014a 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino @@ -277,8 +277,14 @@ void EnergyUpdateToday(void) { if (abs(Energy->kWhtoday_delta[i]) > 1000) { int32_t delta = Energy->kWhtoday_delta[i] / 1000; delta_sum_balanced += delta; - Energy->kWhtoday_delta[i] -= (delta * 1000); - Energy->kWhtoday[i] += delta; + Energy->kWhtoday_delta[i] -= (delta * 1000); +#ifdef USE_ADE7880 + if (!Settings->flag3.hardware_energy_total || delta > 0) { // Import energy + Energy->kWhtoday[i] += delta; + } +#else + Energy->kWhtoday[i] += delta; +#endif if (delta < 0) { // Export energy Energy->kWhtoday_export[i] += (delta *-1); if (Energy->kWhtoday_export[i] > 100) {