diff --git a/nodes/current-state/current-state.js b/nodes/current-state/current-state.js index f9552bd371..07ed4fe562 100644 --- a/nodes/current-state/current-state.js +++ b/nodes/current-state/current-state.js @@ -59,7 +59,7 @@ module.exports = function(RED) { {}, await this.nodeConfig.server.homeAssistant.getStates(entity_id) ); - if (!currentState) + if (!currentState.entity_id) return logAndContinueEmpty( `entity could not be found in cache for entity_id: ${entity_id}, sending empty payload` ); diff --git a/nodes/poll-state/poll-state.js b/nodes/poll-state/poll-state.js index 7091adc8b2..1041c7c37a 100644 --- a/nodes/poll-state/poll-state.js +++ b/nodes/poll-state/poll-state.js @@ -79,11 +79,14 @@ module.exports = function(RED) { if (!this.isConnected) return; try { - const pollState = await this.nodeConfig.server.homeAssistant.getStates( - this.entityId + const pollState = this.utils.merge( + {}, + await this.nodeConfig.server.homeAssistant.getStates( + this.entityId + ) ); - if (!pollState) { + if (!pollState.entity_id) { this.warn( `could not find state with entity_id "${this.entityId}"` );