fix string equality problem (consider coding)
This commit is contained in:
@ -18,6 +18,7 @@ class GenericItem {
|
||||
|
||||
|
||||
mqtt.register([this.stateTopic, this.brightTopic], (topic, payload) => {
|
||||
payload = payload.toString('UTF-8');
|
||||
logger.info(`item ${this.itemId}: ${topic}, ${payload}`)
|
||||
if (topic == this.stateTopic) {
|
||||
this.state = payload;
|
||||
@ -26,8 +27,6 @@ class GenericItem {
|
||||
this.bright = payload;
|
||||
mqtt.send(this.brightFeedbackTopic, this.bright);
|
||||
}
|
||||
logger.info(this.state != this.oldState);
|
||||
logger.info(this.bright != this.oldBright);
|
||||
if ((this.state != this.oldState) || (this.bright != this.oldBright)) {
|
||||
mqtt.send(this.actionTopic, `${this.state} ${this.bright}`);
|
||||
this.oldState = this.state;
|
||||
|
Reference in New Issue
Block a user