KNX: Added Read reply for Power

This commit is contained in:
Adrian Scillato 2020-11-16 17:55:16 -03:00 committed by GitHub
parent d237bc4294
commit 2e06647ea4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 70 additions and 0 deletions

View File

@ -644,6 +644,76 @@ void KNX_CB_Action(message_t const &msg, void *arg)
knx.answer_4byte_float(msg.received_on, last_hum); knx.answer_4byte_float(msg.received_on, last_hum);
} }
} }
else if (chan->type == KNX_ENERGY_VOLTAGE) // Reply KNX_ENERGY_VOLTAGE
{
if (Energy.data_valid[0]) {
knx.answer_4byte_float(msg.received_on, Energy.voltage[0]);
if (Settings.flag.knx_enable_enhancement) {
knx.answer_4byte_float(msg.received_on, Energy.voltage[0]);
knx.answer_4byte_float(msg.received_on, Energy.voltage[0]);
}
}
}
else if (chan->type == KNX_ENERGY_CURRENT) // Reply KNX_ENERGY_CURRENT
{
if (Energy.data_valid[0]) {
knx.answer_4byte_float(msg.received_on, Energy.current[0]);
if (Settings.flag.knx_enable_enhancement) {
knx.answer_4byte_float(msg.received_on, Energy.current[0]);
knx.answer_4byte_float(msg.received_on, Energy.current[0]);
}
}
}
else if (chan->type == KNX_ENERGY_POWER) // Reply KNX_ENERGY_POWER
{
if (Energy.data_valid[0]) {
knx.answer_4byte_float(msg.received_on, Energy.active_power[0]);
if (Settings.flag.knx_enable_enhancement) {
knx.answer_4byte_float(msg.received_on, Energy.active_power[0]);
knx.answer_4byte_float(msg.received_on, Energy.active_power[0]);
}
}
}
else if (chan->type == KNX_ENERGY_POWERFACTOR) // Reply KNX_ENERGY_POWERFACTOR
{
if (Energy.data_valid[0]) {
knx.answer_4byte_float(msg.received_on, Energy.power_factor[0]);
if (Settings.flag.knx_enable_enhancement) {
knx.answer_4byte_float(msg.received_on, Energy.power_factor[0]);
knx.answer_4byte_float(msg.received_on, Energy.power_factor[0]);
}
}
}
else if (chan->type == KNX_ENERGY_START) // Reply KNX_ENERGY_START
{
if (Energy.data_valid[0]) {
knx.answer_4byte_float(msg.received_on, Energy.start_energy);
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);
}
}
}
else if (chan->type == KNX_ENERGY_DAILY) // Reply KNX_ENERGY_DAILY
{
if (Energy.data_valid[0]) {
knx.answer_4byte_float(msg.received_on, Energy.daily);
if (Settings.flag.knx_enable_enhancement) {
knx.answer_4byte_float(msg.received_on, Energy.daily);
knx.answer_4byte_float(msg.received_on, Energy.daily);
}
}
}
else if (chan->type == KNX_ENERGY_TOTAL) // Reply KNX_ENERGY_TOTAL
{
if (Energy.data_valid[0]) {
knx.answer_4byte_float(msg.received_on, Energy.total);
if (Settings.flag.knx_enable_enhancement) {
knx.answer_4byte_float(msg.received_on, Energy.total);
knx.answer_4byte_float(msg.received_on, Energy.total);
}
}
}
#ifdef USE_RULES #ifdef USE_RULES
else if ((chan->type >= KNX_SLOT1) && (chan->type <= KNX_SLOT5)) // KNX RX SLOTs (read command) else if ((chan->type >= KNX_SLOT1) && (chan->type <= KNX_SLOT5)) // KNX RX SLOTs (read command)
{ {