Node-red-contrib-home-assistant-websocket


#61

Hello @Kermit, just updated to version 0.1.3 and I’m getting the following error in the palette
snip_20181029190704

Tried refreshing it and but no change.


#62

FYI @frenck has released a new version of the node-red addon v1.0.0 with node-red-contrib-home-assistant-websocket 0.1.3


#63

:tada: :tada: :tada: :tada: :tada:


#64

Look like you have multiple forks of the node-red-contrib-home-assistant installed. Take a look at post #7 for instructions on how to solve this.


#65

That is exactly how I installed it

# stop node-red
$ cd ~/.node-red
$ npm uninstall node-red-contrib-home-assistant
$ npm install node-red-contrib-home-assistant-websocket
# then restart node-red

I just tried it again minute ago but it didn’t change anything.


#66

Someone mentioned on discord regarding the packages.json file on /config/node-red. There was a section about dependencies — see if you have them, remove the entries (backup first), and restart.


#67

Thanks for the tip. I looked at it and it is only showing “node-red-contrib-home-assistant”: “~0.3.2”. I’ll look at again tomorrow just in case I’m looking for it in the wrong place.


#68

That would probably be it. You are pretty safe to remove that line and reboot node-red.


#69

@rsuplido & @Kermit - thank you both, that one line was the issue. All fixed now.


#70

Yeah, my bad. I had switched to docker-compose and got my permissions messed up. All OK now.


#71

I’m getting an error when HA restarts. The connection keeps connecting and closing until I restart Node-Red.

2 Nov 15:50:20 - [info] [server:Home Assistant] WebSocket Closed http://hassio/homeassistant
2 Nov 15:50:20 - [info] [server:Home Assistant] WebSocket Connected to http://hassio/homeassistant
2 Nov 15:50:20 - [info] [server:Home Assistant] WebSocket Closed http://hassio/homeassistant
2 Nov 15:50:20 - [info] [server:Home Assistant] WebSocket Connected to http://hassio/homeassistant
2 Nov 15:50:20 - [info] [server:Home Assistant] WebSocket Closed http://hassio/homeassistant
2 Nov 15:50:20 - [info] [server:Home Assistant] WebSocket Connected to http://hassio/homeassistant
2 Nov 15:50:20 - [info] [server:Home Assistant] WebSocket Closed http://hassio/homeassistant

#72

If you wait long enough it will reconnect to Home Assistant when it comes back online. The reason you see Connected/Closed over and over is that the hass.io proxy doesn’t shut down when you reboot Home Assistant. So it’s connecting to proxy and authorizing with it then when the proxy realizes Home Assistant isn’t up it closes the socket, rinse and repeat.


#73

Is it possible to use wildcards in any way for parts of the entity name on the trigger: state node ?

Eg. I have 12 thermostats, all climate.something as the entity names - it would be great to be able to add a trigger once, using something like climate.* instead of 12 nodes with the name of each device.
(or the ability for the node to handle multiple entity names would be good)

This would make flows much cleaner to look at :slight_smile:


#74

Currently no you can’t use any sort of wildcard with the trigger node. I do have a plan to enhance the different logic abilities on all nodes. In the interim, if you aren’t using the logic of the trigger node you can use the event-state node with substring or regex.


#75

@Kermit can you explain how to properly use substring and regex or point me where I can read up on them?
Thanks!


#76

When you select substring for the entity filter on an event state node it works by searching each full entity_id and checking if it contains the partial filter word.

Example

If you had the above it would search the entity id of every state_change event to see if the id contains the letters cat

Take @swifty’s example above wanting the ability to filter by all climate.* ids. You could use climate. and it would fire for every id that contains it.

Regex is just a more complicated substring which allows for a whole lot more rules such as if the string starts with or ends with. There are a lot of better resources on the internet than me for learning regex.


#77

Thank you for the tip, I hadn’t considered using the ‘Event State’ node - that looks like it’ll probably work for what I need.

Next question - ‘Halt if state’ is it possible to specify multiple values for this ? (like ‘auto || manual’) ?

My climate devices have multiple modes, and I only want to output when the state of one changes to ‘boost’ - I could filter at a follow on node, but I like keeping things as clean as possible :smiley:


#78

This falls into the category of my previous answer to you. No, but it’s in the pipeline, hopefully in the next release. Like you said for now you can you a switch statement after the node.


#79

Thanks for confirming. I’ll go with switch for the moment :slight_smile:

Looking forward to seeing the planned improvements in the future :+1:


#80

Can Kermit or someone clarify, in simple terms, how to connect Node-RED to Home Assistant for those of us using Hassbian?

I started from a blank install.

Began following instructions from here: https://flows.nodered.org/node/node-red-contrib-home-assistant-websocket

Particularly, I followed the instructions on how to get Node-RED running in the first place. The link is a little hard to spot, but it links to here: http://nodered.org/docs/getting-started/installation

I followed the instructions, including the “main” command of sudo npm install -g --unsafe-perm node-red

This cleanly installed Node-RED and I tinkered with it for a couple of minutes. Then I went back to the “websockets” page.

I followed the 4 steps of including the Home Assistant components. One in the palette, the others from the shell.

The first Home Assistant node I drop onto the canvas wants Home Assistant server info and credentials. What the Base URL? Do I need an Access Token? If so, how do I get one? Or do I use Legacy API? And how do I do that?

Sorry, I’m new to all this. When I was using Hass.io, this was all done for me and it worked fine. But last night, my Hass.Io setup fell on the floor and I was lucky to copy my data files off the SD card. I decided to start over with Hassbian for the flexibility, but I lost all my Node-RED flows, which control all the lights in my house.

So please, once and for all, can someone spell out the steps for Hassbian users? (Also, if possible, how to clean out all the attempted stuff I’ve tried that didn’t work?)

Thanks a ton,

-bundito