Skip to content
Ahmed Elsafty edited this page Aug 3, 2023 · 11 revisions

Setup from scratch

This is one way to setup the Raspberry Pi. You will need a Micro SD Card Reader.

Raspberry pi

  1. Install Raspberry Pi OS Lite via Raspberry pi imager.
    • Enable SSH and set a username/password.
    • Configure Wireless LAN.
  2. SSH into the pi: ssh <username>@<ip-address>
    • Find raspberry pi's IP: arp -na | grep "b8:27:eb\|dc:a6:32".
    • In case of MITM attack warning: ssh-keygen -R <ip-address>.
  3. Install Docker (Raspbian version).
  4. Install and Run Homeassistant container.
    • Follow the guide through exposing Zigbee components.

Home Assistant

  1. Visit http://<ip-address>:8123 for initial setup.
  2. Visit http://<ip-address>:8123/config/integrations/dashboard.
    • Sonoff Zigbee 3.0 (antenna Integration) should be auto-detected and ready to be configured.
    • sudo docker compose restart -d if Integration is not visible.
  3. Visit http://<ip-address>:8123/config/devices/dashboard.
    • Put Zigbee switch in pairing mode.
    • From Zigbee coordinator, "Add device via this device".
  4. Visithttp://<ip-address>:8123/developer-tools/state.
    • Get the switch entity ID e.g. switch.innr_sp_220_switch.
    • This ID is needed by adhan-homeassistant-pi.
    • There will be multiple entities associated with our switch e.g. like switch.innr_sp_220_startup behavior. We are interested in entity ID with _switch suffix.
  5. Visit http://<ip-address>:8123/profile
    • In "Long-Lived Access Tokens", create a new token.
    • This Token is needed by adhan-homeassistant-pi.

Adhan MP3

  • Replace the sample Adhan mp3 file by uploading it to the raspberry pi via (for example):
    • scp adhan.mp3 <username>@<ip-address>:/home/<username>/adhan-homeassistant-pi/.

Adhan-homeassistant-pi

  • Clone the repo.

  • There are two ways to run adhan-homeassistant-pi:

    1. Docker Compose:

      • open docker-compose.yml and change these 4 arguments.
        • switch_id: from earlier e.g. switch.innr_sp_220_switch
        • homeassistant_ip: Home assistant IP with port e.g. http://192.168.178.58:8123/
        • homeassistant_token: long lived access token from earlier.
      • sudo docker compose up -d
    2. Docker:

     docker build --no-cache --tag adhan-homeassistant-pi-image:latest .
     docker run \
     	--detach \
     	--restart unless-stopped \
     	--device /dev/snd \
     	-e switch_id=<ADD_ME> \
     	-e homeassistant_ip=<ADD_ME> \  # e.g. http://192.168.178.58:8123
     	-e homeassistant_token=<ADD ME> \
     	adhan-homeassistant-pi-image:latest```

Clone this wiki locally