Skip to content

Commit

Permalink
fixed #16
Browse files Browse the repository at this point in the history
  • Loading branch information
windka committed Nov 14, 2023
1 parent 42e2e9e commit 46aa99e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
All notable changes to this project will be documented in this file.

## [0.19.0] [2023-11-14]
### added details - [#16](https://github.com/windkh/node-red-contrib-grohe-sense/issues/16)

## [0.18.0] [2023-09-25]
### fixed statistics for today - [#13](https://github.com/windkh/node-red-contrib-grohe-sense/issues/13)

Expand Down
26 changes: 24 additions & 2 deletions grohe/99-grohe.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,25 +264,36 @@ module.exports = function (RED) {

for (let i = 0; i < locations.length; i++) {
let location = locations[i];

if (location.name === node.locationName){
node.location = location;
node.log('location ' + location.name);

node.rooms = location.rooms;

for (let j = 0; j < node.rooms.length; j++) {
let room = node.rooms [j];

let room = node.rooms[j];
node.log(' room ' + room.name);

let appliances = room.appliances;
node.appliancesByRoomName[room.name] = {
room : room,
appliances : appliances,
};

for (let k = 0; k < appliances.length; k++) {
let appliance = appliances[k];
node.log(' appliance ' + appliance.name);
}
}

node.connected = true;
node.emit('initialized');
break;
}
else {
// not used.
}
}

}
Expand Down Expand Up @@ -399,6 +410,12 @@ module.exports = function (RED) {
node.applianceIds.applianceId);
let status = JSON.parse(responseStatus.text);

let responseDetails = await node.config.session.getApplianceDetails(
node.applianceIds.locationId,
node.applianceIds.roomId,
node.applianceIds.applianceId);
let details = JSON.parse(responseDetails.text);

let responseNotifications = await node.config.session.getApplianceNotifications(
node.applianceIds.locationId,
node.applianceIds.roomId,
Expand Down Expand Up @@ -434,6 +451,7 @@ module.exports = function (RED) {
applianceIds : node.applianceIds,
info : info,
status : status,
details : details,
notifications : notifications,
applianceData : data
}
Expand All @@ -451,6 +469,10 @@ module.exports = function (RED) {
result.status = convertStatus(status);
}

if(details != null){
result.details = details;
}

if(notifications != null){
result.notifications = convertNotifications(notifications);
}
Expand Down
5 changes: 5 additions & 0 deletions grohe/ondusApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,11 @@ class OndusSession {
return this.get(url);
}

getApplianceDetails(locationId, roomId, applianceId) {
let url = apiUrl + '/locations/' + locationId + '/rooms/' + roomId + '/appliances/' + applianceId + '/details';
return this.get(url);
}

getApplianceStatus(locationId, roomId, applianceId) {
let url = apiUrl + '/locations/' + locationId + '/rooms/' + roomId + '/appliances/' + applianceId + '/status';
return this.get(url);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-grohe-sense",
"version": "0.18.0",
"version": "0.19.0",
"description": "Grohe sense nodes via ondus API.",
"node-red": {
"version": ">=0.1.0",
Expand Down

0 comments on commit 46aa99e

Please sign in to comment.