Skip to content

Commit

Permalink
feat(integration): Handle nodered:loaded event from when HA loads cus…
Browse files Browse the repository at this point in the history
…tom component
  • Loading branch information
zachowj committed Feb 12, 2020
1 parent aba9eab commit 072cec7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/ha-websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,12 @@ class HaWebsocket extends EventEmitter {

if (msg) {
const eventType = msg.event_type;
const entityId = msg.data ? msg.data.entity_id : null;
const entityId = msg.data && msg.data.entity_id;

if (eventType === 'nodered') {
if (msg.data.type === 'unloaded') {
if (msg.data.type === 'loaded') {
this.integrationVersion = msg.data.version;
} else if (msg.data.type === 'unloaded') {
this.integrationVersion = 0;
}
this.emit(`integration`, msg.data.type);
Expand Down

0 comments on commit 072cec7

Please sign in to comment.