Skip to content

Commit

Permalink
add api endpoint to get room list
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbyquaker committed Sep 29, 2018
1 parent 9cfb657 commit 9b073d0
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions nodes/ccu-connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ module.exports = function (RED) {
res.status(200).send(JSON.stringify(obj));
break;
}
case 'rooms':
res.status(200).send(JSON.stringify({
rooms: config.rooms
}));
break;

case 'sysvar':
res.status(200).send(JSON.stringify(config.sysvar));
Expand Down Expand Up @@ -1305,8 +1310,8 @@ module.exports = function (RED) {
if (datapoint !== 'PONG') {
pong = false;
}
if (datapoint === 'WORKING' && value) {
working = true;
if (datapoint === 'WORKING') {
working = value;
}
if (datapoint === 'DIRECTION') {
direction = value;
Expand Down Expand Up @@ -1522,8 +1527,19 @@ module.exports = function (RED) {
this.logger.debug('publishEvent', JSON.stringify(params));

const msg = this.createMessage(iface, channel, datapoint, payload, {cache: false, working, direction});
if (msg.channelType === 'DIMMER' && msg.datapoint === 'LEVEL' && !working) {
clearTimeout(this.workingTimeout);
this.workingTimeout = setTimeout(() => {
const datapointName = iface + '.' + channel + '.';
msg.working = this.values[datapointName + 'WORKING'] && this.values[datapointName + 'WORKING'].working;
msg.direction = this.values[datapointName + 'DIRECTION'] && this.values[datapointName + 'DIRECTION'].direction;
this.callCallbacks(msg);
}, 250);
} else {
this.callCallbacks(msg);
}


this.callCallbacks(msg);
}

callCallbacks(msg) {
Expand Down

0 comments on commit 9b073d0

Please sign in to comment.