diff --git a/tasmota/support_device_groups.ino b/tasmota/support_device_groups.ino index 13f5522c8..36ad56db5 100644 --- a/tasmota/support_device_groups.ino +++ b/tasmota/support_device_groups.ino @@ -401,9 +401,10 @@ void SendReceiveDeviceGroupMessage(struct device_group * device_group, struct de switch (item) { case DGR_ITEM_POWER: if (Settings.flag4.multiple_device_groups) { // SetOption88 - Enable relays in separate device groups - if (device_group_index < TasmotaGlobal.devices_present) { + uint32_t device = Settings.device_group_device[device_group_index]; + if (device) { bool on = (value & 1); - if (on != (TasmotaGlobal.power & (1 << device_group_index))) ExecuteCommandPower(device_group_index + 1, (on ? POWER_ON : POWER_OFF), SRC_REMOTE); + if (on != ((TasmotaGlobal.power >> (device - 1)) & 1)) ExecuteCommandPower(device, (on ? POWER_ON : POWER_OFF), SRC_REMOTE); } } else if (XdrvMailbox.index & DGR_FLAG_LOCAL) { diff --git a/tasmota/support_tasmota.ino b/tasmota/support_tasmota.ino index 807c794ed..07f776f5c 100644 --- a/tasmota/support_tasmota.ino +++ b/tasmota/support_tasmota.ino @@ -590,7 +590,7 @@ void ExecuteCommandPower(uint32_t device, uint32_t state, uint32_t source) 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); + SendDeviceGroupMessage(device, DGR_MSGTYP_UPDATE, DGR_ITEM_POWER, dgr_power); } #endif // USE_DEVICE_GROUPS SetDevicePower(TasmotaGlobal.power, source);