doorbot/README.md

1.6 KiB

Todo

  • resolve XXX

Setup

Flash the Raspberry Pi

sudo apt install rpi-imager
rpi-imager

Select your Device, OS, and Storage. In my case:

  • Device: Raspberry Pi Zero
  • Operating System: Raspberry Pi OS (32-bit)
  • Storage: /dev/mm....

Then click "Next", and "Edit Settings":

  • Set Wifi SSID + Password to your local WIFI network
  • Enable Key-based SSH authentication to "user" with an ed25519 key
  • Hostname: r8.local
  • XXX

Add to your /home/user/.ssh/config:

Host r8
    Hostname 192.168.0.12  # adjust the local IP
    User user
    IdentityFile /home/user/.ssh/id_ed25519

Store the keyblepy secrets in pass

Press and hold "Unlock" button until the yellow light flashes in order to enter pairing mode. Then register the user:

cd keyble
./keyble.py --register --qrdata <qr_data> --user-name doorbot --user-key <user_key> --verbose

This is how you get the variables (you should store them in pass):

  • pass edit r8/keyblepy/qr_data: scan the QR code on the key card with Delta Chat, use the text
  • pass edit r8/keyblepy/user_key: generate a 32-character hexadecimal string
  • pass edit r8/keyblepy/user_id: 0 if the raspi is your only device, 1 if you have an additional app configured.
  • pass edit r8/keyblepy/device_address: the Eqiva's Bluetooth MAC address, best you scan for it with the laptop. The device is called KEY-BLE.

Setup pyinfra and deploy the bot on the Raspberry Pi

python3 -m venv venv
. venv/bin/activate
pip install pyinfra
pyinfra r8 deploy.py
ssh r8
. .local/lib/eqiva.venv/bin/activate
python3 bot.py admin