Skip to content

Commit

Permalink
fix: check isHomeAssistantRunning for output on connect
Browse files Browse the repository at this point in the history
Fixes: #262
  • Loading branch information
zachowj committed Sep 11, 2020
1 parent 4a78c9b commit 64d1b45
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion nodes/events-state-changed/events-state-changed.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = function (RED) {

if (this.nodeConfig.outputinitially) {
// Here for when the node is deploy without the server config being deployed
if (this.isIntegrationLoaded) {
if (this.isHomeAssistantRunning) {
this.onDeploy();
} else {
this.addEventClientListener(
Expand Down
12 changes: 8 additions & 4 deletions nodes/poll-state/poll-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ module.exports = function (RED) {
}

if (this.nodeConfig.outputinitially) {
this.addEventClientListener(
'ha_client:initial_connection_ready',
this.onTimer.bind(this)
);
if (this.isHomeAssistantRunning) {
this.onTimer();
} else {
this.addEventClientListener(
'ha_client:initial_connection_ready',
this.onTimer.bind(this)
);
}
}
}

Expand Down

0 comments on commit 64d1b45

Please sign in to comment.