Skip to content

Homelab - Smart Home Server Home Assistant

Home Assistant is an open-source smart home server that can monitor all devices in your home. It has similar features to the Xiaomi Mi Home app, with a friendly and beautiful interface and relatively simple deployment.

Deployment (Docker Compose)

First, create the compose.yaml file and paste the following contents:

version: "3"
    container_name: ${STACK_NAME}_app
      - ${APP_PORT}:8123
      - ${STACK_DIR}:/config
      - /etc/localtime:/etc/localtime:ro
    privileged: true
    #network_mode: host
    restart: unless-stopped

(Optional) It is recommended to create a .env file in the same directory as compose.yaml, and customize your environment variables there. If you do not want to use environment variables, you can directly customize your parameters in compose.yaml (e.g., replace ${STACK_NAME} with audiobookshelf).

STACK_DIR=xxx # Customize the project storage path, e.g., ./homeassistant

# homeassistant
APP_PORT=xxxx # Customize the access port, choose one that is not occupied

Finally, run the docker compose up -d command in the same directory as compose.yaml to start the orchestrated containers.

Configuration Instructions

The official Home Assistant App can be used directly on mobile devices.

If you encounter a 400 Bad Request error when accessing from the Internet, you can add the following statements to the configuration file configuration.yaml:

  use_x_forwarded_for: true
    - # IP address of the proxy server
    - # You can also provide IP addresses with subnet masks

If you do not know the IP address of the proxy server, you can try accessing Home Assistant from the Internet, and you will be able to see it from the error information in the log.

References and Acknowledgments

This post is protected by CC BY-NC-SA 4.0 agreement, should be reproduced with attribution.

This post is translated using ChatGPT, please feedback if any omissions.