From 52b373961487604c311b678166b3693092e2564f Mon Sep 17 00:00:00 2001 From: Paul C Diem Date: Mon, 16 Mar 2020 17:06:41 -0500 Subject: [PATCH 1/2] Check GroupTopic index, Fix response to include other groups --- tasmota/xdrv_02_mqtt.ino | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tasmota/xdrv_02_mqtt.ino b/tasmota/xdrv_02_mqtt.ino index adda72868..1d084862b 100644 --- a/tasmota/xdrv_02_mqtt.ino +++ b/tasmota/xdrv_02_mqtt.ino @@ -882,7 +882,8 @@ void CmndPublish(void) void CmndGroupTopic(void) { #ifdef USE_DEVICE_GROUPS - uint32_t settings_text_index = (XdrvMailbox.index <= 1 ? SET_MQTT_GRP_TOPIC : SET_MQTT_GRP_TOPIC2 + XdrvMailbox.index - 2); + if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= 4)) { + uint32_t settings_text_index = (XdrvMailbox.index <= 1 ? SET_MQTT_GRP_TOPIC : SET_MQTT_GRP_TOPIC2 + XdrvMailbox.index - 2); #endif // USE_DEVICE_GROUPS if (XdrvMailbox.data_len > 0) { MakeValidMqtt(0, XdrvMailbox.data); @@ -894,7 +895,12 @@ void CmndGroupTopic(void) #endif // USE_DEVICE_GROUPS restart_flag = 2; } +#ifdef USE_DEVICE_GROUPS + ResponseCmndChar(SettingsText(settings_text_index)); + } +#else // USE_DEVICE_GROUPS ResponseCmndChar(SettingsText(SET_MQTT_GRP_TOPIC)); +#endif // USE_DEVICE_GROUPS } void CmndTopic(void) From 6b632ef2804a8b9cfbbfc1a461e68e6fe2730e17 Mon Sep 17 00:00:00 2001 From: Paul C Diem Date: Mon, 16 Mar 2020 22:03:31 -0500 Subject: [PATCH 2/2] Only exec power cmd for local dev group --- tasmota/support_device_groups.ino | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tasmota/support_device_groups.ino b/tasmota/support_device_groups.ino index ed751fca1..f88bc5c93 100644 --- a/tasmota/support_device_groups.ino +++ b/tasmota/support_device_groups.ino @@ -591,12 +591,14 @@ void ProcessDeviceGroupMessage(char * packet, int packet_length) if (DeviceGroupItemShared(true, item)) { if (item == DGR_ITEM_POWER) { - uint8_t mask_devices = value >> 24; - if (mask_devices > devices_present) mask_devices = devices_present; - for (uint32_t i = 0; i < devices_present; i++) { - uint32_t mask = 1 << i; - bool on = (value & mask); - if (on != (power & mask)) ExecuteCommandPower(i + 1, (on ? POWER_ON : POWER_OFF), SRC_REMOTE); + if (device_group->local) { + uint8_t mask_devices = value >> 24; + if (mask_devices > devices_present) mask_devices = devices_present; + for (uint32_t i = 0; i < devices_present; i++) { + uint32_t mask = 1 << i; + bool on = (value & mask); + if (on != (power & mask)) ExecuteCommandPower(i + 1, (on ? POWER_ON : POWER_OFF), SRC_REMOTE); + } } } else {