Fix switchmode 15 publish old switch state

The forced MqttPublishSensor() was send an immediate SENSOR message with the switch's last_state.
So the last_state must be updated before the SENSOR message is sent.
This commit is contained in:
Barbudor 2020-11-14 19:31:38 +01:00 committed by GitHub
parent 5e044dbcc6
commit e6acebf638
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -404,6 +404,7 @@ void SwitchHandler(uint32_t mode) {
} }
break; break;
case PUSH_IGNORE: case PUSH_IGNORE:
Switch.last_state[i] = button; // Update switch state before publishing
MqttPublishSensor(); MqttPublishSensor();
break; break;
} }