mirror of https://github.com/arendst/Tasmota.git
Merge pull request #11718 from ascillato/KNX_Fix_EnergyYesterday
KNX: Fix Energy Yesterday Value
This commit is contained in:
commit
4fce3cff7b
|
@ -234,7 +234,7 @@ const uint32_t LOOP_SLEEP_DELAY = 50; // Lowest number of milliseconds to
|
|||
#define KNX_ENERGY_POWER 21
|
||||
#define KNX_ENERGY_POWERFACTOR 22
|
||||
#define KNX_ENERGY_DAILY 23
|
||||
#define KNX_ENERGY_START 24
|
||||
#define KNX_ENERGY_YESTERDAY 24
|
||||
#define KNX_ENERGY_TOTAL 25
|
||||
#define KNX_SLOT1 26
|
||||
#define KNX_SLOT2 27
|
||||
|
|
|
@ -1144,7 +1144,7 @@ void EnergyShow(bool json)
|
|||
}
|
||||
KnxSensor(KNX_ENERGY_DAILY, Energy.daily);
|
||||
KnxSensor(KNX_ENERGY_TOTAL, Energy.total);
|
||||
KnxSensor(KNX_ENERGY_START, Energy.start_energy);
|
||||
KnxSensor(KNX_ENERGY_YESTERDAY, (float)Settings.energy_kWhyesterday / 100000);
|
||||
}
|
||||
#endif // USE_KNX
|
||||
#ifdef USE_WEBSERVER
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue