How to install fresh Image and FDIA code on RPi
Prepare SD Card
open RPi Imager
Select RPi hardware , Image RPI OS (Debian “Bookworm”) Lite, choose your SD Card
Select next and choose configure settings.
Enter Hostname
Enter Username and password
Add your ssh public key in ther
servicesectionauthentication via public keyClick next and procceed with imaging.
Insert SD Card in RPi1 b+ (or above Hardware) and power on
System will start up and after a while it reboots automatically.
After second boot you can try to login
sudo suswitch to root usernmcli -p connection showshow network interface confignmcli c mod "Wired connection 1" ipv4.addresses 10.0.0.220/24 ipv4.method manualset static ipnmcli con mod "Wired connection 1" ipv4.gateway 10.0.0.1set gateway ipnmcli con mod "Wired connection 1" ipv4.dns 10.0.0.1set dns to your home local network router (most use cases)If using multiple DNS Servers set like this
nmcli con mod "Wired connection 1" ipv4.dns "8.8.8.8,8.8.4.4"If you want to use multiple IP’s you can set
nmcli c mod "Wired connection 1" ipv4.addresses "10.0.0.220/24, 10.0.0.221/24, 10.0.0.222/24" ipv4.method manuallike thisshutdown interface and up again to activate settings
nmcli c down "Wired connection 1" && sudo nmcli c up "Wired connection 1"show network config run
nmcli -p connection show "Wired connection 1"Now it’s time to install required base software
sudo apt install mc git screen curl python3-pip python3.11-venv direnvcd /usr/local/bingit clone https://github.com/OliverDrechsler/front_door_intercom_automation.gitclone repo.cd front_door_intercom_automationpython3 -m venv .venvcreate a python virtualenv.chmod +x .venv/bin/activate.venv/bin/activateadd
eval "$(direnv hook bash)"to~/.bashrcrun
source ~/.bashrccreate
.envrcin fdia dir and add linesexport VIRTUAL_ENV=./.venv layout python-venv $VIRTUAL_ENV
now run
direnv allow.venv/bin/pip3 install -r requirements.txtto install required libs.configure now
config.yaml.venv/bin/python3 -m fdiatest runEdit file
fdia.serviceand adjust to your path toExecStart=/usr/local/bin/front_door_intercom_automation/.venv/bin/python3 /usr/local/bin/front_door_intercom_automation/fdia.pybecause python fdia code runs in python virtualenv therefore we’ve to call this python3 executable before.To run fdia as a service on startup with root permissions
copyfdia.serviceto/etc/systemd/system/to your RPi systemd deamon folder.Run
systemctl daemon-reloadandsystemctl start fdiato start it as a service.check log output
journalctl -xu fdia -factivate new service
systemctl enable fdia.service
Hint for direnv error
In case you get an error with direnv, you can try to run the following command to fix it: Command:
direnv allow
Error:
direnv: loading front_door_intercom_automation/.envrc
environment:747: layout_python-venv: command not found
direnv: export +VIRTUAL_ENV
create a new file in
~/.config/direnv/direnvrcwith content:layout_python-venv() { local python=${1:-python3} [[ $# -gt 0 ]] && shift unset PYTHONHOME if [[ -n $VIRTUAL_ENV ]]; then VIRTUAL_ENV=$(realpath "${VIRTUAL_ENV}") else local python_version python_version=$("$python" -c "import platform; print(platform.python_version())") if [[ -z $python_version ]]; then log_error "Could not detect Python version" return 1 fi VIRTUAL_ENV=$PWD/.direnv/python-venv-$python_version fi export VIRTUAL_ENV if [[ ! -d $VIRTUAL_ENV ]]; then log_status "no venv found; creating $VIRTUAL_ENV" "$python" -m venv "$VIRTUAL_ENV" fi PATH="${VIRTUAL_ENV}/bin:${PATH}" export PATH }
run now
source ~/.bashrcand thancd /usr/local/bin/front_door_intercom_automation direnv allow