mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 03:06:33 +00:00
Use device map for received power item
This commit is contained in:
parent
60252a9043
commit
133826c331
@ -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) {
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user