Only exec power cmd for local dev group

This commit is contained in:
Paul C Diem 2020-03-16 22:03:31 -05:00
parent 9b0fc0985b
commit 6b632ef280
1 changed files with 8 additions and 6 deletions

View File

@ -591,12 +591,14 @@ void ProcessDeviceGroupMessage(char * packet, int packet_length)
if (DeviceGroupItemShared(true, item)) { if (DeviceGroupItemShared(true, item)) {
if (item == DGR_ITEM_POWER) { if (item == DGR_ITEM_POWER) {
uint8_t mask_devices = value >> 24; if (device_group->local) {
if (mask_devices > devices_present) mask_devices = devices_present; uint8_t mask_devices = value >> 24;
for (uint32_t i = 0; i < devices_present; i++) { if (mask_devices > devices_present) mask_devices = devices_present;
uint32_t mask = 1 << i; for (uint32_t i = 0; i < devices_present; i++) {
bool on = (value & mask); uint32_t mask = 1 << i;
if (on != (power & mask)) ExecuteCommandPower(i + 1, (on ? POWER_ON : POWER_OFF), SRC_REMOTE); bool on = (value & mask);
if (on != (power & mask)) ExecuteCommandPower(i + 1, (on ? POWER_ON : POWER_OFF), SRC_REMOTE);
}
} }
} }
else { else {