Fix full status for secondary device groups

This commit is contained in:
Paul C Diem 2021-01-22 07:53:10 -06:00
parent 7c63f3e51c
commit bde7f3206e
2 changed files with 13 additions and 2 deletions

View File

@ -498,7 +498,12 @@ bool _SendDeviceGroupMessage(uint8_t device_group_index, DevGroupMessageType mes
building_status_message = true;
// Call the drivers to build the status update.
SendDeviceGroupMessage(device_group_index, DGR_MSGTYP_PARTIAL_UPDATE, DGR_ITEM_POWER, TasmotaGlobal.power);
power_t power = TasmotaGlobal.power;
if (Settings.flag4.multiple_device_groups) { // SetOption88 - Enable relays in separate device groups
power >>= device_group_index;
power &= 1;
}
SendDeviceGroupMessage(device_group_index, DGR_MSGTYP_PARTIAL_UPDATE, DGR_ITEM_POWER, power);
XdrvMailbox.index = 0;
if (device_group_index == 0 && first_device_group_is_local) XdrvMailbox.index = DGR_FLAG_LOCAL;
XdrvMailbox.command_code = DGR_ITEM_STATUS;

View File

@ -254,6 +254,12 @@ void PWMDimmerHandleDevGroupItem(void)
#endif // USE_PWM_DIMMER_REMOTE
SendLocalDeviceGroupMessage(DGR_MSGTYP_UPDATE, DGR_ITEM_BRI_POWER_ON, Settings.bri_power_on,
DGR_ITEM_BRI_PRESET_LOW, Settings.bri_preset_low, DGR_ITEM_BRI_PRESET_HIGH, Settings.bri_preset_high);
#ifdef USE_PWM_DIMMER_REMOTE
else
SendDeviceGroupMessage(device_group_index, DGR_MSGTYP_UPDATE, DGR_ITEM_POWER, remote_pwm_dimmer->power_on,
DGR_ITEM_BRI_POWER_ON, remote_pwm_dimmer->bri_power_on, DGR_ITEM_BRI_PRESET_LOW, remote_pwm_dimmer->bri_preset_low,
DGR_ITEM_BRI_PRESET_HIGH, remote_pwm_dimmer->bri_preset_high);
#endif // USE_PWM_DIMMER_REMOTE
break;
}
}
@ -614,7 +620,7 @@ void PWMDimmerHandleButton(uint32_t button_index, bool pressed)
char topic[TOPSZ];
sprintf_P(TasmotaGlobal.mqtt_data, PSTR("Trigger%u"), mqtt_trigger);
#ifdef USE_PWM_DIMMER_REMOTE
if (active_remote_pwm_dimmer) {
if (Settings.flag4.multiple_device_groups) {
snprintf_P(topic, sizeof(topic), PSTR("cmnd/%s/EVENT"), device_groups[power_button_index].group_name);
MqttPublish(topic);
}