diff --git a/README.md b/README.md index 6fe287c..3fccf51 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/admin/icons/offline.png b/admin/icons/offline.png new file mode 100644 index 0000000..fd48161 Binary files /dev/null and b/admin/icons/offline.png differ diff --git a/lib/modules/messagehandler.js b/lib/modules/messagehandler.js index fbabea3..f1896b2 100644 --- a/lib/modules/messagehandler.js +++ b/lib/modules/messagehandler.js @@ -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); } } }