mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-05-05 07:34:24 +00:00
Load data before restoring from config file
This commit is contained in:
@@ -68,7 +68,8 @@ bool EnergyAccounting::update(AmsData* amsData) {
|
|||||||
init = true;
|
init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!initPrice && eapi != NULL && getPriceForHour(0) != ENTSOE_NO_VALUE) {
|
float price = getPriceForHour(0);
|
||||||
|
if(!initPrice && eapi != NULL && price != ENTSOE_NO_VALUE) {
|
||||||
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf("(EnergyAccounting) Initializing prices at %lu\n", (int32_t) now);
|
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf("(EnergyAccounting) Initializing prices at %lu\n", (int32_t) now);
|
||||||
calcDayCost();
|
calcDayCost();
|
||||||
}
|
}
|
||||||
@@ -129,8 +130,7 @@ bool EnergyAccounting::update(AmsData* amsData) {
|
|||||||
if(kwhi > 0) {
|
if(kwhi > 0) {
|
||||||
if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf("(EnergyAccounting) Adding %.4f kWh import\n", kwhi);
|
if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf("(EnergyAccounting) Adding %.4f kWh import\n", kwhi);
|
||||||
use += kwhi;
|
use += kwhi;
|
||||||
if(getPriceForHour(0) != ENTSOE_NO_VALUE) {
|
if(price != ENTSOE_NO_VALUE) {
|
||||||
float price = getPriceForHour(0);
|
|
||||||
float cost = price * kwhi;
|
float cost = price * kwhi;
|
||||||
if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf("(EnergyAccounting) and %.4f %s\n", cost / 100.0, eapi->getCurrency());
|
if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf("(EnergyAccounting) and %.4f %s\n", cost / 100.0, eapi->getCurrency());
|
||||||
costHour += cost;
|
costHour += cost;
|
||||||
@@ -140,8 +140,7 @@ bool EnergyAccounting::update(AmsData* amsData) {
|
|||||||
if(kwhe > 0) {
|
if(kwhe > 0) {
|
||||||
if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf("(EnergyAccounting) Adding %.4f kWh export\n", kwhe);
|
if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf("(EnergyAccounting) Adding %.4f kWh export\n", kwhe);
|
||||||
produce += kwhe;
|
produce += kwhe;
|
||||||
if(getPriceForHour(0) != ENTSOE_NO_VALUE) {
|
if(price != ENTSOE_NO_VALUE) {
|
||||||
float price = getPriceForHour(0);
|
|
||||||
float income = price * kwhe;
|
float income = price * kwhe;
|
||||||
if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf("(EnergyAccounting) and %.4f %s\n", income / 100.0, eapi->getCurrency());
|
if(debugger->isActive(RemoteDebug::VERBOSE)) debugger->printf("(EnergyAccounting) and %.4f %s\n", income / 100.0, eapi->getCurrency());
|
||||||
incomeHour += income;
|
incomeHour += income;
|
||||||
|
|||||||
@@ -1521,6 +1521,8 @@ void configFileParse() {
|
|||||||
bool sEa = false;
|
bool sEa = false;
|
||||||
bool sDs = false;
|
bool sDs = false;
|
||||||
|
|
||||||
|
ds.load();
|
||||||
|
|
||||||
SystemConfig sys;
|
SystemConfig sys;
|
||||||
WiFiConfig wifi;
|
WiFiConfig wifi;
|
||||||
MqttConfig mqtt;
|
MqttConfig mqtt;
|
||||||
|
|||||||
Reference in New Issue
Block a user