- Install
RASPBERRY PI OS LIGHT (32-Bit)
on the sdcard using Raspberry PI imager - Enable SSH connection
- Get Raspberry PI IP
ping raspberrypi.local
If you cannot ping the raspberry, you need to disable IPv6 on the raspberry. To perform this operation, you need to connect a keyboard and a screen on you raspberry and execute the following commands:
echo "
# Disable IPv6
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1
net.ipv6.conf.eth0.disable_ipv6=1
">>/etc/sysctl.conf
reboot
- Connect to the Raspberry using default password(
raspberry
)
- (optional)Setup Wifi
cat > /etc/wpa_supplicant/wpa_supplicant.conf <<-END
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=FR
network={
ssid="ocealize_5GHZ"
psk=9f230eefee32a4a59c61921d0a60e4951644e749fe394b3edc8297980e0618cd
}
END
wpa_cli -i wlan0 reconfigure
Optional: Encrypt password using wpa_passphrase
- Install docker-compose
apt-get update
apt-get -y install docker-compose
- Setup environment variable
cat > .env<<EOF
DUCKDNS_TOKEN=your-duckdns-token
DUCKDNS_DOMAIN=your-duckdns-name
LAN_IP_ADDRESS=your-lan-ip-address
EMULATED_HUE_LISTEN_PORT=your-hue-listen-port
HA_NAME=your-ha-name
HA_COUNTRY=your-ha-country
HA_LATITUDE=your-latitude
HA_LONGITUDE=your-longitude
HA_ELEVATION=your-elevation
MQTT_LOGIN=your-mqtt-broker-login
MQTT_PASSWORD=your-mqtt-broker-password
ZIGBEE_COORDINATOR_PATH=your-zigbee-coordinator-path # e.g: /dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20230508105424-if00
EOF
- Run docker-compose
git clone https://github.com/terrydervaux/maison-kuhn.git
cd maison-kuhn
docker-compose up -d
-
Setup static IP on the Router (eg: SFR BOX)
-
Create a NAT rules on the Routeur to forward the internet trafic(External Port) on internal services
Service | External port | Internal port | Usage |
---|---|---|---|
HTTPS | 8123 | 8123 | HA incoming trafic |
HTTPS | 443 | 443 | SWAG trafic |
HTTP | 6052 | 6052 | ESPHome traffic |
- Generate MQTT broker password
docker run \
-v "./config/mqtt:/mosquitto/config" \
eclipse-mosquitto \
mosquitto_passwd -b /mosquitto/config/passwd $MQTT_LOGIN $MQTT_PASSWORD
- Add MQTT broker on HA interface using raspberry $LAN_IP_ADDRESS and port 1883
Verify that the magic packet is broadcasted on the LAN
tcpdump -UlnXi eth0 ether proto 0x0842 or udp port 9 2>/dev/null |
sed -nE 's/^.*20: (ffff|.... ....) (..)(..) (..)(..) (..)(..).*$/\2:\3:\4:\5:\6:\7/p'
Test MQTT broker and HomeAssistant communication
sudo apt-get install mosquitto-clients -y
chmod +x ./test/mqtt-smoke-tests.sh
./test/mqtt-smoke-tests.sh
-
connect on Raspberry-pi
-
use the following commands
sudo su docker exec -it homeassistant bash wget -O - https://get.hacs.xyz | bash - exit
-
reboot home assistant
docker restart homeassistant
-
install the HACS integration from the UI
source: hacs.xyz