Node-red-contrib-home-assistant-websocket

I dropped the ball on that. Thanks for reporting, it’s fixed on the dev branch and will be in the next release.

https://github.com/zachowj/node-red-contrib-home-assistant-websocket/commit/18849d917984d9449c241ca9a9312dcfdcb98ea6

2 Likes

Great! Thank You!

It is working well now. Thanks for quick fix.

I noticed input attributes are not combined with configured attributes. Instead, input attributes override ALL the configured ones. Having input taking the priority fits with the usual NR pattern, but could it be more precise, and only override any duplicates?

I only ask because I planned to configure all the static attributes in the node, and define any dynamic ones in the payload.

Obviously, either way is very usable (and appreciated), as I could just define all of them in the payload.

Hi.
Im running Hassio, and followed the installation guide, installed node-v12.13.1 and added :blush:

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

to node-red configuration file.
But when I open Node-Red I cant find the new nodes. Why? :flushed:

This is excellent, are you going to push it to hass as an official component?

https://community.home-assistant.io/t/two-new-nodes-with-custom-integration-looking-for-testers/150736/22?u=kermit

Maybe at some point but right now this is only the first iteration.

2 Likes

I had planned to add different options on how to handle attributes and just forgot about it.

  • Override
  • Merge
  • Block Override

.

2 Likes

Hi
I’m trying to set a date and time for an input_datetime which is “now+24 hours”
I use the call service node with the following data field:

{
    "datetime": "{{ ((as_timestamp(now()) + 86400 ) | timestamp_custom('%Y-%m-%d %H:%M:%S')) }}"
}

however, I have the following error
"Call-service API error. Error Message: Invalid datetime specified: for dictionary value @ data['datetime']"

any idea of what is my mistake?
thanks!

Probably need to check Use alternate template tags

@Kermit : I’ve tried before but I still have an error, a different one though:

"Call-service API error. Error Message: Invalid datetime specified: {{ ((as_timestamp(now()) + 86400 ) | timestamp_custom('%Y-%m-%d %H:%M:%S')) }} for dictionary value @ data['datetime']"

and my next guess would be that the timestamp field of the service doesn’t accept templates. You can use a moment node before the call-service node and use { "datetime": "{{payload}}"}

ok thanks
I tried that and it works perfectly, even probably simpler to adapt!

Just finally migrated over to this from the LLAT node after procrastinating for about a year :slight_smile:

Works a treat and the migration was quite easy. Thanks @Kermit for all your hard work.

I’m trying your example but get an error in the debug window of

"Call-service API error. Error Message: must contain at least one of temperature, target_temp_high, target_temp_low."

image

Just using a inject node with a value of 18. What could I be missing?

image

You’re trying to extract msg.payload from msg. Just use payload in that field

Release of Documentation

The groundwork for external documentation is in place:

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


Buy me a coffee For those that enjoy my work.

2 Likes

That’s looking good

So I’ve been using this node happily for a while on a node red server running separately from my HA instance .

A couple of days ago I migrated to a NUC and am now running Node Red as a Hassio Addon .

After importing all my flows everything works flawlessly except for this node and my sensors no longer receive the updates in HA .

When Node Red is running from my original install the values update normally but after importing the flows to this new Node Red install the sensors won’t update anymore even though I can see all the values changing in the flow .

Any clue on what might be wrong ? Would really rather not have to create new sensors all over again as I have a lot of sensor templates tied to these … @Kermit ?

Edit : Just realized I am getting this error : “Sensor update attempted without connection to server.”
Apparently it creates new sensor entities after importing the flow, I suppose no way to keep the same entities as before ?

In tracing through my connection issues, it appears it’s related to this websocket library.

@Kermit, Any insight into why?

Node-Red disconnects and never reconnects after a debug “dump” happens with [object Object]:

1 Jan 10:38:06 - [info] [server:Home Assistant] WebSocket Closed http://hassio/homeassistant
1 Jan 10:38:06 - [debug] [server:Home Assistant] config server event listener closed
1 Jan 10:38:06 - [debug] [server:Home Assistant] config server event listener closed
1 Jan 10:38:11 - [debug] [server:Home Assistant] WebSocket Connecting http://hassio/homeassistant
1 Jan 10:38:11 - [debug] [server:Home Assistant] config server event listener connecting
1 Jan 10:38:11 - [debug] [server:Home Assistant] [object Object]
1 Jan 10:38:11 - [debug] [server:Home Assistant] config server event listener closed

I’m running NR 5.0.7, within a Dockerized environment on a NUC PC.

PS: Looks like it might be this line of code, nodes/config-server/config-server.js:289:

        onHaEventsError(err) {
            this.setOnContext('isConnected', false);
            this.debug(err);
        }

err is an object unable to be properly decoded by the log handler.