From 3d42fae8bdd07b3e7fab4c17f1e6d70eef398650 Mon Sep 17 00:00:00 2001 From: Paul C Diem Date: Fri, 29 May 2020 18:55:33 -0500 Subject: [PATCH] Fix SO88 incoming power state check --- tasmota/support_device_groups.ino | 3 +-- tasmota/support_tasmota.ino | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tasmota/support_device_groups.ino b/tasmota/support_device_groups.ino index 9572c9a6a..3e40f189f 100644 --- a/tasmota/support_device_groups.ino +++ b/tasmota/support_device_groups.ino @@ -387,7 +387,7 @@ void SendReceiveDeviceGroupMessage(struct device_group * device_group, struct de case DGR_ITEM_POWER: if (Settings.flag4.remote_device_mode) { // SetOption88 - Enable relays in separate device groups bool on = (value & 1); - if (on != (power & 1)) ExecuteCommandPower(device_group_index + 1, (on ? POWER_ON : POWER_OFF), SRC_REMOTE); + if (on != (power & (1 << device_group_index))) ExecuteCommandPower(device_group_index + 1, (on ? POWER_ON : POWER_OFF), SRC_REMOTE); } else if (device_group->local) { uint8_t mask_devices = value >> 24; @@ -396,7 +396,6 @@ void SendReceiveDeviceGroupMessage(struct device_group * device_group, struct de uint32_t mask = 1 << i; bool on = (value & mask); if (on != (power & mask)) ExecuteCommandPower(i + 1, (on ? POWER_ON : POWER_OFF), SRC_REMOTE); - if (Settings.flag4.remote_device_mode) break; // SetOption88 - Enable relays in separate device groups } } break; diff --git a/tasmota/support_tasmota.ino b/tasmota/support_tasmota.ino index 26341b416..3cbfb497c 100644 --- a/tasmota/support_tasmota.ino +++ b/tasmota/support_tasmota.ino @@ -573,7 +573,7 @@ void ExecuteCommandPower(uint32_t device, uint32_t state, uint32_t source) #ifdef USE_DEVICE_GROUPS if (SRC_REMOTE != source && SRC_RETRY != source) { if (Settings.flag4.remote_device_mode) // SetOption88 - Enable relays in separate device groups - SendDeviceGroupMessage(device - 1, DGR_MSGTYP_UPDATE, DGR_ITEM_POWER, (power >> device - 1) & 1 | 0x01000000); // Explicitly set number of relays to one + SendDeviceGroupMessage(device - 1, DGR_MSGTYP_UPDATE, DGR_ITEM_POWER, (power >> (device - 1)) & 1 | 0x01000000); // Explicitly set number of relays to one else SendLocalDeviceGroupMessage(DGR_MSGTYP_UPDATE, DGR_ITEM_POWER, power); }