Improve HomeAssistant

Websockets are the way. It’s possible to subscribe to all the events then filter them… it’s just a bit of a PITA managing the websockets and all the connection/reconnection states, making sure it’s not stale, detecting when remote is down, retry logic etc.

Just had trouble finding the code… it was before custom nodes exist so it’s in a branch of my n8n repo

2 Likes

I’m also interest to connect my n8n to my Home Assistant assit.
Thanks a lot for all the help :slight_smile:

I’m also interested in this and I’ll offer any help as needed!

Hi there,
I just stumbled upon this thread.
I had the same problem and implemented some nodes:

This has a trigger node for Home Assistant events and Home Assistant triggers, as well as a node for doing actions, retrieving areas, entities, devices, etc.

It also has generic nodes if you want to call something weird, or a HA plugin.

Give it a try if you want, any feedback is appreciated

Awesome! Thanks for sharing. Will definitely give it a go👍

I noticed it’s still missing the method for testing the credentials. should still work fine though

1 Like

@ Simiil Hi, Could you share the trigger function sample? I try to set Specify Body by Using Fields Below and config Body Parameters but show some error:
"extra keys not allowed @ data[‘entity_id’]. Got ‘switch.AC’ required key not provided @ data[‘trigger’]. Got None

"
Thanks!

for subscribing to triggers, you’d be better off using the Home Assistant WS Trigger node, not the generic one:

There you have a bit more guidance how to subscribe to a trigger:

The Generic Trigger node is for if you want to subscribe to something that is not an event or a trigger.

1 Like

I updated the Integration.

There should be a functioning credentials test, as well as better error handling.

The Service Action node also provides the required model now:

1 Like

Tried this. But it will only execute once. After execution, it will not listen to the events anymore.

Hi there
I’m new at n8n, former user of node-red.

I have self-installed n8n on docker, I can see the Homeassistant actions nodes, but not the trigger ones.

Do I have to enable them somehow?

Thanks

@HHUBSS can you share your setup? that sounds like a bug

@Kite_M The trigger nodes are not official nodes, so you have to install them. you can follow this guide: GUI installation | n8n Docs