Skip to content

Commit

Permalink
feat(zone): add ability to expose to HA
Browse files Browse the repository at this point in the history
  • Loading branch information
zachowj committed Sep 26, 2020
1 parent 43d571d commit a35a571
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/events-ha-node.js
Expand Up @@ -151,7 +151,7 @@ class EventsHaNode extends EventsNode {
}

async handleTriggerMessage(data = {}) {
if (this.isEnabled === false) {
if (this.isEnabled === false || this.type === 'ha-zone') {
return;
}

Expand Down
10 changes: 10 additions & 0 deletions nodes/zone/ui-zone.js
Expand Up @@ -11,6 +11,13 @@ RED.nodes.registerType('ha-zone', {
defaults: {
server: { value: '', type: 'server', required: true },
name: { value: '' },
exposeToHomeAssistant: { value: false },
haConfig: {
value: [
{ property: 'name', value: '' },
{ property: 'icon', value: '' },
],
},
entities: {
value: [''],
required: true,
Expand Down Expand Up @@ -42,6 +49,8 @@ RED.nodes.registerType('ha-zone', {
);
zones = entities.filter((entities) => entities.startsWith('zone.'));
});
exposeNode.init(this);

$entities.editableList({
addButton: true,
removable: true,
Expand Down Expand Up @@ -100,5 +109,6 @@ RED.nodes.registerType('ha-zone', {
});
this.entities = Array.from(entities);
this.zones = Array.from(zones);
this.haConfig = exposeNode.getValues();
},
});

0 comments on commit a35a571

Please sign in to comment.