This repository has been archived on 2024-05-13. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
moke 9061256d4c Merge pull request 'Refactoring and fixes' (#2) from alex/spaceapi-tuerpie-nix:main into main
Reviewed-on: #2
2024-01-09 08:50:58 +01:00
.cargo Added cross compile configuration 2024-01-05 15:02:36 +01:00
.config init 2023-04-21 19:10:17 +02:00
src Removed expandable close call 2024-01-05 17:03:29 +01:00
.env init 2023-04-21 19:10:17 +02:00
.gitignore init 2023-04-21 19:10:17 +02:00
Cargo.lock Removed dotenv dependency 2024-01-05 17:11:57 +01:00
Cargo.toml Removed dotenv dependency 2024-01-05 17:11:57 +01:00
Makefile init 2023-04-23 02:34:29 +02:00 Updated README 2024-01-05 17:02:03 +01:00
rust-toolchain Added cross compile configuration 2024-01-05 15:02:36 +01:00
shell.nix init 2023-04-23 02:34:29 +02:00

Spaceapi Tuerpi

Feeding our SpaceAPI with data from our entrance door.


To run the client, please change DOOR_PIN accordingly to your setup. DOOR_PIN defaults to a closed door, when HIGH.

You need to provide the environment variables SPACEAPI_URL and API_KEY to send the status to the SpaceAPI server. Details of the server can be found on the project page.


Install stable version of rust and run a regular cargo build:

cargo build

Cross compile

Install arm toolchain and libmusl for static linked binaries:

apt-get install gcc-arm-linux-gnueabihf musl-dev musl-tools

Build the application for raspberry pi:

cargo build --target=armv7-unknown-linux-musleabihf


Build the project as release and place pi binary under /usr/local/bin/spaceapi-tuerpi

sudo install -m 755 -o root -g root \
    target/release/pi \

Configure the spaceapi systemd service by placing the service description under /etc/systemd/system/spaceapi.service:

Description=SpaceAPI tuerpi client



Place the environment configuration with URL and API-Key under /etc/spaceapi-tuerpi.env:

SPACEAPI_URL=<your SpaceAPI server endpoint>
API_KEY=<your secret API key>
#DOOR_PIN=27    # Set the door pin
#RUST_LOG=ERROR # Set debug level

Ensure the /etc/spaceapi-tuerpi.env can be read only by root by executing:

sudo chmod 600 /etc/spaceapi-tuerpi.env
sudo chown root:root /etc/spaceapi-tuerpi.env

Apply changes to systemd to enable and start the service

sudo systemctl daemon-reload
sudo systemctl enable --now spaceapi