Self-host RustDesk Server inside Home Assistant

Hey everyone,

I’ve been using RustDesk lately as an awesome open-source alternative to TeamViewer and AnyDesk. I wanted to self-host the relay server to keep all my remote desktop traffic completely private, but I noticed there wasn’t a straightforward way to just run it as an App in Home Assistant. So, I put one together!

I figured others in the community might find this useful, so I’m sharing it here. No subscriptions, no relying on third-party public relay servers — your traffic never leaves your own infra.

Add Repository

GitHub: SankeerthBoddu/ha-rustdesk-server


How it works

The app bundles both of the RustDesk server components you need behind the scenes:

  • hbbs — the ID / rendezvous server (this handles discovery and NAT hole-punching)

  • hbbr — the relay server (this carries the network traffic when direct P2P fails)

Once the app is running, you just point your RustDesk clients (Windows, Mac, Linux, Android, iOS) to your Home Assistant IP or domain, and you’ve got a fully private remote desktop setup. Full encryption is enforced by default so unkeyed clients get rejected.


How to set it up

  1. Click the Add Repository badge above (or manually add https://github.com/sankeerthboddu/ha-rustdesk-server to your App store).

  2. Install RustDesk Server and hit Start.

  3. Click over to the Log tab — it automatically generates your encryption keys on the very first boot. Copy the Key it spits out.

  4. On every device you’re using with RustDesk (both the one you are sitting at AND the ones you want to control), go into Settings → Network → ID Server and enter:

  • ID Server: your HA domain or IP (e.g., myhome.duckdns.org or 192.168.1.100)

  • Key: paste the key you copied from the logs

Tip: You have to configure the ID Server and Key on both sides for this to work. When it connects successfully, the bottom status bar in the app turns green and says “Ready”.


A quick note on Networking

Since RustDesk uses raw TCP/UDP streams (it’s not HTTP data), your network setup is pretty important. Here are the most common ways to get it working outside your home network:

The simple way (DuckDNS / Direct IP)

If you use DuckDNS or anything that points straight back to your home IP, just port forward 21115 (TCP), 21116 (TCP & UDP), and 21117 (TCP) on your router pointing to your Home Assistant instance. Then use your DuckDNS hostname as the ID Server in the app.

Using Cloudflare?

If you’re using Cloudflare for your domain, you can’t use the proxy (Orange Cloud) because standard HTTP proxies will block the traffic. You have to set the DNS record to DNS Only (Grey Cloud).

Nginx Proxy Manager (NPM)

You can’t just use standard Proxy Hosts in NPM. You have to use the Streams tab feature to port forward the raw streams correctly:

  • 21115 TCP → <HA_IP>:21115

  • 21116 TCP / UDP → <HA_IP>:21116

  • 21117 TCP → <HA_IP>:21117


Supported architectures

Right now it builds for:

  • amd64 (Intel/AMD mini PCs and VMs)

  • aarch64 (Pi 4/5 64-bit etc.)


A couple of common gotchas

  • “ID Does Not Exist” error?

This almost always means the target pc (the one you are trying to connect to) hasn’t been configured to use your self-hosted server yet. Every machine needs to know about your ID Server and Key.

  • Where are the keys?

Just leave private_key and public_key blank in the add-on config. The add-on takes care of generating them on the fly, you just need to grab the public key from the logs.


I’ve put together some more docs on the repo with NGINX snippets and other details here: DOCS.md

Let me know if you run into any issues or have questions! Hope someone else finds this helpful to add to their HA setup. :raising_hands:

I am running RustDesk Server on a dedicated always on Linux PC with a static IP address on my home network and using it to access 8 other PCs on the same network (a combination of Windows and Linux machines). It works great but do you think that running the server inside Home Assistant is better than a stand alone RustDesk Server? What are the advantages apart from using one device to host both Home Assistant and the RustDesk Server rather than two separate devices?

Hey @CityBoySE1 ; Thanks for checking it out.

Honestly, if you already have a dedicated Linux server that you’re comfortable managing, your setup is perfect. There is no performance or feature advantage to running it inside Home Assistant—it’s the exact same RustDesk software under the hood!

The advantages of the add-on are purely for convenience:

  1. Accessibility: People running Home Assistant OS (HAOS) are locked out of the underlying OS, so add-ons are the only way for them to run extra services easily.
  2. Unified Backups: Your RustDesk encryption keys and databases are automatically included whenever HA takes a snapshot backup.
  3. Easy Management: Updates, logs, and automatic watchdog restarts are all handled directly in the HA user interface—no SSH or Docker commands required.

Short answer: If your standalone Linux box is working great, there is absolutely no reason to migrate! But for folks who want a simple “1-click” install managed directly by Home Assistant, this add-on fills that gap.

BIG thank you this came at a perfect time, the last few days rustdesk just refused to connect. I added this and was ready to help my brother again in a few minutes.
so thank you!!!

You’re very welcome, glad it helped! :tada:
RustDesk randomly refusing to connect is exactly why I built this add-on, so it’s awesome to hear it got you back up and helping your brother in a few minutes. :raised_hands:

This looks interesting. Will it work using Tailscale Funnel to access HA without opening ports on the router?
Thanks

Hey fantangelo!

The short answer is no to Tailscale Funnel, but yes to regular Tailscale!

Here is why: Tailscale Funnel is specifically designed to route public web traffic (HTTPS) over ports 443/8443, and it unfortunately doesn’t support the raw UDP and TCP sockets that RustDesk requires to function (specifically UDP port 21116 for the heartbeat).

However, you can still easily achieve exactly what you want (using RustDesk without opening a single port on your router) by just using standard Tailscale.

If you have the Tailscale add-on running on your Home Assistant, and the Tailscale app installed on your laptop/phone, they are securely on the same private VPN. All you have to do is type your Home Assistant’s Tailscale IP address (the 100.x.x.x one) into the “ID Server” box in your RustDesk clients.

It works flawlessly, keeps everything highly secure, and completely avoids having to port-forward anything on your home router! Hope that helps!

Thanks for the detailed reply and clarification. I will def give it a try.

Awsome, works like a charm.
Thanks a lot.

thefranz

Is this no longer available? I tried clicking the link but it did not install the app. I also do not see the app in the community app store.

Edit: Never mind, I had to manually add the repository for it to show up.

Thanks for this! Working great so far.