Skip to content

Commit

Permalink
fix(call-service): render mustache templates for entity id field
Browse files Browse the repository at this point in the history
  • Loading branch information
zachowj committed Aug 1, 2019
1 parent 3ee798e commit 8889355
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions nodes/call-service/call-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,21 @@ module.exports = function(RED) {
config.entityId &&
!Object.prototype.hasOwnProperty.call(apiData, 'entity_id')
) {
const entityId = RenderTemplate(
config.entityId,
message,
context,
serverName,
config.mustacheAltTags
);
// homeassistant domain requires entity_id to be an array for multiple ids
if (
apiDomain === 'homeassistant' &&
config.entityId.indexOf(',') !== -1
entityId.indexOf(',') !== -1
) {
apiData.entity_id = config.entityId.split(',');
apiData.entity_id = entityId.split(',');
} else {
apiData.entity_id = config.entityId;
apiData.entity_id = entityId;
}
}

Expand Down

0 comments on commit 8889355

Please sign in to comment.