From 70963b09575403ee794652b72694133602d3ca4c Mon Sep 17 00:00:00 2001 From: windka Date: Fri, 17 Mar 2023 21:36:16 +0100 Subject: [PATCH] fixed #11 --- CHANGELOG.md | 3 +++ grohe/99-grohe.js | 14 ++++++++++++++ grohe/ondusApi.js | 27 ++++++++++++++++++++++++--- package.json | 2 +- 4 files changed, 42 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff2c1c7..e65db16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All notable changes to this project will be documented in this file. +## [0.15.1] [2023-03-17] +### fixed - [#11](https://github.com/windkh/node-red-contrib-grohe-sense/issues/11) + ## [0.15.0] [2022-11-21] ### added more statistics to history data diff --git a/grohe/99-grohe.js b/grohe/99-grohe.js index dbceac7..287d268 100644 --- a/grohe/99-grohe.js +++ b/grohe/99-grohe.js @@ -438,6 +438,20 @@ module.exports = function (RED) { } } + // For Debugging only + if (msg.debug === true){ + let debugMsg = { + debug : { + applianceIds : node.applianceIds, + info : info, + status : status, + notifications : notifications, + applianceData : data + } + }; + node.warn(debugMsg); + } + let result = {}; if(info != null){ diff --git a/grohe/ondusApi.js b/grohe/ondusApi.js index 4a50326..d4c7d88 100644 --- a/grohe/ondusApi.js +++ b/grohe/ondusApi.js @@ -420,13 +420,34 @@ function convertNotification(notification) { 431 : 'Water detected - water still ON', }, }, + // new unknown category, maybe info + 40 : { + 'text' : 'Info', + 'type' : { + 1 : 'Did you have a leak?', + }, + }, }, }; let category = notification.category; let type = notification.type; - let message = notificationMessageByCategoryAndType.category[category].type[type]; - let categoryText = notificationMessageByCategoryAndType.category[category].text; + + let categoryInfo = notificationMessageByCategoryAndType.category[category]; + + let message; + let categoryText; + if (categoryInfo !== undefined) { + message = categoryInfo.type[type]; + categoryText = categoryInfo.text; + } + else { + categoryText = 'Unknown'; + } + + if (message === undefined) { + message = 'Unkown notification category: ' + category + ' type: ' + type; + } let convertedNotification = { category : categoryText, @@ -442,7 +463,7 @@ let OndusType = { Sense : 101, SensePlus : 102, SenseGuard : 103, - // BlueHome : 104 // TDOD + // BlueHome : 104 // TODO }; diff --git a/package.json b/package.json index d1379cc..23dd4d9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red-contrib-grohe-sense", - "version": "0.15.0", + "version": "0.15.1", "description": "Grohe sense nodes via ondus API.", "node-red": { "version": ">=0.1.0",