Merge pull request #9483 from pcdiem/pwm4

Fix up/down tap not publishing tele
This commit is contained in:
Theo Arends 2020-10-07 08:53:32 +02:00 committed by GitHub
commit 267b5a7175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 7 deletions

View File

@ -507,6 +507,7 @@ void PWMDimmerHandleButton(void)
if (!button_was_held) { if (!button_was_held) {
bri_offset = (is_down_button ? -1 : 1); bri_offset = (is_down_button ? -1 : 1);
dgr_more_to_come = false; dgr_more_to_come = false;
state_updated = true;
} }
// If the button was held and the hold was not processed by a rule, we changed the // If the button was held and the hold was not processed by a rule, we changed the
@ -687,16 +688,17 @@ void PWMDimmerHandleButton(void)
SendDeviceGroupMessage(power_button_index, message_type, dgr_item, dgr_value); SendDeviceGroupMessage(power_button_index, message_type, dgr_item, dgr_value);
#endif // USE_DEVICE_GROUPS #endif // USE_DEVICE_GROUPS
#ifdef USE_PWM_DIMMER_REMOTE #ifdef USE_PWM_DIMMER_REMOTE
if (active_device_is_local) { if (active_device_is_local)
#endif // USE_PWM_DIMMER_REMOTE #endif // USE_PWM_DIMMER_REMOTE
light_controller.saveSettings(); light_controller.saveSettings();
if (state_updated && Settings.flag3.hass_tele_on_power) { // SetOption59 - Send tele/%topic%/STATE in addition to stat/%topic%/RESULT
MqttPublishTeleState();
}
#ifdef USE_PWM_DIMMER_REMOTE
}
#endif // USE_PWM_DIMMER_REMOTE
} }
if (state_updated)
#ifdef USE_PWM_DIMMER_REMOTE
if (active_device_is_local)
#endif // USE_PWM_DIMMER_REMOTE
if (Settings.flag3.hass_tele_on_power) // SetOption59 - Send tele/%topic%/STATE in addition to stat/%topic%/RESULT
MqttPublishTeleState();
} }
/*********************************************************************************************\ /*********************************************************************************************\