From 60252a9043b9a31cb699f8826f21c296c6e6dec2 Mon Sep 17 00:00:00 2001 From: Paul C Diem Date: Tue, 9 Feb 2021 15:10:32 -0600 Subject: [PATCH] Add DGR device map support --- tasmota/i18n.h | 1 + tasmota/settings.h | 2 +- tasmota/settings.ino | 3 ++ tasmota/support_command.ino | 16 +++++++-- tasmota/support_device_groups.ino | 57 +++++++++++++++++-------------- tasmota/support_tasmota.ino | 9 ++--- tasmota/tasmota_globals.h | 1 - tasmota/tasmota_version.h | 2 +- tasmota/xdrv_04_light.ino | 23 +++++-------- tasmota/xdrv_10_rules.ino | 2 +- tasmota/xdrv_35_pwm_dimmer.ino | 15 ++++---- 11 files changed, 73 insertions(+), 58 deletions(-) diff --git a/tasmota/i18n.h b/tasmota/i18n.h index 0eb558bbe..8976c769f 100644 --- a/tasmota/i18n.h +++ b/tasmota/i18n.h @@ -324,6 +324,7 @@ #define D_CMND_SPEEDUNIT "SpeedUnit" #define D_CMND_I2CSCAN "I2CScan" #define D_CMND_I2CDRIVER "I2CDriver" +#define D_CMND_DEVGROUP_DEVICE "DevGroupDevice" #define D_CMND_DEVGROUP_NAME "DevGroupName" #define D_CMND_DEVGROUP_SEND "DevGroupSend" #define D_CMND_DEVGROUP_SHARE "DevGroupShare" diff --git a/tasmota/settings.h b/tasmota/settings.h index 2719268ea..4ddcb90b0 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -631,7 +631,7 @@ struct { // Only 32 bit boundary variables below uint64_t rf_protocol_mask; // FA8 - uint32_t device_group_maps; // FB0 + uint8_t device_group_device[4]; // FB0 SysBitfield5 flag5; // FB4 uint16_t pulse_counter_debounce_low; // FB8 uint16_t pulse_counter_debounce_high; // FBA diff --git a/tasmota/settings.ino b/tasmota/settings.ino index 9878e7678..a9c7500b5 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -1232,6 +1232,9 @@ void SettingsDelta(void) { Settings.interlock[i] = (i < 4) ? Settings.ex_interlock[i] : 0; } } + if (Settings.version < 0x09020007) { + *(uint32_t *)&Settings.device_group_device = 0x04030201; + } Settings.version = VERSION; SettingsSave(1); diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index 7272cd2ab..5d3e20559 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -32,7 +32,7 @@ const char kTasmotaCommands[] PROGMEM = "|" // No prefix D_CMND_I2CSCAN "|" D_CMND_I2CDRIVER "|" #endif #ifdef USE_DEVICE_GROUPS - D_CMND_DEVGROUP_NAME "|" + D_CMND_DEVGROUP_DEVICE "|" D_CMND_DEVGROUP_NAME "|" #ifdef USE_DEVICE_GROUPS_SEND D_CMND_DEVGROUP_SEND "|" #endif // USE_DEVICE_GROUPS_SEND @@ -59,7 +59,7 @@ void (* const TasmotaCommand[])(void) PROGMEM = { &CmndI2cScan, CmndI2cDriver, #endif #ifdef USE_DEVICE_GROUPS - &CmndDevGroupName, + &CmndDevGroupDevice, &CmndDevGroupName, #ifdef USE_DEVICE_GROUPS_SEND &CmndDevGroupSend, #endif // USE_DEVICE_GROUPS_SEND @@ -2052,6 +2052,16 @@ void CmndI2cDriver(void) #endif // USE_I2C #ifdef USE_DEVICE_GROUPS +void CmndDevGroupDevice(void) +{ + if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_DEV_GROUP_NAMES)) { + if (XdrvMailbox.data_len > 0) { + Settings.device_group_device[XdrvMailbox.index - 1] = XdrvMailbox.payload; + } + ResponseCmndIdxNumber(Settings.device_group_device[XdrvMailbox.index - 1]); + } +} + void CmndDevGroupName(void) { if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_DEV_GROUP_NAMES)) { @@ -2072,7 +2082,7 @@ void CmndDevGroupSend(void) { uint8_t device_group_index = (XdrvMailbox.usridx ? XdrvMailbox.index - 1 : 0); if (device_group_index < device_group_count) { - if (!_SendDeviceGroupMessage(device_group_index, (DevGroupMessageType)(DGR_MSGTYPE_UPDATE_COMMAND + DGR_MSGTYPFLAG_WITH_LOCAL))) { + if (!_SendDeviceGroupMessage(-device_group_index, (DevGroupMessageType)(DGR_MSGTYPE_UPDATE_COMMAND + DGR_MSGTYPFLAG_WITH_LOCAL))) { ResponseCmndChar(XdrvMailbox.data); } } diff --git a/tasmota/support_device_groups.ino b/tasmota/support_device_groups.ino index cef0dd3af..13f5522c8 100644 --- a/tasmota/support_device_groups.ino +++ b/tasmota/support_device_groups.ino @@ -448,7 +448,7 @@ write_log: if (received) { if ((flags & DGR_FLAG_STATUS_REQUEST)) { if ((flags & DGR_FLAG_RESET) || device_group_member->acked_sequence != device_group->last_full_status_sequence) { - _SendDeviceGroupMessage(device_group_index, DGR_MSGTYP_FULL_STATUS); + _SendDeviceGroupMessage(-device_group_index, DGR_MSGTYP_FULL_STATUS); } } } @@ -479,7 +479,7 @@ cleanup: } } -bool _SendDeviceGroupMessage(uint8_t device_group_index, DevGroupMessageType message_type, ...) +bool _SendDeviceGroupMessage(uint32_t device, DevGroupMessageType message_type, ...) { // If device groups is not up, ignore this request. if (!device_groups_up) return 1; @@ -492,11 +492,16 @@ bool _SendDeviceGroupMessage(uint8_t device_group_index, DevGroupMessageType mes if (ignore_dgr_sends && message_type != DGR_MSGTYPE_UPDATE_COMMAND) return 0; // If device is < 0, the device group index is the device negated. If not, get the device group - // index from the device group maps. -// uint8_t device_group_index = -device; -// if (device > 0) device_group_index = (Settings.device_group_maps >> (device - 1) * 3 & 0x7 - 1; - - // If the device group index is higher then the number of device groups, ignore this request. + // index for this device. + uint8_t device_group_index = -device; + if (device > 0) { + device_group_index = 0; + if (Settings.flag4.multiple_device_groups) { // SetOption88 - Enable relays in separate device groups + for (; device_group_index < device_group_count; device_group_index++) { + if (Settings.device_group_device[device_group_index] == device) break; + } + } + } if (device_group_index >= device_group_count) return 0; // Get a pointer to the device information for this device. @@ -507,7 +512,7 @@ bool _SendDeviceGroupMessage(uint8_t device_group_index, DevGroupMessageType mes // Load the message header, sequence and flags. #ifdef DEVICE_GROUPS_DEBUG - AddLog(LOG_LEVEL_DEBUG, PSTR("DGR: Building %s %spacket"), device_group->group_name, (message_type == DGR_MSGTYP_FULL_STATUS ? PSTR("full status ") : PSTR(""))); + AddLog(LOG_LEVEL_DEBUG, PSTR("DGR: Building %s %spacket"), device_group->group_name, (message_type == DGR_MSGTYP_FULL_STATUS ? PSTR("full status ") : PSTR(""))); #endif // DEVICE_GROUPS_DEBUG uint16_t original_sequence = device_group->outgoing_sequence; uint16_t flags = 0; @@ -531,10 +536,9 @@ bool _SendDeviceGroupMessage(uint8_t device_group_index, DevGroupMessageType mes // Call the drivers to build the status update. power_t power = TasmotaGlobal.power; if (Settings.flag4.multiple_device_groups) { // SetOption88 - Enable relays in separate device groups - power >>= device_group_index; - power &= 1; + power = (power >> (Settings.device_group_device[device_group_index] - 1)) & 1; } - SendDeviceGroupMessage(device_group_index, DGR_MSGTYP_PARTIAL_UPDATE, DGR_ITEM_NO_STATUS_SHARE, device_group->no_status_share, DGR_ITEM_POWER, power); + SendDeviceGroupMessage(-device_group_index, DGR_MSGTYP_PARTIAL_UPDATE, DGR_ITEM_NO_STATUS_SHARE, device_group->no_status_share, DGR_ITEM_POWER, power); XdrvMailbox.index = 0; if (device_group_index == 0 && first_device_group_is_local) XdrvMailbox.index = DGR_FLAG_LOCAL; XdrvMailbox.command_code = DGR_ITEM_STATUS; @@ -620,22 +624,25 @@ bool _SendDeviceGroupMessage(uint8_t device_group_index, DevGroupMessageType mes switch (item) { case DGR_ITEM_LIGHT_CHANNELS: { - int i = 0; char * endptr; value = strtoul((char *)value_ptr, &endptr, 10); - if ((*endptr && *endptr != ',' && *endptr != ' ') || value > 255) { - for (; i < 6; i++) { - if (!*value_ptr || *value_ptr == ' ') break; - uint8_t * next_value_ptr = value_ptr + 2; - uint8_t save_char = *next_value_ptr; - *next_value_ptr = 'X'; - *out_ptr++ = strtoul((char *)value_ptr, (char **)&value_ptr, 16); - *next_value_ptr = save_char; + bool hex = (*endptr != ','); + for (int i = 0; i < 6; i++) { + *out_ptr = 0; + if (*value_ptr != ' ') { + if (hex) { + endptr = (char *)value_ptr + 2; + chr = *endptr; + *endptr = 0; + *out_ptr = strtoul((char *)value_ptr, (char **)&value_ptr, 16); + *endptr = chr; + } + else { + *out_ptr = strtoul((char *)value_ptr, (char **)&value_ptr, 10); + if (*value_ptr == ',') value_ptr++; + } } - } - for (; i < 6; i++) { - *out_ptr++ = (*value_ptr == ' ' ? 0 : strtoul((char *)value_ptr, (char **)&value_ptr, 10)); - if (*value_ptr == ',') value_ptr++; + out_ptr++; } } break; @@ -933,7 +940,7 @@ AddLog(LOG_LEVEL_DEBUG, PSTR("DGR: Checking next_check_time=%u, now=%u"), next_c // If we've sent the initial status request message the set number of times, send our // status to all the members. else { - _SendDeviceGroupMessage(device_group_index, DGR_MSGTYP_FULL_STATUS); + _SendDeviceGroupMessage(-device_group_index, DGR_MSGTYP_FULL_STATUS); } } diff --git a/tasmota/support_tasmota.ino b/tasmota/support_tasmota.ino index f7c859ee7..807c794ed 100644 --- a/tasmota/support_tasmota.ino +++ b/tasmota/support_tasmota.ino @@ -586,10 +586,11 @@ void ExecuteCommandPower(uint32_t device, uint32_t state, uint32_t source) } #ifdef USE_DEVICE_GROUPS if (TasmotaGlobal.power != old_power && SRC_REMOTE != source && SRC_RETRY != source) { - if (Settings.flag4.multiple_device_groups) // SetOption88 - Enable relays in separate device groups - SendDeviceGroupMessage(device - 1, DGR_MSGTYP_UPDATE, DGR_ITEM_POWER, (TasmotaGlobal.power >> (device - 1)) & 1 | 0x01000000); // Explicitly set number of relays to one - else - SendLocalDeviceGroupMessage(DGR_MSGTYP_UPDATE, DGR_ITEM_POWER, TasmotaGlobal.power); + power_t dgr_power = TasmotaGlobal.power; + if (Settings.flag4.multiple_device_groups) { // SetOption88 - Enable relays in separate device groups + dgr_power = (dgr_power >> (device - 1)) & 1; + } + SendDeviceGroupMessage(device, DGR_MSGTYP_UPDATE, DGR_ITEM_POWER, TasmotaGlobal.power); } #endif // USE_DEVICE_GROUPS SetDevicePower(TasmotaGlobal.power, source); diff --git a/tasmota/tasmota_globals.h b/tasmota/tasmota_globals.h index 8058db126..71e345b2b 100644 --- a/tasmota/tasmota_globals.h +++ b/tasmota/tasmota_globals.h @@ -471,7 +471,6 @@ const char kWebColors[] PROGMEM = #ifdef USE_DEVICE_GROUPS #define SendDeviceGroupMessage(DEVICE_INDEX, REQUEST_TYPE, ...) _SendDeviceGroupMessage(DEVICE_INDEX, REQUEST_TYPE, __VA_ARGS__, 0) -#define SendLocalDeviceGroupMessage(REQUEST_TYPE, ...) _SendDeviceGroupMessage(0, REQUEST_TYPE, __VA_ARGS__, 0) uint8_t device_group_count = 0; bool first_device_group_is_local = true; #endif // USE_DEVICE_GROUPS diff --git a/tasmota/tasmota_version.h b/tasmota/tasmota_version.h index e0ccb2a6b..ec0ef2dcf 100644 --- a/tasmota/tasmota_version.h +++ b/tasmota/tasmota_version.h @@ -20,6 +20,6 @@ #ifndef _TASMOTA_VERSION_H_ #define _TASMOTA_VERSION_H_ -const uint32_t VERSION = 0x09020006; +const uint32_t VERSION = 0x09020007; #endif // _TASMOTA_VERSION_H_ diff --git a/tasmota/xdrv_04_light.ino b/tasmota/xdrv_04_light.ino index 102d36fa8..48ba6cfce 100644 --- a/tasmota/xdrv_04_light.ino +++ b/tasmota/xdrv_04_light.ino @@ -234,7 +234,6 @@ struct LIGHT { bool fade_initialized = false; // dont't fade at startup bool fade_running = false; #ifdef USE_DEVICE_GROUPS - uint8_t device_group_index; uint8_t last_scheme = 0; bool devgrp_no_channels_out = false; // don't share channels with device group (e.g. if scheme set by other device) #ifdef USE_DGR_LIGHT_SEQUENCE @@ -1118,12 +1117,6 @@ void LightInit(void) Light.device--; // we take the last two devices as lights } LightCalcPWMRange(); -#ifdef USE_DEVICE_GROUPS - Light.device_group_index = 0; - if (Settings.flag4.multiple_device_groups) { // SetOption88 - Enable relays in separate device groups - Light.device_group_index = Light.device - 1; - } -#endif // USE_DEVICE_GROUPS #ifdef DEBUG_LIGHT AddLog_P(LOG_LEVEL_DEBUG_MORE, "LightInit Light.pwm_multi_channels=%d Light.subtype=%d Light.device=%d TasmotaGlobal.devices_present=%d", Light.pwm_multi_channels, Light.subtype, Light.device, TasmotaGlobal.devices_present); @@ -1708,7 +1701,7 @@ void LightAnimate(void) #ifdef USE_DEVICE_GROUPS if (Settings.light_scheme != Light.last_scheme) { Light.last_scheme = Settings.light_scheme; - SendDeviceGroupMessage(Light.device_group_index, DGR_MSGTYP_UPDATE, DGR_ITEM_LIGHT_SCHEME, Settings.light_scheme); + SendDeviceGroupMessage(Light.device, DGR_MSGTYP_UPDATE, DGR_ITEM_LIGHT_SCHEME, Settings.light_scheme); Light.devgrp_no_channels_out = false; } #endif // USE_DEVICE_GROUPS @@ -2188,12 +2181,12 @@ void LightSendDeviceGroupStatus() if (building_status_message || memcmp(channels, last_channels, LST_MAX)) { memcpy(last_channels, channels, LST_MAX); last_channels[LST_MAX]++; - SendDeviceGroupMessage(Light.device_group_index, (send_bri_update ? DGR_MSGTYP_PARTIAL_UPDATE : DGR_MSGTYP_UPDATE), DGR_ITEM_LIGHT_CHANNELS, last_channels); + SendDeviceGroupMessage(Light.device, (send_bri_update ? DGR_MSGTYP_PARTIAL_UPDATE : DGR_MSGTYP_UPDATE), DGR_ITEM_LIGHT_CHANNELS, last_channels); } } if (send_bri_update) { last_bri = bri; - SendDeviceGroupMessage(Light.device_group_index, DGR_MSGTYP_UPDATE, DGR_ITEM_LIGHT_BRI, light_state.getBri()); + SendDeviceGroupMessage(Light.device, DGR_MSGTYP_UPDATE, DGR_ITEM_LIGHT_BRI, light_state.getBri()); } } @@ -2202,7 +2195,7 @@ void LightHandleDevGroupItem(void) static bool send_state = false; static bool restore_power = false; - if (*XdrvMailbox.topic != Light.device_group_index) return; + if (Settings.device_group_device[*XdrvMailbox.topic] != Light.device) return; bool more_to_come; uint32_t value = XdrvMailbox.payload; switch (XdrvMailbox.command_code) { @@ -2318,7 +2311,7 @@ void LightHandleDevGroupItem(void) } break; case DGR_ITEM_STATUS: - SendLocalDeviceGroupMessage(DGR_MSGTYP_PARTIAL_UPDATE, DGR_ITEM_LIGHT_FADE, Settings.light_fade, + SendDeviceGroupMessage(Light.device, DGR_MSGTYP_PARTIAL_UPDATE, DGR_ITEM_LIGHT_FADE, Settings.light_fade, DGR_ITEM_LIGHT_SPEED, Settings.light_speed, DGR_ITEM_LIGHT_SCHEME, Settings.light_scheme); LightSendDeviceGroupStatus(); break; @@ -2742,7 +2735,7 @@ void CmndDimmer(void) uint8_t bri = light_state.getBri(); if (bri != Settings.bri_power_on) { Settings.bri_power_on = bri; - SendDeviceGroupMessage(Light.device_group_index, DGR_MSGTYP_PARTIAL_UPDATE, DGR_ITEM_BRI_POWER_ON, Settings.bri_power_on); + SendDeviceGroupMessage(Light.device, DGR_MSGTYP_PARTIAL_UPDATE, DGR_ITEM_BRI_POWER_ON, Settings.bri_power_on); } #endif // USE_PWM_DIMMER && USE_DEVICE_GROUPS Light.update = true; @@ -2849,7 +2842,7 @@ void CmndFade(void) break; } #ifdef USE_DEVICE_GROUPS - if (XdrvMailbox.payload >= 0 && XdrvMailbox.payload <= 2) SendDeviceGroupMessage(Light.device_group_index, DGR_MSGTYP_UPDATE, DGR_ITEM_LIGHT_FADE, Settings.light_fade); + if (XdrvMailbox.payload >= 0 && XdrvMailbox.payload <= 2) SendDeviceGroupMessage(Light.device, DGR_MSGTYP_UPDATE, DGR_ITEM_LIGHT_FADE, Settings.light_fade); #endif // USE_DEVICE_GROUPS if (!Settings.light_fade) { Light.fade_running = false; } ResponseCmndStateText(Settings.light_fade); @@ -2883,7 +2876,7 @@ void CmndSpeed(void) if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload <= 40)) { Settings.light_speed = XdrvMailbox.payload; #ifdef USE_DEVICE_GROUPS - SendDeviceGroupMessage(Light.device_group_index, DGR_MSGTYP_UPDATE, DGR_ITEM_LIGHT_SPEED, Settings.light_speed); + SendDeviceGroupMessage(Light.device, DGR_MSGTYP_UPDATE, DGR_ITEM_LIGHT_SPEED, Settings.light_speed); #endif // USE_DEVICE_GROUPS } ResponseCmndNumber(Settings.light_speed); diff --git a/tasmota/xdrv_10_rules.ino b/tasmota/xdrv_10_rules.ino index fc52aee8a..cdf374a27 100644 --- a/tasmota/xdrv_10_rules.ino +++ b/tasmota/xdrv_10_rules.ino @@ -2191,7 +2191,7 @@ void CmndEvent(void) if (XdrvMailbox.data_len > 0) { strlcpy(Rules.event_data, XdrvMailbox.data, sizeof(Rules.event_data)); #ifdef USE_DEVICE_GROUPS - SendLocalDeviceGroupMessage(DGR_MSGTYP_UPDATE, DGR_ITEM_EVENT, XdrvMailbox.data); + SendDeviceGroupMessage(1, DGR_MSGTYP_UPDATE, DGR_ITEM_EVENT, XdrvMailbox.data); #endif // USE_DEVICE_GROUPS } if (XdrvMailbox.command) ResponseCmndDone(); diff --git a/tasmota/xdrv_35_pwm_dimmer.ino b/tasmota/xdrv_35_pwm_dimmer.ino index 3bce167a2..892f05da9 100644 --- a/tasmota/xdrv_35_pwm_dimmer.ino +++ b/tasmota/xdrv_35_pwm_dimmer.ino @@ -252,11 +252,11 @@ void PWMDimmerHandleDevGroupItem(void) #ifdef USE_PWM_DIMMER_REMOTE if (is_local) #endif // USE_PWM_DIMMER_REMOTE - SendLocalDeviceGroupMessage(DGR_MSGTYP_UPDATE, DGR_ITEM_BRI_POWER_ON, Settings.bri_power_on, + SendDeviceGroupMessage(0, DGR_MSGTYP_UPDATE, DGR_ITEM_BRI_POWER_ON, Settings.bri_power_on, DGR_ITEM_BRI_PRESET_LOW, Settings.bri_preset_low, DGR_ITEM_BRI_PRESET_HIGH, Settings.bri_preset_high); #ifdef USE_PWM_DIMMER_REMOTE else - SendDeviceGroupMessage(device_group_index, DGR_MSGTYP_UPDATE, DGR_ITEM_POWER, remote_pwm_dimmer->power_on, + SendDeviceGroupMessage(-device_group_index, DGR_MSGTYP_UPDATE, DGR_ITEM_POWER, remote_pwm_dimmer->power_on, DGR_ITEM_BRI_POWER_ON, remote_pwm_dimmer->bri_power_on, DGR_ITEM_BRI_PRESET_LOW, remote_pwm_dimmer->bri_preset_low, DGR_ITEM_BRI_PRESET_HIGH, remote_pwm_dimmer->bri_preset_high); #endif // USE_PWM_DIMMER_REMOTE @@ -491,6 +491,7 @@ void PWMDimmerHandleButton(uint32_t button_index, bool pressed) } // If we need to adjust the brightness, do it. + uint32_t negated_device_group_index = -power_button_index; if (bri_offset) { int32_t bri; #ifdef USE_PWM_DIMMER_REMOTE @@ -509,7 +510,7 @@ void PWMDimmerHandleButton(uint32_t button_index, bool pressed) } if (new_bri != bri) { #ifdef USE_DEVICE_GROUPS - SendDeviceGroupMessage(power_button_index, (dgr_more_to_come ? DGR_MSGTYP_UPDATE_MORE_TO_COME : DGR_MSGTYP_UPDATE_DIRECT), DGR_ITEM_LIGHT_BRI, new_bri); + SendDeviceGroupMessage(negated_device_group_index, (dgr_more_to_come ? DGR_MSGTYP_UPDATE_MORE_TO_COME : DGR_MSGTYP_UPDATE_DIRECT), DGR_ITEM_LIGHT_BRI, new_bri); #endif // USE_DEVICE_GROUPS #ifdef USE_PWM_DIMMER_REMOTE if (active_remote_pwm_dimmer) { @@ -559,9 +560,9 @@ void PWMDimmerHandleButton(uint32_t button_index, bool pressed) } #endif // USE_PWM_DIMMER_REMOTE if (new_power) - SendDeviceGroupMessage(power_button_index, DGR_MSGTYP_UPDATE, DGR_ITEM_LIGHT_BRI, power_on_bri, DGR_ITEM_POWER, new_power); + SendDeviceGroupMessage(negated_device_group_index, DGR_MSGTYP_UPDATE, DGR_ITEM_LIGHT_BRI, power_on_bri, DGR_ITEM_POWER, new_power); else - SendDeviceGroupMessage(power_button_index, DGR_MSGTYP_UPDATE, DGR_ITEM_POWER, new_power); + SendDeviceGroupMessage(negated_device_group_index, DGR_MSGTYP_UPDATE, DGR_ITEM_POWER, new_power); #endif // USE_DEVICE_GROUPS #ifdef USE_PWM_DIMMER_REMOTE if (active_remote_pwm_dimmer) @@ -639,7 +640,7 @@ void PWMDimmerHandleButton(uint32_t button_index, bool pressed) if (handle_tap) #endif // USE_PWM_DIMMER_REMOTE message_type = (DevGroupMessageType)(message_type + DGR_MSGTYPFLAG_WITH_LOCAL); - SendDeviceGroupMessage(power_button_index, message_type, dgr_item, dgr_value); + SendDeviceGroupMessage(negated_device_group_index, message_type, dgr_item, dgr_value); #endif // USE_DEVICE_GROUPS #ifdef USE_PWM_DIMMER_REMOTE if (!active_remote_pwm_dimmer) @@ -697,7 +698,7 @@ void CmndBriPreset(void) Settings.bri_preset_high = parm[0]; } #ifdef USE_DEVICE_GROUPS - SendLocalDeviceGroupMessage(DGR_MSGTYP_UPDATE, DGR_ITEM_BRI_PRESET_LOW, Settings.bri_preset_low, DGR_ITEM_BRI_PRESET_HIGH, Settings.bri_preset_high); + SendDeviceGroupMessage(0, DGR_MSGTYP_UPDATE, DGR_ITEM_BRI_PRESET_LOW, Settings.bri_preset_low, DGR_ITEM_BRI_PRESET_HIGH, Settings.bri_preset_high); #endif // USE_DEVICE_GROUPS } }