Node-red-contrib-home-assistant-websocket

Noticed today that my websockets stopped after the update to HA core 0.112.x. After deploying I’m getting “Node-RED custom integration needs to be installed in Home Assistant for this node to function correctly.” and the node says “Registered”. When checking the webhook address it was not created and the integration page don’t show no entity on the Node-Red integration.

Node-Red Addon: 7.0.0
node-red-contrib-home-assistant-websocket: 0.22.6
Node-Red Integration (via HACS): v0.4.4

Any thoughts about that?

Anyone using Node-Red 1.1.0 or 1.1.1 yet? Any risk in upgrading?

Thanks

Does the trigger: state node not output the friendly name of the entity id, like the current_state node does?
image

Yes, it does. That doesn’t look like the standard output of a trigger-state node. Did you manually trigger it?

Oh yeah, wow, I feel stupid, sorry for wasting your time. I did manually trigger it. That makes sense…

@Kermit,

I am a big Node-Red fan and have a lot of flows etc written in it. I am in the process of slowly implementing HA (running on a Virtual Machine with the official Virtual machine config of HASSoS etc)

I intend to continue running NR in a seperate Virtual machine - is this a support config for your node i.e. two seperate Virtual machines instead of Docker containers etc ?

By the Way Great NODE !!!

Craig

What step did you miss in the documentation? I have the same problem but can’t see what I did wrong. Maybe your input could help? Thanks!

go to configuration/integrations and choose node-red…you have to install it (again)…apparently HACS brings the package in, but doesn’t actually install it…you have to do the extra step.

New Release 0.23.0 (2020-08-02)

Features

  • Add extra data to the events:all output (4212cac), closes #229

Bug Fixes

  • Handle resubscribing after a disconnect (93d396c), closes #250

  • trigger-state: Only update HA when integration is loaded (1c187a5), closes #256

  • wait until NR integration is loaded (42b02cb)

Documentation

  • add documentation for events: all changes (6078302)

Buy me a coffee For those that enjoy my work.

1 Like

That’s it :slight_smile: Thanks for sharing! That wasn’t obvious from the docs.

New Release 0.24.0 (2020-08-04)

Features

  • events-all: Add option to output events before HA state = running (3f2e6ec)

0.24.1 (2020-08-08)

Bug Fixes

  • wait-until: Use the rendered template on event check (5721ebb), closes #259

Buy me a coffee For those that enjoy my work.

1 Like

Just updated and now I’m getting an error on restart of node red.

4 Aug 17:18:09 - [info] Waiting for missing types to be registered:
4 Aug 17:18:09 - [info] - server

And in node-red:

image

Appears to be stuck, not sure what to do.

*edit: tried console rolling back to version 0.22.0 but still stuck with the same error now :frowning:
*edit 2: console update to version 0.22.6 and now it appears to be working. :sweat_smile:
*edit: Ran Node-Red -V and got this message in the console:

12 Aug 22:26:42 - [warn] [node-red-contrib-home-assistant-websocket/server] Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/[MyUsername]/.node-red/node_modules/home-assistant-js-websocket/dist/haws.umd.js
require() of ES modules is not supported.
require() of /Users/[MyUsername]/.node-red/node_modules/home-assistant-js-websocket/dist/haws.umd.js from /Users/[MyUsername]/.node-red/node_modules/node-red-contrib-home-assistant-websocket/lib/ha-websocket.js is an ES module file as it is a .js file whose nearest parent package.json contains “type”: “module” which defines all .js files in that package scope as ES modules.
Instead rename haws.umd.js to end in .cjs, change the requiring code to use import(), or remove “type”: “module” from /Users/[MyUsername]/.node-red/node_modules/home-assistant-js-websocket/package.json.

Solution: Thanks to @Kermit for his help, updating NodeJS to version 12.18.3 eliminated the error.

Trying to install into a standalone NR 1.02 instance - getting this error thrown up - installing through the Palette manager.

This is on a Ubuntu 18.04 VM

2020-08-06T09:15:19.142Z Install : node-red-contrib-home-assistant-websocket 0.24.0

2020-08-06T09:15:19.473Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix="~" --production [email protected]
2020-08-06T09:15:28.325Z [err] npm ERR! code E404
2020-08-06T09:15:28.328Z [err] npm ERR! 404 Not Found - GET https://registry.npmjs.org/@hapi%2Fjoi - Not found
2020-08-06T09:15:28.328Z [err] npm ERR! 404
2020-08-06T09:15:28.328Z [err] npm ERR! 404 ‘@hapi/[email protected]’ is not in the npm registry.
2020-08-06T09:15:28.328Z [err] npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
2020-08-06T09:15:28.328Z [err] npm
2020-08-06T09:15:28.328Z [err] ERR! 404 It was specified as a dependency of ‘node-red-contrib-home-assistant-websocket’
2020-08-06T09:15:28.328Z [err] npm
2020-08-06T09:15:28.328Z [err] ERR! 404
2020-08-06T09:15:28.329Z [err]
2020-08-06T09:15:28.329Z [err] npm
2020-08-06T09:15:28.329Z [err] ERR! 404
2020-08-06T09:15:28.329Z [err] Note that you can also install from a
2020-08-06T09:15:28.329Z [err] npm ERR!
2020-08-06T09:15:28.329Z [err] 404 tarball, folder, http url, or git url.
2020-08-06T09:15:28.337Z [err]
2020-08-06T09:15:28.337Z [err] npm ERR! A complete log of this run can be found in:
2020-08-06T09:15:28.337Z [err] npm
2020-08-06T09:15:28.337Z [err] ERR! /home/pi/.npm/_logs/2020-08-06T09_15_28_331Z-debug.log
2020-08-06T09:15:28.354Z rc=1

regards

Craig

Its OK now - there was a temporary outage with the NPM repository earlier this evening

Craig

Unfortunately due to the 115 update, I had to setup a complete new ha instance.
But anyway, currently everything is running quite nice, except Node-red websocket which is quite critical for me.

My HA system + proxmox

arch	x86_64
chassis	vm
dev	false
docker	true
docker_version	19.03.11
hassio	true
host_os	HassOS 4.13
installation_type	Home Assistant OS
os_name	Linux
os_version	5.4.63
python_version	3.8.5
supervisor	245
timezone	Europe/Berlin
version	0.115.2
virtualenv	false

NodeRed addon: Current version: 7.2.0
HACS Node Red: v0.4.4

I followed the instucktions:

  1. Installed Node Red in HACS
  2. Restarted HA
  3. Opend Integrations,
    but Node-RED is not listed. Whatever I do, tried all avaliable versions but always same result. In my old HA 114 its working perfect. Just have no idea what to try. Btw. can’t find any error in logs regarding Node red…

Any advise is much appreciated.
Thanks


Edit:

after few hours suddenly it just worked, I’ve just tried everything in different order, so I can’t tell what exactly fixed my issue, but anyway thanks :slight_smile:

New Release 0.26.0 (2020-09-27)

Features

  • trigger-state: conditions and custom outputs editable (358c909), closes #221

  • zone: add ability to expose to HA (a35a571)

  • Add zone node (3ac9cf4)

Bug Fixes

  • zone: update autocomplete source after new data received (a6d6c29)

  • fix conditional for null old_state (ac9158e)

  • ignore state_changed event if old_state is null (6f0a8b5), closes #266

0.26.1 (2020-09-27)

Bug Fixes

  • trigger-state: fix autocomplete for entity id field (6ce5d0d)

Buy me a coffee For those that enjoy my work.

4 Likes

New Release 0.27.0 (2020-10-06)

Features

  • event-state: Add predefined ignore event types (d70ba6f)

  • events-state: Add for condition (61021a8)

  • zone: Add enter or leave event type (735437b)

Bug Fixes

  • event-state: Add default for unit (1d66aca)

  • revert change to ignore state_changed with prev state was null (4503856), closes #271

0.27.1 (2020-10-06)

Bug Fixes

  • event-state: Pass the correct level of the event to msg.data (4676c08)
  • event-state: Use the correct clear for setTimeout (db39c3d)

0.27.2 (2020-10-11)

Bug Fixes

  • events-state: Don’t reset for timer if state changes but condition is still true (2735eb2), closes #277

Documentation

  • events-state: Change some wording (711f334)

0.27.3 (2020-10-11)

Bug Fixes

  • events-state: reset timer active flag when condition is false (d119307)

0.27.6 (2020-12-01)

Bug Fixes

  • event-state: check if old state is valid before attempting to access state (a16e964)

  • fix eslint and prettier changes (8497b1a)

Documentation

  • cookbook: Add starting a flow after HA restart example (b82affd)

  • Add zone to node index page (0b5407a)


Buy me a coffee For those that enjoy my work.

4 Likes

Holy crap @Kermit… You’ve outdone yourself on this one! LOVE the new options in the event nodes.

The hassio add-on picked up 0.27.0, and a lot of my flows use the msg.data.new_state.attributes which was fixed in 0.27.1. When I try to use the latest package by configuring hassio with npm_packages overrides (below), the log shows that it installs 0.27.1 OK, but with lots “does not exist” errors. Then, unsurprisingly, node-red says the nodes are missing.

Anyone else seeing this and have a fix?

Thanks!

Configuration snip:

"npm_packages": [
  "git+https://github.com/zachowj/node-red-contrib-home-assistant-websocket"
], 

Log:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: Node-RED
 Flow-based programming for the Internet of Things
-----------------------------------------------------------
 Add-on version: 7.2.3
 You are running the latest version of this add-on.
 System: HassOS 4.13  (armv7 / raspberrypi3)
 Home Assistant Core: 0.115.6
 Home Assistant Supervisor: 246
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to WARNING
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] nginx.sh: executing... 
[cont-init.d] nginx.sh: exited 0.
[cont-init.d] node-red.sh: executing... 
patching file nodes/ui_base.html
Hunk #1 succeeded at 1178 (offset 647 lines).
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
audited 2 packages in 1.002s
found 0 vulnerabilities
[cont-init.d] node-red.sh: exited 0.
[cont-init.d] user.sh: executing... 
npm WARN deprecated @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this library is no longer supported
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
added 33 packages from 23 contributors, updated 1 package and audited 1065 packages in 77.401s
48 packages are looking for funding
  run `npm fund` for details
found 6 vulnerabilities (3 low, 3 moderate)
  run `npm audit fix` to fix them, or `npm audit` for details
[cont-init.d] user.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
> addon-node-red@ start /opt
> node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"
/bin/sh: /opt/node_modules/node-red-node-pi-gpio/testgpio.py: not found
6 Oct 20:35:11 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
6 Oct 20:35:12 - [warn] ------------------------------------------------------
6 Oct 20:35:12 - [warn] [node-red-contrib-home-assistant-websocket/server] Error: /opt/node_modules/node-red-contrib-home-assistant-websocket/nodes/config-server/config-server.html does not exist
6 Oct 20:35:12 - [warn] [node-red-contrib-home-assistant-websocket/server-events] Error: /opt/node_modules/node-red-contrib-home-assistant-websocket/nodes/events-all/events-all.html does not exist
6 Oct 20:35:12 - [warn] [node-red-contrib-home-assistant-websocket/server-state-changed] Error: /opt/node_modules/node-red-contrib-home-assistant-websocket/nodes/events-state-changed/events-state-changed.html does not exist
6 Oct 20:35:12 - [warn] [node-red-contrib-home-assistant-websocket/trigger-state] Error: /opt/node_modules/node-red-contrib-home-assistant-websocket/nodes/trigger-state/trigger-state.html does not exist
6 Oct 20:35:12 - [warn] [node-red-contrib-home-assistant-websocket/poll-state] Error: /opt/node_modules/node-red-contrib-home-assistant-websocket/nodes/poll-state/poll-state.html does not exist
6 Oct 20:35:12 - [warn] [node-red-contrib-home-assistant-websocket/ha-webhook] Error: /opt/node_modules/node-red-contrib-home-assistant-websocket/nodes/webhook/webhook.html does not exist
6 Oct 20:35:12 - [warn] [node-red-contrib-home-assistant-websocket/ha-zone] Error: /opt/node_modules/node-red-contrib-home-assistant-websocket/nodes/zone/zone.html does not exist
6 Oct 20:35:12 - [warn] [node-red-contrib-home-assistant-websocket/api-call-service] Error: /opt/node_modules/node-red-contrib-home-assistant-websocket/nodes/call-service/call-service.html does not exist
6 Oct 20:35:12 - [warn] [node-red-contrib-home-assistant-websocket/ha-entity] Error: /opt/node_modules/node-red-contrib-home-assistant-websocket/nodes/entity/entity.html does not exist
6 Oct 20:35:12 - [warn] [node-red-contrib-home-assistant-websocket/ha-fire-event] Error: /opt/node_modules/node-red-contrib-home-assistant-websocket/nodes/fire-event/fire-event.html does not exist
6 Oct 20:35:12 - [warn] [node-red-contrib-home-assistant-websocket/api-current-state] Error: /opt/node_modules/node-red-contrib-home-assistant-websocket/nodes/current-state/current-state.html does not exist
6 Oct 20:35:12 - [warn] [node-red-contrib-home-assistant-websocket/ha-get-entities] Error: /opt/node_modules/node-red-contrib-home-assistant-websocket/nodes/get-entities/get-entities.html does not exist
6 Oct 20:35:12 - [warn] [node-red-contrib-home-assistant-websocket/api-get-history] Error: /opt/node_modules/node-red-contrib-home-assistant-websocket/nodes/get-history/get-history.html does not exist
6 Oct 20:35:12 - [warn] [node-red-contrib-home-assistant-websocket/api-render-template] Error: /opt/node_modules/node-red-contrib-home-assistant-websocket/nodes/render-template/render-template.html does not exist
6 Oct 20:35:12 - [warn] [node-red-contrib-home-assistant-websocket/ha-wait-until] Error: /opt/node_modules/node-red-contrib-home-assistant-websocket/nodes/wait-until/wait-until.html does not exist
6 Oct 20:35:12 - [warn] [node-red-contrib-home-assistant-websocket/ha-api] Error: /opt/node_modules/node-red-contrib-home-assistant-websocket/nodes/api/api.html does not exist
6 Oct 20:35:12 - [warn] ------------------------------------------------------
6 Oct 20:35:12 - [warn] Projects disabled : editorTheme.projects.enabled=false
nginx: [alert] detected a LuaJIT version which is not OpenResty's; many optimizations will be disabled and performance will be compromised (see https://github.com/openresty/luajit2 for OpenResty's LuaJIT or, even better, consider using the OpenResty releases from https://openresty.org/en/download.html)

Node-Red error:

npm_packages:
  - node-red-contrib-home-assistant-websocket@latest
1 Like