Skip to content

Instantly share code, notes, and snippets.

@sclaret
Last active December 6, 2021 10:20
Show Gist options
  • Save sclaret/0c37d2eb3ed251420786a1a86e9acccd to your computer and use it in GitHub Desktop.
Save sclaret/0c37d2eb3ed251420786a1a86e9acccd to your computer and use it in GitHub Desktop.
Home Assistant on Docker

Home Assistant

https://www.home-assistant.io

systemctl enable docker
systemctl start docker

mkdir -p ha/config

docker run -d \
  --name homeassistant \
  --privileged \
  --restart=unless-stopped \
  -e TZ=America/Toronto \
  -v /root/ha/config \
  --network=host \
  ghcr.io/home-assistant/home-assistant:stable

docker ps
CONTAINER ID   IMAGE                                          COMMAND   CREATED         STATUS         PORTS     NAMES
106f4558b985   ghcr.io/home-assistant/home-assistant:stable   "/init"   8 seconds ago   Up 5 seconds             homeassistant

#docker start 106f4558b985
#docker stats
#docker info   

docker exec -it 106f4558b985 /bin/bash
apk add neovim emacs git
/bin/bash <(curl -fsSL "https://raw.githubusercontent.com/sclaret/dotfiles/master/bootstrap/dotfiles?$(date +%s)")
git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
emacs

Localtuya Integration

https://github.com/rospogrigio/localtuya

wget https://github.com/rospogrigio/localtuya/archive/refs/tags/v3.2.3.tar.gz
tar -xvf v3.2.3.tar.gz

mkdir custom_components
cp -R localtuya-3.2.3/custom_components/localtuya custom_components/.

Configuration -> Integrations
Add Integration: localtuya

Mosquitto / Tasmota Integration

https://tasmota.github.io/docs/MQTT/

https://tasmota.github.io/docs/Commands/#setoption19

https://tasmota.github.io/docs/Home-Assistant/

emacs /etc/mosquitto/mosquitto.conf
listener 1883
allow_anonymous true

systemctl enable mosquitto
systemctl start mosquitto
systemctl status mosquitto

mosquitto_sub -t mytestsubject
mosquitto_pub -t mytestsubject -m testmsg -h pi3

cd /mnt/snap/root
btrfs subvolume snapshot 40-mos 50-ha
btrfs subvolume set-default 50-ha
btrfs subvolume get-default .
reboot
mosquitto_sub -v -t "#"
mosquitto_pub -t cmnd/tasmotas/setoption19 -m ""
Use MQTT discovery:
mosquitto_pub -t cmnd/tasmotas/setoption19 -m "1"
Use tasmota integration:
mosquitto_pub -t cmnd/tasmotas/setoption19 -m "0"

http://pi3:8123

Configuration -> Integrations
Add Integration: MQTT
Broker: 127.0.0.1
Add Integration: TASMOTA

Clone HA Config Files

https://github.com/sclaret/ha-config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment