Fix EnergyReset3

Fix EnergyReset3 (#2723)
This commit is contained in:
Theo Arends 2018-08-23 17:38:17 +02:00
parent 6a5c0d29e8
commit 035bc29475
2 changed files with 8 additions and 4 deletions

View File

@ -3,6 +3,7 @@
* Allow user override of define MAX_RULE_VARS
* Add GPIO options ButtonXn, SwitchXn and CounterXn to select INPUT mode instead of INPUT_PULLUP (#2525)
* Fix OtaMagic when file path contains a dash (-) (#3563)
* Fix EnergyReset3 (#2723)
*
* 6.1.1.8
* Fix MQTT reconnection detection when using TasmotaMqtt library (#3558)

View File

@ -920,17 +920,20 @@ boolean EnergyCommand()
case 3:
RtcSettings.energy_kWhtotal = lnum *100;
Settings.energy_kWhtotal = RtcSettings.energy_kWhtotal;
energy_total = (float)(RtcSettings.energy_kWhtotal + energy_kWhtoday) / 100000;
break;
}
}
char energy_yesterday_chr[10];
char stoday_energy[10];
char energy_daily_chr[10];
char energy_total_chr[10];
dtostrfd(energy_total, Settings.flag2.energy_resolution, energy_total_chr);
dtostrfd(energy_daily, Settings.flag2.energy_resolution, energy_daily_chr);
dtostrfd((float)Settings.energy_kWhyesterday / 100000, Settings.flag2.energy_resolution, energy_yesterday_chr);
dtostrfd((float)RtcSettings.energy_kWhtoday / 100000, Settings.flag2.energy_resolution, stoday_energy);
dtostrfd((float)(RtcSettings.energy_kWhtotal + energy_kWhtoday) / 100000, Settings.flag2.energy_resolution, energy_total_chr);
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"%s\":{\"" D_JSON_TOTAL "\":%s,\"" D_JSON_YESTERDAY "\":%s,\"" D_JSON_TODAY "\":%s}}"),
command, energy_total_chr, energy_yesterday_chr, stoday_energy);
command, energy_total_chr, energy_yesterday_chr, energy_daily_chr);
status_flag = 1;
}