Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

See here for current/preferred method : Home-Assistant - Supervised - HASSIO - Docker-Compose

You will be able to reach your installation at http://localhost:8123

https://www.smarthomebeginner.com/install-hass-io-on-docker-linux/#Home_Assistant_vs_HASSio

Note: It seems HASSio is now referred to as "supervised" and don't go looking for a hass tab, it's the subervised tab! Also, run it in docker on it's own dedicated VM. Just.... trust me. I used Ubuntu 18 in Oct 20 and it setup perfectly. I was able to just move my home-assistant core config directory over and everything worked. Granted, I started the night trying to setup ADB - Android Debugger Bridge, only to go down the rabbit hole of "HassIO vs Home-Assistant Core".... I got the Add-On store now and I'm done for tonight!

Home-Assistant (core):

Docker-Run:

docker run --init -d --name="home-assistant" -e "TZ=America/Whitehorse" -v /opt/homeassistant/:/config --net=host homeassistant/home-assistant:stable

Docker-Compose:

WD=/opt/homeassistant
mkdir -p $WD/{mnt,setup}
cd $WD/setup
cat << 'EOF' >docker-compose.yaml
version: '3.7'

services:
 home-assistant:
    container_name: home-assistant
    hostname: home-assistant
    image: homeassistant/home-assistant:stable
    network_mode: host
    volumes:
      - type: bind
        source: /opt/homeassistant/conf
        target: /config
      - type: bind
        source: /opt/homeassistant/mnt/
        target: /mnt
    environment:
      - 'TZ=America/Whitehorse'

EOF
chmod +x docker-compose.yaml

Automation:

Docker-Run:

cat << 'EOL' >/lib/systemd/system/home-assistant.service
[Unit]
Description=Docker_Description
Requires=docker.service network-online.target

[Service]
Restart=on-abnormal
ExecStart=/usr/bin/docker start -a home-assistant
ExecStop=/usr/bin/docker stop -t 2 home-assistant

[Install]
WantedBy=multi-user.target
EOL
systemctl enable home-assistant
systemctl start home-assistant
systemctl status home-assistant

Docker-Compose:

WD=/opt/homeassistant/setup
cat << EOF >$WD/home-assistant.service.setup.sh
cat << EOL >/lib/systemd/system/home-assistant.service
[Unit]
Description=home-assistant_Docker
Requires=docker.service network-online.target

[Service]

Restart=on-abnormal
ExecStart=/usr/bin/docker-compose --project-name home-assistant --project-directory $WD -f $WD/docker-compose.yaml up
ExecStop=/usr/bin/docker-compose --project-name home-assistant --project-directory $WD -f $WD/docker-compose.yaml stop

[Install]
WantedBy=multi-user.target
EOL
systemctl enable home-assistant
systemctl start home-assistant
EOF
chmod +x $WD/home-assistant.service.setup.sh
$WD/home-assistant.service.setup.sh


HASS:
 

https://github.com/home-assistant/supervised-installer

Note: If your running this on a "regular" server/VM DON'T USE "-m intel_nuc" as seen in many online guides, just leave that flag out and it builds

More Notes: This basically isn't supported anymore, and won't work on an existing machine w/ other docker containers. If you want to run it, I'd say run a dedicated Debian VM and then run this. I debated on it, but decided to try the prepackaged VMDK (and immediatley hated it, so I'm re-trying the below) as I might as well if Hass needs it's own VM. Stupidness IMO, Home Assistant is for power users, I wonder how many would like it to work in docker vs a Rasp Pi customized OS without APT/Yum etc etc....frustrating setup, but I do like the final product once it's working as expected. Sure is good for burning a few hours "tinkering"!

sudo su
apt-get install -y bash jq curl avahi-daemon dbus software-properties-common apparmor-utils
curl -sL https://raw.githubusercontent.com/home-assistant/supervised-installer/master/installer.sh | bash -s -- -d /opt/hassio
[Info] Install cli 'ha'
# ha

The Home Assistant CLI is a small and simple command line utility that allows
you to control and configure different aspects of Home Assistant

Usage:
  ha [command]

Available Commands:
  addons         Install, update, remove and configure Home Assistant add-ons
  audio          Audio device handling.
  authentication Authentication for Home Assistant users.
  cli            Get information, update or configure the Home Assistant cli backend
  core           Provides control of the Home Assistant Core
  dns            Get information, update or configure the Home Assistant DNS server
  hardware       Provides hardware information about your system
  help           Help about any command
  host           Control the host/system that Home Assistant is running on
  info           Provides a general Home Assistant information overview
  multicast      Get information, update or configure the Home Assistant Multicast
  os             Operating System specific for updating, info and configuration imports
  snapshots      Create, restore and remove snapshot backups
  supervisor     Monitor, control and configure the Home Assistant Supervisor

Flags:
      --api-token string   Home Assistant Supervisor API token
      --config string      Optional config file (default is $HOME/.homeassistant.yaml)
      --endpoint string    Endpoint for Home Assistant Supervisor (default is 'supervisor')
  -h, --help               help for ha
      --log-level string   Log level (defaults to Warn)
      --no-progress        Disable the progress spinner
      --raw-json           Output raw JSON from the API

Use "ha [command] --help" for more information about a command.



  • No labels