Node-red-contrib-home-assistant-websocket

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?

Yes. In that state, I can use the inject node to trigger a service call

The injected call succeeds, and my light is toggled. But when I click my button that triggers the event, nothing gets in the debug log.

Above is just one example. I have a flow that listens for other events, and another that listens for state change. Both behave the same as the above.

Quick but for me complex question.

What does this actually mean?

“Call Service and Fire Event nodes are now able to render mustache templates in the data property. Templates also work on the new entity id field for the Call Service node”

Any property of the message object that gets passed into a call-service node is accessible via a template variable.

Example message object being passed in

message: {
  payload: "home",
  data: {
    attributes: {
       friendly_name: "Jason"
    }
  }
}

You can use these values within the Data field. Variables are defined by having double curly brackets around them. So to access the message.payload you would use {{payload}}

Before you were able to use templates within the data string you had to use a template or function node to format the data property before passing it to the call-service node.

Try dropping a events: all node with a full debug message node and see if that is still outputing events.

[{"id":"e5b10769.4c9968","type":"server-events","z":"ffbd7f06.4a014","name":"","server":"2dad33ee.42bf5c","event_type":"","x":204,"y":784,"wires":[["1b5ee05f.b199f"]]},{"id":"1b5ee05f.b199f","type":"debug","z":"ffbd7f06.4a014","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":338,"y":784,"wires":[]}]

Kermit

Is there any difference (dumb question time) between ‘node-red-contrib-home-assistant-websocket’ and ’ Community Hass.io Add-ons: Node-RED’?

The terminology (for a non-tech person) confuses me.

I have been using ’ Community Hass.io Add-ons: Node-RED’ for a long time, and when I look at the pallet manager I can see ‘node-red-contrib-home-assistant-websocket’ as installed

I am considering (as I have a spare 3B+) putting Node Red with your branch and my MQTT broker on it.

The add-on merely runs node-red in a container. It has a preconfigured palette to connect to home Assistant

The ‘node-red-contrib-home-assistant-websocket’ is the palette used in node-red

Because that’s the palette being used by the add-on.

Node-red is really nothing to do with home assistant. It’s a separate project that has been around for years. There just happens to be a way to connect to home assistant and use it. Some of us don’t run hassio, but use node-red to run our automation, so the palette is a way for us to connect them.

Thanks @Kermit for this!

Just migrated to it from the llat version…totally painless - all previous flows work fine.

To confirm what I did:

Stop Node Red
cd to the Node Red directory on my box
nano package.json
remove the line with the node-red-contrib-home-assistant-llat package, close and save file.

cd  node-modules
rm -r node-red-contrib-home-assistant-llat
cd ..
npm install node-red-contrib-home-assistant-websocket

Then reboot. I then created a new access token in HA and everything connected!

The reason I manually removed the old package is that I was having all sorts of issues with files being left behind the other way.

Thanks again and hopefully I am ‘future proofed’ for a while as I know the llat node is not being developed any further.

I spoke too soon. After about 2 hours I get errors:

‘Error calling service. Home Assistant API error’

Reboot and it works for another couple of hours.

I am on HA 0.84.6, NR 19.2 on the latest version of the node. Tried using both access token and legacy password. Running it in a LXC container (not docker). Weird as I saw issue HERE that has been closed but it seems to describe the intermittent issue I had.

Restored from a backup (i just love Linux containers!) and back on the LLAT at the moment. Any ideas?