N8n.io integration

Hello everybody,

Just sharing the third party addon I integrated to hassio for my personnal use. But maybe it could be helpful for you.

If you want to know more about n8n you can check it there : https://n8n.io/
It’s a tool between Zapier and Nodered. It’s open source, pretty beautiful and useful.

You can add my addons repository in your installation to use it.


image

Have a nice day

13 Likes

LOVE this!

1 Like

This add-on should definitely receive more attention, thanks for putting this together.

Any plans to keep up with maintaining the add-on or providing guide how to keep n8n up to date?

Hey,

I’ve created a Github action workflow that will check once a week if a new n8n version is available.
If so, it will automatically create a pull request to my repository with the version bump.

From now, I will follow n8n version from weeks to weeks in that addon

2 Likes

Great stuff, thanks for your hard work! :sunglasses:

Are you open for PRs? I have some ideas I am planning to test, such as syncing HA external url and n8n webhook urls etc. As for now, n8n defaults to container IP if I recall correctly.

I have been using cloudflared add-on to expose addons other services externally, n8n worked out of the box, but webhook urls were off. Minor thing as you can manually update them, but nice convenience factor for better UX :wink:

1 Like

I’am always open for contributions, feel free to fork the repository, do your tests on your own and make a PR back in the “official” repo. (Please with details and explanations, I quite lack time recently :confused: )

Nice idea for cloudflared, I’ll take a look thanks !

1 Like

Any guidelines on how to get it working. Can’t call services.

You’re my hero! I wanted to host my own n8n on HAOS and I’m not a dev myself to know how to set up my own Docker container. This made my day. Installing now.

Can someone help to set it up? I can get it working locally, but as soon as I change to https it crashes.

I use DuckDNS + NGINX SSL Proxy to access remotely and works fine for my HA, so I believe I should change to https, the URL to my domain:5678, and I also opened my 5678 port on my router. But it still crashes and can’t start it properly.

Hey ! What’s your error ?

There’s no error per se.

It just says:
Last session crashed
Initializing n8n process

and stays there. After a while it restarts and it repeats that cycle.

If I try to access https://mydomain.duckdns.org:5678/ or http://homeassistant.local:5678/ I just get refused to connect.

This is with this YAML:

auth: false
auth_username: myn8nemail
auth_password: mypass
timezone: Europe/London
protocol: https
certfile: fullchain.pem
keyfile: privkey.pem
webhook_tunnel_url: https://mydomain.duckdns.org:5678

If instead I switch back to this config, it works on local:

auth: false
auth_username: myn8nemail
auth_password: mypass
timezone: Europe/London
protocol: http
certfile: fullchain.pem
keyfile: privkey.pem
webhook_tunnel_url: https://localhost:5678

Tbh, even sticking with my domain as webhook URL it still works. Not sure what that does, I have just randomly tried different configs trying to find what was the issue, but no luck.

Also, I created a port forwarding TCP 5678 in my router. Tried with and without, since I’m not sure if it’s needed. But it didn’t make a difference.

Actually, if you’re using a reverse proxy (nginx SSL in that case), you should not use yourdomain:5678 but something like registering a subdomain like n8n.yourdomain and proxying it to hassioIp:5678. And doing that you don’t really need to enable https on n8s side, your nginx will secure the endpoint

1 Like

It worked!!
I struggled like an entire day since I’m not familiar (I honestly don’t know what I’m doing) with proxies and all this. HA nginx addon doesn’t allow you to add multiple domains, so I had to search for an alternative. I found there is indeed a NGINX Proxy Manager which is exactly for this.

Actually it simplifies A LOT the set up for DuckDNS + NGINX Proxy SSL. I replaced both for this new addon. I couldn’t just use n8n.mydomain.duckns.com as I had issues with the certificate being created, so I just created a new DuckDNS subdomain for it, and pointed it to 5678 as you mentioned. After a lot of back and forth I managed, and now I finally am ready to play with my own instance of n8n.

Many thanks!

2 Likes

You’re welcome, but you did it all by yourself, congrats, happy it’s working as expected !

1 Like

Is there any chance to have the addon updated? Atm we’re about 4 versions behind from the current n8n.

Even better it would be to automate the updates so they stay updated along the n8n releases. Is that doable at all?

Or are we able to update ourselves somehow? I’m just an update-freak, so I’m happy to do it manually myself if it’s not a huge deal.

Thanks for pointing that out. There is an automatic update, but n8n official website where I scrapped the latest version available changed URL, so the automatic update was broken. Following your message, I’ve updated the Github action that update the whole thing and in the following days, I’ll implement a check to avoid such silent failures in the future.

(I just pushed the version 218)

2 Likes

Hey @Rbillon59!

Any chance you could guide about how to find out the path to HA files from within n8n?

For example, I’m trying to use an n8n node to read a binary file, in this case some images from the /media/ folder. But “/media/Nikon/*.jpg” doesn’t work.

Is some env variable needed in the config? Do you know which one and how to define it? I’m not so familiar with this.

Many thanks for this and once again for this amazing add-on.

Hello @Chaoscontrol

When developing hassio addons, you set in the configuration what host hassio folder to map, as per the documentation the available mappings are :

List of Home Assistant directories to bind mount into your container. Possible values: config, ssl, addons, backup, share or media. Defaults to ro, which you can change by adding :rw to the end of the name.

From experience, I was setting everything to follow the least privileges pattern. Like only give what is needed, not more, to avoid setting too wide permissions.

From the community needs, I’ve added more and more mappings, so I believe it’s right to bind at least the backup, share, media as read write

I just added them. Update the addon and /media will be present as a bind mount from the hassio host. see build(deps): bump hass-n8n from `bbe3ea7` to `fd619f9` by dependabot[bot] · Pull Request #53 · Rbillon59/home-assistant-addons · GitHub

Have a nice day

2 Likes

Amazing. Thank you for the update. Will test it when I get the update.

Btw, did you notice there’s a major update in n8n? There’s some breaking changes AFAIK. Not sure if you’re auto-update will stop to include it or if there’s something we should do to adapt to it.

Thanks!

Well,

Thanks for pointing it, I did not follow. As I automated everything, I did not see it :slight_smile:

I set a protection just picking the 0.x.x to avoid including untested breaking changes.

I will need further investigation to test the 1.x to see if everything is Ok. Then I will follow the 1.x versions as I did previously.

If you want to contribute, I can create a specific branch in the GitHub - Rbillon59/home-assistant-addons: Repository of self made addons and let you test it ?

OFC I will mention your github in the repository as contributors for doing this :slight_smile:

Please let me know. I’am currently quite busy to work deeply on this one.

2 Likes

I’d love to help, really, but I’m not the right person. I’d love nothing more than being able to contribute and speed up the process.

I barely get around n8n and HA myself, and especially their setups. I’m no dev. I would not know where to start to use the branch from github instead of the master, how to install that in HA as a diff instance of the current one…

After all that is sorted then I’d be fully happy to test all my workflows extensively making sure everything works, but that’s as end user. :frowning:

I’ve tried reading the migration guide and the major things I picked up are

  • The changes to the WEBHOOK_TUNNEL_URL, but from my understanding it’s a matter of a name change.
  • Deprecation of MySQL and MariaDB. But no clue how this affects. For instance I use MariaDB as db in my HA. Not sure if that means I’ll need to switch or it’s unrelated in this case.

If I can help in anything at a adv user level, please let me know and I’ll do my best to help.

1 Like