Skip to content

Commit

Permalink
upd msg
Browse files Browse the repository at this point in the history
  • Loading branch information
arteck committed Oct 31, 2023
1 parent 3ba9b83 commit c196b00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/mqtt-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class MqttServer {
const ip = this.devices[clientId]?.ip;
if (ip) {
// Call Adapter function onMqttAliveChange()
this.adapter.onMqttAlive(ip, isAlive);
this.adapter.onMqttAlive(ip, isAlive, msg);
if (isAlive) {
this.scheduleCheckIfStillActive(clientId); // restart timer
} else {
Expand Down
8 changes: 7 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class fullybrowserControll extends utils.Adapter {
}
}

async onMqttAlive(ip, isAlive) {
async onMqttAlive(ip, isAlive, msg) {
try {
const prevIsAlive = this.fullysEnbl[ip].isAlive;
this.fullysEnbl[ip].isAlive = isAlive;
Expand All @@ -121,6 +121,12 @@ class fullybrowserControll extends utils.Adapter {
if ((!calledBefore && isAlive === true) || prevIsAlive !== isAlive) {
// Set Device isAlive Status - we could also use setStateChanged()...
this.setState(this.fullysEnbl[ip].id + '.alive', { val: isAlive, ack: true });

Check failure on line 124 in main.js

View workflow job for this annotation

GitHub Actions / check-and-lint (18.x)

Trailing spaces not allowed
if (isAlive) {
this.log.info(`${this.fullysEnbl[ip].name} is alive (MQTT: ${msg})`);
} else {
this.log.warn(`${this.fullysEnbl[ip].name} is not alive! (MQTT: ${msg})`);
}
}

this.setStateChanged('info.connection', { val: true, ack: true });
Expand Down

0 comments on commit c196b00

Please sign in to comment.