Skip to content

Instantly share code, notes, and snippets.

@oozman
Last active January 17, 2020 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oozman/56af4098407240b1d2c29472de0cdbe0 to your computer and use it in GitHub Desktop.
Save oozman/56af4098407240b1d2c29472de0cdbe0 to your computer and use it in GitHub Desktop.
Exposing HomeAssistant to the Internet

Install Dataplicity

Exposes our RaspberryPi to the web.

  • Login to RaspberryPi
  • Create account at https://www.dataplicity.com
  • Install Dataplicity daemon as per instruction.
  • Go to your Dataplicity dashboard and go to your device and enable wormhole.

Install Caddy Server

This will serve as our HTTP server.

  • Login to Raspberry Pi
  • Go to https://caddyserver.com and download caddy server.
  • Create a caddy.conf file and add this as content:
0.0.0.0:80 {
  proxy / localhost:8123 {
    websocket
    transparent
  }
}

Restart Caddy on Reboot

Create systemd service. This will run caddy server on restart.

  • Create caddy.service file and add this as content:
[Unit]
Description=My Caddy Server
After=network.target

[Service]
ExecStart=/usr/local/bin/caddy -conf caddy.conf
WorkingDirectory=/home/pi
StandardOutput=inherit
StandardError=inherit
Restart=always
User=pi

[Install]
WantedBy=multi-user.target
  • Copy caddy.service file to this location:
sudo cp caddy.service /lib/systemd/system/caddy.service
  • Try starting the service:
sudo systemctl start caddy.service
  • If all is good. Enable it so it will be restarted on reboot.
sudo systemctl enable caddy.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment