mirror of https://github.com/arendst/Tasmota.git
Merge pull request #6468 from pablozg/development
NRG: Show usage/export stored values when EnergyReset command is sent
This commit is contained in:
commit
206a502f36
|
@ -175,6 +175,8 @@
|
|||
#define D_JSON_PV2_CURRENT "Pv2Current"
|
||||
#define D_JSON_PV2_POWER "Pv2Power"
|
||||
#define D_JSON_SOLAR_POWER "SolarPower"
|
||||
#define D_JSON_USAGE "Usage"
|
||||
#define D_JSON_EXPORT "Export"
|
||||
|
||||
#define D_RSLT_ENERGY "ENERGY"
|
||||
#define D_RSLT_HASS_STATE "HASS_STATE"
|
||||
|
|
|
@ -504,16 +504,6 @@ void CmndEnergyReset(void)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
char energy_total_chr[FLOATSZ];
|
||||
dtostrfd(Energy.total, Settings.flag2.energy_resolution, energy_total_chr);
|
||||
char energy_daily_chr[FLOATSZ];
|
||||
dtostrfd(Energy.daily, Settings.flag2.energy_resolution, energy_daily_chr);
|
||||
char energy_yesterday_chr[FLOATSZ];
|
||||
dtostrfd((float)Settings.energy_kWhyesterday / 100000, Settings.flag2.energy_resolution, energy_yesterday_chr);
|
||||
|
||||
Response_P(PSTR("{\"%s\":{\"" D_JSON_TOTAL "\":%s,\"" D_JSON_YESTERDAY "\":%s,\"" D_JSON_TODAY "\":%s}}"),
|
||||
XdrvMailbox.command, energy_total_chr, energy_yesterday_chr, energy_daily_chr);
|
||||
}
|
||||
|
||||
if ((XdrvMailbox.index > 3) && (XdrvMailbox.index <= 5)) {
|
||||
|
@ -546,12 +536,18 @@ void CmndEnergyReset(void)
|
|||
Settings.energy_usage.return2_kWhtotal = RtcSettings.energy_usage.return2_kWhtotal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Response_P(PSTR("{\"%s\":{\"Usage\":[%d,%d],\"Export\":[%d,%d]}}"),
|
||||
XdrvMailbox.command,
|
||||
char energy_total_chr[FLOATSZ];
|
||||
dtostrfd(Energy.total, Settings.flag2.energy_resolution, energy_total_chr);
|
||||
char energy_daily_chr[FLOATSZ];
|
||||
dtostrfd(Energy.daily, Settings.flag2.energy_resolution, energy_daily_chr);
|
||||
char energy_yesterday_chr[FLOATSZ];
|
||||
dtostrfd((float)Settings.energy_kWhyesterday / 100000, Settings.flag2.energy_resolution, energy_yesterday_chr);
|
||||
Response_P(PSTR("{\"%s\":{\"" D_JSON_TOTAL "\":%s,\"" D_JSON_YESTERDAY "\":%s,\"" D_JSON_TODAY "\":%s,\"" D_JSON_USAGE "\":[%d,%d],\"" D_JSON_EXPORT "\":[%d,%d]}}"),
|
||||
XdrvMailbox.command, energy_total_chr, energy_yesterday_chr, energy_daily_chr,
|
||||
Settings.energy_usage.usage1_kWhtotal, Settings.energy_usage.usage2_kWhtotal,
|
||||
Settings.energy_usage.return1_kWhtotal, Settings.energy_usage.return2_kWhtotal);
|
||||
}
|
||||
}
|
||||
|
||||
void CmndTariff(void)
|
||||
|
|
Loading…
Reference in New Issue