Node-red-contrib-home-assistant-websocket

I have something like this in my configuration.yaml

http:
  # Secrets are defined in the file secrets.yaml
    api_password: mypassword

Is that what you mean?

Yes, that is what I was referring to. I would recommend changing over from using the legacy API password in the Node-RED to using the long-lived access token.

Here’s the issue about this same thing happening to app daemon user using the legacy API password.

That token looks complicated. But I will look into it when I have some time. Not in a hurry to run the latest version of home assistant.

When you find the time it’s actually really easy to set up. Checkout the simple instrutions in the link.

That looks doable. I will try soon. Thanks.

Release v0.5.0

New Features

  • Added secondary outputs for halt if logic for the current-state, events-state, and poll-state nodes

  • Call-service node now has the option for custom location output or no output

  • New node get-entities: Get entities based on search criteria with 3 different output options

Added

  • Added Spinner UI element to poll-state node

Changed

  • Refactored the UI for halt if logic into an external file and loaded on demand

Fixed

  • Fixed the handling of multiple entity ids for the homeassistant domain for the call-service node Fixed #57

If you run into any issues please report them on github


Here’s a post to show some examples on how one might use the new get entities node.


Buy me a coffee For those that enjoy my work.

6 Likes

Since last hassio update I have this error:

21 Dec 12:15:17 - [info] [server:Home Assistant] WebSocket Connected to https://XXXXXXX.duckdns.org:8123 (node:625) UnhandledPromiseRejectionWarning: #<Object> (node:625) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:625) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. (node:625) UnhandledPromiseRejectionWarning: #<Object> (node:625) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:625) UnhandledPromiseRejectionWarning: #<Object> (node:625) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3) (node:625) UnhandledPromiseRejectionWarning: #<Object> (node:625) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)

  • Node Red Version: [e.g. 0.19.5]
  • NR Home Assistant Plugin Version: [e.g. 0.5.0]
  • Is Node Red running in Docker: [e.g. yes/no/hassio]

Does this only apear in your logs when you reboot home assistant?

I updated from 0.43 to 0.50 and when restarting Node-RED I can no longer deploy (full, modified flows, or modified nodes) - There are no errors in Node-RED console or in debug. I’m running Home Assistant 0.84.6 with a long lived access token, Node RED 0.18.3, and Node 9.8.0

EDIT: Updated Node-RED to 0.19.5 and now everything is working as expected

Solved with last HA update.

I am having similar issues as you described: I can never deploy twice with the same deploy setting. I have two change between 'Full Deploy" and “Only changed flows” everytime. When I do try to deploy for the second time with the same setting I see this error: “Deploy failed: no response from server”.

I am running both HA and Nodered as part of a docker-compose file. HA is on v0.84.6 and NodeRed on v0.19.5

Additionally, I noticed some wrong status info beneath deployed nodes:
This example has a status “switch.turn_on called”, but the service call is an input_boolean turn_on
28

And this example is another node, but that same input_boolean.turn_on service call, yet the status below the node states turn_off was called.
32

I double checked to make sure I had configured the nodes correctly, but they are. It looks like this is where some of my automations break.

Any tips on what I may be doing wrong, or is this a (known?) issue?

Not sure I have an answer to your first issue sounds more of a nod-red issue. May want to look through the issues on the GitHub node-red repo.

For your second issue do you have another call-service node somewhere prior to the one in the screenshot? The call-service passing its properties into the payload so when you chain them together the first one will override all following call-service config data. Either change the output location or set it to None.

thanks that seems to have fixed my problem, although I do not understand the logic behind it yet :slight_smile: Will get more into it. Thanks for making this awesome software!

Release v0.5.1

Fixed

  • Fixed get-entities to use custom label if valid

  • Correct possessive apostrophe in trigger state node constraint list (@albertnis)

  • Fixed condition where wildcard type state changes fired before current states were actually saved

  • Fixed onDeploy for trigger-state node when using substring/regex for entity id


If you run into any issues please report them on github


Buy me a coffee For those that enjoy my work.

After a crash of my home assistant, I’m moving a lot of my applications into Docker. I have node-red operating in a Docker, but I’m having an issue with installing the home-assistant-websocket node. I don’t have issues with other nodes, so I’m assuming that it’s maybe a port forwarding issue, or similar inside of Docker. You may, or may not, be able to help and I thought I’d just throw it out and see.

So, the installation goes just fine and completes without any errors. However, as soon as I restart the Docker I receive errors that the nodes can’t be deployed. When checking the status I see the blow:

Screenshot%20from%202018-12-31%2008-46-37

Also, pulling up the node-red log gives me this:

31 Dec 16:45:13 - [info]

Welcome to Node-RED

===================

31 Dec 16:45:13 - [info] Node-RED version: v0.19.5

31 Dec 16:45:13 - [info] Node.js version: v6.11.0

31 Dec 16:45:13 - [info] Linux 4.14.79-v7+ arm LE

31 Dec 16:45:14 - [info] Loading palette nodes

31 Dec 16:45:18 - [warn] ------------------------------------------------------

31 Dec 16:45:18 - [warn] [node-red-contrib-home-assistant-websocket/server] SyntaxError: Unexpected identifier

31 Dec 16:45:18 - [warn] [node-red-contrib-home-assistant-websocket/server-events] SyntaxError: Unexpected identifier

31 Dec 16:45:18 - [warn] [node-red-contrib-home-assistant-websocket/server-state-changed] SyntaxError: Unexpected identifier

31 Dec 16:45:18 - [warn] [node-red-contrib-home-assistant-websocket/trigger-state] SyntaxError: Unexpected identifier

31 Dec 16:45:18 - [warn] [node-red-contrib-home-assistant-websocket/poll-state] SyntaxError: Unexpected identifier

31 Dec 16:45:18 - [warn] [node-red-contrib-home-assistant-websocket/api-call-service] SyntaxError: Unexpected identifier (line:2)

31 Dec 16:45:18 - [warn] [node-red-contrib-home-assistant-websocket/ha-fire-event] SyntaxError: Unexpected identifier (line:1)

31 Dec 16:45:18 - [warn] [node-red-contrib-home-assistant-websocket/api-current-state] SyntaxError: Unexpected identifier

31 Dec 16:45:18 - [warn] [node-red-contrib-home-assistant-websocket/ha-get-entities] SyntaxError: Unexpected identifier

31 Dec 16:45:18 - [warn] [node-red-contrib-home-assistant-websocket/api-get-history] SyntaxError: Unexpected identifier (line:2)

31 Dec 16:45:18 - [warn] [node-red-contrib-home-assistant-websocket/api-render-template] SyntaxError: Unexpected identifier (line:2)

31 Dec 16:45:18 - [warn] ------------------------------------------------------

Any idea on what might be causing this? As mentioned earlier, I don’t have any issues with the installation of other simpler nodes such as timers, etc.

Thanks in advance!

From the README

If you're running Node-Red in Docker you'll need to pull the -v8 image for this to work.

Okay, I’ll give that a shot. It’s running on a Pi so I went with the RPI variant. I’ll see if the v8 plays well with that hardware.

Thanks for the help. I’ll report back once I have a chance to try it out.

there’s a raspberry pi v8 version

rpi-v8

Hi,
I’m running node-red in a docker-container, and have installed this module through the pallette. Home assistant is running on a different host in the same network. Everything is working fine at first, I can set up some flows and test them, node-red receives the events it supposed to. But, when left over night, the connection is somehow lost. I need to restart the nodered container to get the connection back.
I can’t find anything in the logs suggesting that the connection is lost, only thing there is [info] [server:Hass] WebSocket Connected to <host>.

I’m a new with node-red, can I enable some extended logging to help out with debugging?

I don’t see anything on the home assistant side on losing connection. Should I enable some debug logging there as well?

I’m running v0.5.1 of the module, but it was the same thing in previous verison.
Node-red docker-compose container running on fedora host:

[info] Node-RED version: v0.19.5
[info] Node.js  version: v8.12.0
[info] Linux 4.18.19-100.fc27.x86_64 x64 LE

Edit: When the connection is lost, the node-red ui seems happy, but it won’t receive any events from home assistant.

When it goes into its “non receiving” state are you able to trigger a call-service node and see if it completes, like turning a light on/off?