Home Automation & IoT

Keep Home Assistant, ESP32 sensor hubs, and local MQTT brokers reachable from the outside world when your residential ISP rotates your WAN IP address.

Home Assistant Raspberry Pi ESP32 & MQTT IPv6 CGNAT Bypass

The Connectivity Problem

Most residential broadband connections do not include a static public IP address. ISPs periodically reassign WAN IPs during maintenance, lease renewal, or router reboots. When this happens:

  • The Home Assistant mobile companion app loses connection while you are outside your home Wi-Fi network.
  • Remote IoT sensors and remote ESP32 telemetry nodes fail to push readings to your central MQTT broker.
  • External webhook integrations (like location triggers or notification relays) fail with connection timeouts.

Instead of paying monthly subscription fees for proprietary cloud relays, you can point a persistent dynamic hostname to your home network and update it automatically with a simple HTTP request whenever your IP changes.

Step 1: Provision Your Hostname

You do not need to register an account or verify an email address. Obtain a cryptographically signed hostname with one command:

Terminal
curl -s https://xyz.frl/generate

This returns JSON containing your hostname (e.g., <uuid>.xyz.frl), a username, and a cryptographic password. Save these in your secrets file.

Step 2: Automate Updates in Home Assistant

You can maintain DNS records directly inside Home Assistant without installing third-party add-ons. Add a shell_command to your configuration.yaml:

configuration.yaml
# In configuration.yaml
shell_command:
  update_dynamic_dns: "curl -s --user 'YOUR_USERNAME:YOUR_PASSWORD' 'https://xyz.frl/nic/update'"

# In automations.yaml
- alias: "Update Dynamic DNS on Interval & Startup"
  trigger:
    - platform: time_pattern
      minutes: "/10"
    - platform: homeassistant
      event: start
  action:
    - action: shell_command.update_dynamic_dns

Because the myip parameter is omitted, the server automatically detects your router's public WAN IP from the incoming request and updates both IPv4 (A) and IPv6 (AAAA) records if present.

Alternative: Lightweight Crontab on Raspberry Pi

If you run an IoT gateway, Pi-hole, or MQTT broker on a Raspberry Pi or Linux box, configure a crontab entry running under cron:

crontab -e
# Update DNS every 10 minutes (silent output)
*/10 * * * * curl -fsS --user 'YOUR_USERNAME:YOUR_PASSWORD' 'https://xyz.frl/nic/update' > /dev/null 2>&1

Dealing with Carrier-Grade NAT (CGNAT)

Many cellular and fiber ISPs place residential subscribers behind Carrier-Grade NAT (IPv4 CGNAT), making inbound IPv4 port forwarding impossible.

The IPv6 Solution: If your ISP assigns a public /64 IPv6 prefix, your Home Assistant server has its own globally routable IPv6 address. When your update client calls /nic/update over IPv6, XYZ.FRL creates an AAAA record directly for that device, bypassing CGNAT entirely without requiring port forwarding on your router.

Autonomous AI Agent Integration

Building an autonomous smart home agent with LangGraph, Claude, or Antigravity? Connect your agent to the remote MCP server at https://xyz.frl/mcp/sse.

The agent can check device WAN reachability by calling get_caller_ip and manage dynamic DNS assignments automatically during device provisioning without requiring manual configuration.

✓ Copied to clipboard!