Skip to content

Commit

Permalink
Removed _emptyIteratorStopper from response (#89)
Browse files Browse the repository at this point in the history
* Removed _emptyIteratorStopper from response

* Fix big if no lights are configured

Co-authored-by: Claudio Chimera <Claudio.Chimera@gmail.com>
Signed-off-by: Martin Buchleitner <mbuchleitner@infralovers.com>
  • Loading branch information
2 people authored and mabunixda committed Mar 4, 2021
1 parent a9d3b37 commit e7a14dd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions alexa/alexa-home-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ module.exports = function(RED) {
lights: node.generateAPIDeviceList(id),
date: new Date().toISOString().split('.').shift(),
};
const content = Mustache.render(template, data);
const content = Mustache.render(template, data).replace(/(\{\s+)?,?[^,]+_emptyIteratorStopper": \{\}/g, '$1');
RED.log.debug(node.name + + '/' + id +
' - listing ' + request.params.username +
' #' + data.lights.length + ' api information to ' +
Expand Down Expand Up @@ -269,7 +269,7 @@ module.exports = function(RED) {

AlexaHomeController.prototype.generateAPIDevice = function(uuid, node) {
const defaultAttributes = {
on: node.state,
on: node.state || false,
bri: node.bri,
devicetype: node.devicetype,
x: node.xy[0],
Expand Down

0 comments on commit e7a14dd

Please sign in to comment.