Skip to content

Commit

Permalink
fix(mqtt): Always publish state
Browse files Browse the repository at this point in the history
  • Loading branch information
depau committed Apr 26, 2021
1 parent 219bc34 commit 6a041c6
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/mqtt/MqttController.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,13 +438,11 @@ class MqttController {
* @return {Promise<void>}
*/
async setState(state) {
if (this.homieEnabled || this.hassEnabled) {
await this.asyncClient.publish(this.stateTopic, state, {
// @ts-ignore
qos: MqttCommonAttributes.QOS.AT_LEAST_ONCE,
retain: true
});
}
await this.asyncClient.publish(this.stateTopic, state, {
// @ts-ignore
qos: MqttCommonAttributes.QOS.AT_LEAST_ONCE,
retain: true
});
this.state = state;
}

Expand Down

0 comments on commit 6a041c6

Please sign in to comment.