mirror of https://github.com/arendst/Tasmota.git
Fix Shelly Dimmer 2 Energy calculation
Fix Shelly Dimmer Energy calculation (#12815)
This commit is contained in:
parent
b35072c1e1
commit
3a85922a94
|
@ -536,7 +536,7 @@ bool ShdPacketProcess(void)
|
||||||
Energy.current[0] = current;
|
Energy.current[0] = current;
|
||||||
Energy.apparent_power[0] = voltage * current;
|
Energy.apparent_power[0] = voltage * current;
|
||||||
if ((voltage * current) > wattage)
|
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
|
else
|
||||||
Energy.reactive_power[0] = 0;
|
Energy.reactive_power[0] = 0;
|
||||||
if (wattage > (voltage * current))
|
if (wattage > (voltage * current))
|
||||||
|
@ -552,7 +552,7 @@ bool ShdPacketProcess(void)
|
||||||
#ifdef SHELLY_DIMMER_DEBUG
|
#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);
|
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
|
#endif // SHELLY_DIMMER_DEBUG
|
||||||
Energy.kWhtoday += kWhused;
|
Energy.kWhtoday_delta += kWhused;
|
||||||
EnergyUpdateToday();
|
EnergyUpdateToday();
|
||||||
}
|
}
|
||||||
Shd.last_power_check = Rtc.utc_time;
|
Shd.last_power_check = Rtc.utc_time;
|
||||||
|
|
Loading…
Reference in New Issue