Skip to content

Commit

Permalink
setObjectAsynch bug after offline solved
Browse files Browse the repository at this point in the history
  • Loading branch information
BenAhrdt committed May 10, 2024
1 parent 7cb2325 commit 6e25350
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ For now there is documentation in English here: https://wiki.hafenmeister.de
Placeholder for the next version (at the beginning of the line):
### **WORK IN PROGRESS**
-->
### **WORK IN PROGRESS**
* (BenAhrdt) setObjectAsynch bug after offline solved

### 1.0.6 (2024-05-10)
* (BenAhrdt) icons changed
* (BenAhrdt) device offline notofication placed in messagehandler.js
Expand Down
Binary file added admin/icons/offline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions lib/modules/messagehandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,13 @@ class messagehandlerClass {
const changeInfo = await this.adapter.getChangeInfo(adapterObject._id);
if(changeInfo){
this.adapter.registerNotification("lorawan", "LoRaWAN device offline", `The LoRaWAN device ${changeInfo.usedDeviceId} in the application ${changeInfo.usedApplicationName} is offline`);
const deviceFolderId = adapterObject._id.substring(0,adapterObject._id.indexOf(".uplink"));
const deviceFolderObject = await this.adapter.getObjectAsync(deviceFolderId);
const deviceId = adapterObject._id.substring(0,adapterObject._id.indexOf(".uplink"));
const deviceObject = await this.adapter.getObjectAsync(deviceId);
// Set foldericon to low / no connection
if(deviceFolderObject){
deviceFolderObject.common.icon = "icons/wifiSfX_0.png";
await this.adapter.extendObjectAsync(deviceFolderId,{
common: deviceFolderObject.common,
});
if(deviceObject){
this.adapter.log.warn(JSON.stringify(deviceObject));
deviceObject.common.icon = "icons/offline.png";
await this.adapter.setObjectAsync(deviceId,deviceObject);
}
}
}
Expand Down

0 comments on commit 6e25350

Please sign in to comment.