Node-red-contrib-home-assistant-websocket

You could use an events: all node listening for home_assistant_client.

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/events-all.html#client-events

2 Likes

New Release 0.31.0 (2021-05-19)

New nodes

  • Tag (beta)
  • Time (move to beta from alpha)
  • Device (alpha) requires v0.5.2+ of the NR companion custom component
    • Create device based event triggers
    • Trigger device actions

Features

Queues for call-service node

There always seemed to be confusion over why the call-service node would report an error of no connection to server. This error is often thrown when using a starting node that fires directly after loading, i.e. Bigtimer, eztimer. The cause was that the node would trigger the flow before the HA config node had a chance to connect to Home Assistant hence no connection to server. This update adds a queue system to the call-service node. With the ability to save only the first/last message or all messages and then resend them after NR has successfully connected to HA.

Async done / complete

Home Assistant nonevent nodes will notify the Node-RED runtime when it has completed its action. Basically, the complete node will now function with HA nodes.

Helper functions added to JSONata Expressions

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/jsonata.html

  • $randomNumber
  • $sampleSize

Migrations

The node migration system has been reworked and allows for updating all HA nodes with a push of a single button. With this release, a lot of nodes have changed how certain data is saved. So it is highly recommended to make a backup of your flows before doing upgrades.

Custom Outputs

  • [x] API
  • [x] Current state
  • [x] Device
  • [x] Events: all
  • [x] Events: state
  • [ ] Fire event
  • [ ] Poll state
  • [ ] Render Template
  • [ ] Tag
  • [ ] Time
  • [ ] Wait Until
  • [x] Webhook
  • [ ] Zone

Features

  • Add $randomNumber and $sampleSize as JSONata helper functions (b5b65bf)
  • Add device node (b08fcbe)
  • api: Add custom outputs (da0187f)
  • call-service: Add message queue (58df3a0)
  • current-state: Add custom ouputs (f4ecbb8)
  • events-all: Add custom outputs (0a3fc23)
  • events-state: Add custom outputs (aa07fb4)
  • Make use of NR v1.0 async send and done (d5b69f4)
  • migrations: Add config nodes to mass update (5d23126)
  • tag: Add tag node (17585bb)
  • time: Move time node to beta release (27caacc)
  • webhook: Add custom outputs (5dff14b)

Bug Fixes

  • api: add try catch for setCustomOutputs (ee5189d)
  • Check for valid property for custom outputs (f971856)
  • Check for valid server before processing input (a86a9a6)
  • check for valid server config before using it (d7b322b)
  • ci: Don’t lint included external libs (8cd6735)
  • destroy bonjour after finished using it (eb2208f)
  • entity-switch: Remove unused declaration (e6b15a0)
  • Fix Comms import (8c51877)
  • migration: Move event-state for properties to a newer version (de68154)
  • migrations: make sure schema version is a number (e1bc0f8)
  • migrations: swap conditional for default value (996b9ef)
  • only trim spaces of server url if it exists (f9ce69f)
  • poll-state: call correct error method (5f7b1a8)
  • poll-state: Use correct element id for entity_id input (0c2fe30)
  • request autocomplete results only if server actually changes (27dc32a)
  • routes: fix server id for getting integration version (fc6c808)
  • routes: flatten out properties array (45df3f1)
  • status: check for valid homeAssistant before adding listeners (c1d29ec)
  • time: Check jsonata length before attempting to find entity ids (e3de59e)
  • time: use correct i18n errror message (be3db24)
  • Use correct element id for update all button (6bcf9a8)
  • use the correct RED (03bb7a0)

Documentation

  • Add github discussions link to header (dfa74a7)
  • Add new nodes to index (7b305d0)
  • Add new nodes to TOC (9a73e86)
  • cookbook: Correct spelling (28928b4)
  • cookbook: Update starting flow after HA reboot (388b70a)
  • current-state: add information about custom outputs (e9fcb91)
  • events-state: Add custom output information (e2a11a9)

Buy me a coffee For those that enjoy my work.

5 Likes

Double post, but I think better fit…

please help me out… I have 772 home assistant nodes…

Hi, I recently had this message upon starting node-red:

image
(screenshot from my test instance)
And this when pressing:
image

But I decided not yet to press it… so I opened 1 node and did not save…

then the button disappeared and now I think I have to manually open and save all nodes?

Is there a better way? And what is it for?

If you still have any “old” nodes refreshing the page should bring back the button.

You can also open up a console in your browser dev tools and run the function nodeVersion.getOldNodeCount(). That will show how many actual “old” nodes you still have.

I only have “old” nodes :-). Refreshing I tried, restarting node-red also… no button back.

Where do I do:

Do you still have nodes with yellow labels?

Press F12 with NR tab active

image

Yes, all have yellow labels…

this?

these are all yellow:
image

@Kermit have you seen this issue? https://github.com/hassio-addons/addon-node-red/issues/1023#issuecomment-846435621

Yellow text on the node like below.
image

You need to get enter after typing the command. It should show a number on the line after.

No I hadn’t, I’m not subscribed to issues on the NR add-on repo.

I just tested a fresh installed of the latest released add-on and got no errors. I’ll have to take a closer look.

Yes, all my home assistant nodes are yellow, sorry I have said that now 4 times :rofl:.

Reading back I was indeed not so clear. I want to point out with the configuration node snippet only the amount of home assistant nodes:

Another IMPORTANT Thing:
I think I have “not all” nodes yellow. I clicked away the message after the blue button (cancel) and then had to change “1” yellow node manually… that is now indeed black…

But i do not get that button back and I have 772 nodes yellow…

Running nodeVersion.migrateAllNodes() in the dev console will update the nodes as if you did it from the popup dialog.

My current guess is that those other errors I see in the console are stopping the popup from appearing.

And now? Hellllllllp

I have A LOT of those yellow errors… but no problems at all with nodered…?

Is there anything I can do? I just receive another small update on the nodered addon, that did not change anything either.

I really could use some help here

This is what happens when I go to http://noderedip:1880 and pres F12 I see directly:
nodered F12-2

Can you please assist? I do not want to get in (future) problems and I don’t want to open and close 771 nodes. And I am worried about the errors.

Totally at a loss here - all of a sudden all debug information disappeared! All the nodes seem to be working fine but they are not reporting anything within the node red web UI - neither in the right-hand side panel nor underneath each node.

I don’t seem to be getting any other errors beyond what is found in the addon log. As soon as I open the addon web ui and these pop up:

25 May 14:06:11 - [warn] Communication send error: Error: WebSocket is not open: readyState 3 (CLOSED)
25 May 14:06:14 - [warn] Communication send error: Error: WebSocket is not open: readyState 3 (CLOSED)
25 May 14:06:16 - [warn] Communication send error: Error: WebSocket is not open: readyState 3 (CLOSED)
25 May 14:06:17 - [warn] Communication send error: Error: WebSocket is not open: readyState 3 (CLOSED)
25 May 14:06:18 - [warn] Communication send error: Error: WebSocket is not open: readyState 3 (CLOSED)
25 May 14:06:21 - [warn] Communication send error: Error: WebSocket is not open: readyState 2 (CLOSING)
25 May 14:06:50 - [warn] Communication send error: Error: WebSocket is not open: readyState 3 (CLOSED)
25 May 14:06:51 - [warn] Communication send error: Error: WebSocket is not open: readyState 3 (CLOSED)
25 May 14:07:00 - [warn] Communication send error: Error: WebSocket is not open: readyState 3 (CLOSED)
25 May 14:07:04 - [warn] Communication send error: Error: WebSocket is not open: readyState 3 (CLOSED)

Any idea what’s happening?

@Kermit sorry to be very rude, impolite etc to adress you directly… can you please help me :grimacing:

Whaa!!! No idea what happened but I “got the blues” and I clicked on it… all nodes black now!

Tag node is great.

Would you have an example of what the new Device Node would be used for (or replace) Looks similar to the trigger node.

Device triggers are automation triggers that are tied to a specific device and an event or state change. Examples are “light turned on” or “water detected”.

Device triggers can be provided by the integration that provides the device (e.g. ZHA, deCONZ) or the entity integrations that the device has entities with (e.g. light, switch). An example of the former is events not tied to an entity e.g. key press on a remote control or touch panel, while an example of the latter could be that a light has been turned on.

Most of the nodes run from events sent by Home Assistant. But some integrations aren’t sending them for certain events like buttons.

The device node does exactly what a device trigger in a HA automation does.

2 Likes