KNX: Fix Energy Yesterday Value

This commit is contained in:
Adrian Scillato 2021-04-13 16:58:27 -03:00 committed by GitHub
parent 06ac5c4053
commit 07265e36cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 7 deletions

View File

@ -107,7 +107,7 @@ device_parameters_t device_param[] = {
{ KNX_ENERGY_POWER , false, false, KNX_Empty },
{ KNX_ENERGY_POWERFACTOR , false, false, KNX_Empty },
{ KNX_ENERGY_DAILY , false, false, KNX_Empty },
{ KNX_ENERGY_START , false, false, KNX_Empty },
{ KNX_ENERGY_YESTERDAY , false, false, KNX_Empty },
{ KNX_ENERGY_TOTAL , false, false, KNX_Empty },
{ KNX_SLOT1 , false, false, KNX_Empty },
{ KNX_SLOT2 , false, false, KNX_Empty },
@ -501,7 +501,7 @@ void KNX_INIT(void)
if ( TasmotaGlobal.energy_driver != ENERGY_NONE ) {
device_param[KNX_ENERGY_POWER-1].show = true;
device_param[KNX_ENERGY_DAILY-1].show = true;
device_param[KNX_ENERGY_START-1].show = true;
device_param[KNX_ENERGY_YESTERDAY-1].show = true;
device_param[KNX_ENERGY_TOTAL-1].show = true;
device_param[KNX_ENERGY_VOLTAGE-1].show = true;
device_param[KNX_ENERGY_CURRENT-1].show = true;
@ -684,13 +684,14 @@ void KNX_CB_Action(message_t const &msg, void *arg)
}
}
}
else if (chan->type == KNX_ENERGY_START) // Reply KNX_ENERGY_START
else if (chan->type == KNX_ENERGY_YESTERDAY) // Reply KNX_ENERGY_YESTERDAY
{
if (Energy.data_valid[0]) {
knx.answer_4byte_float(msg.received_on, Energy.start_energy);
float energy_kWhyesterday = (float)Settings.energy_kWhyesterday / 100000;
knx.answer_4byte_float(msg.received_on, energy_kWhyesterday);
if (Settings.flag.knx_enable_enhancement) {
knx.answer_4byte_float(msg.received_on, Energy.start_energy);
knx.answer_4byte_float(msg.received_on, Energy.start_energy);
knx.answer_4byte_float(msg.received_on, energy_kWhyesterday);
knx.answer_4byte_float(msg.received_on, energy_kWhyesterday);
}
}
}
@ -813,7 +814,7 @@ void KnxSensor(uint8_t sensor_type, float value)
knx.write_4byte_float(KNX_addr, value);
}
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s " D_SENT_TO " %d.%d.%d "),
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s " D_SENT_TO " %d.%d.%d"),
device_param_ga[sensor_type -1],
KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member);