Skip to content

Commit

Permalink
fix: Final fix for NaN ???
Browse files Browse the repository at this point in the history
  • Loading branch information
zachowj committed Apr 3, 2020
1 parent f771de3 commit b363e27
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/ha-websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class HaWebsocket extends EventEmitter {
const emitEvent = {
event_type: eventType,
entity_id: entityId,
event: cloneDeep(msg.data),
event: msg.data,
};

if (
Expand All @@ -237,19 +237,19 @@ class HaWebsocket extends EventEmitter {

// Emit on the event type channel
if (emitEvent.event_type) {
this.emit(`ha_events:${msg.event_type}`, emitEvent);
this.emit(`ha_events:${msg.event_type}`, cloneDeep(emitEvent));

// Most specific emit for event_type and entity_id
if (emitEvent.entity_id) {
this.emit(
`ha_events:${msg.event_type}:${emitEvent.entity_id}`,
emitEvent
cloneDeep(emitEvent)
);
}
}

// Emit on all channel
this.emit('ha_events:all', emitEvent);
this.emit('ha_events:all', cloneDeep(emitEvent));
}
}

Expand Down

0 comments on commit b363e27

Please sign in to comment.