pi: GPIO-controlled theme switch
- apt dependencies (RPI.GPIO somehow needs to be installed from apt to work & re-establish uv venv with --system-site-packages - GPIO 20 triggers mode switching (can link to a photodiode or just switch)
This commit is contained in:
@@ -78,6 +78,23 @@ def deploy(restart: bool = False) -> bool:
|
||||
f"{ssh_target}:{remote_path}/",
|
||||
])
|
||||
|
||||
# Ensure system GPIO package is installed (pip version needs compilation)
|
||||
print()
|
||||
print("Ensuring system GPIO package...")
|
||||
run(
|
||||
["ssh", ssh_target, "dpkg -s python3-rpi.gpio >/dev/null 2>&1 || sudo apt install -y python3-rpi.gpio"],
|
||||
check=False,
|
||||
)
|
||||
|
||||
# Create venv with system-site-packages if it doesn't exist
|
||||
# This allows access to apt-installed packages like python3-rpi.gpio
|
||||
print()
|
||||
print("Ensuring venv with system-site-packages...")
|
||||
run(
|
||||
["ssh", ssh_target, f"cd {remote_path} && [ -d .venv ] || ~/.local/bin/uv venv --system-site-packages"],
|
||||
check=False,
|
||||
)
|
||||
|
||||
# Run uv sync to install/update dependencies
|
||||
# Use full path since non-interactive SSH doesn't load .bashrc
|
||||
print()
|
||||
@@ -115,9 +132,10 @@ def deploy(restart: bool = False) -> bool:
|
||||
print("Or run this script with --restart flag")
|
||||
|
||||
print()
|
||||
print("Note: First-time setup on Pi requires uv to be installed:")
|
||||
print("Note: First-time setup on Pi requires:")
|
||||
print(f" ssh {ssh_target}")
|
||||
print(" curl -LsSf https://astral.sh/uv/install.sh | sh")
|
||||
print(" curl -LsSf https://astral.sh/uv/install.sh | sh # Install uv")
|
||||
print(" sudo apt install python3-rpi.gpio # GPIO support")
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@ else
|
||||
echo "uv already installed: $(uv --version)"
|
||||
fi
|
||||
|
||||
# Install gpsd
|
||||
echo "Installing gpsd..."
|
||||
# Install gpsd and GPIO support
|
||||
echo "Installing system packages..."
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gpsd gpsd-clients
|
||||
sudo apt-get install -y gpsd gpsd-clients python3-rpi.gpio
|
||||
|
||||
# Configure gpsd (user needs to edit DEVICES)
|
||||
GPSD_CONFIG="/etc/default/gpsd"
|
||||
@@ -66,7 +66,10 @@ echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Configure gpsd: sudo nano /etc/default/gpsd"
|
||||
echo "2. Deploy backend: python3 scripts/deploy_backend.py (from dev machine)"
|
||||
echo "3. On Pi, install deps: cd $BACKEND_DIR && uv sync"
|
||||
echo "3. On Pi, create venv and install deps:"
|
||||
echo " cd $BACKEND_DIR"
|
||||
echo " uv venv --system-site-packages # Allows access to apt packages"
|
||||
echo " uv sync"
|
||||
echo "4. Start service: sudo systemctl start smartserow-backend"
|
||||
echo ""
|
||||
echo "Useful commands:"
|
||||
|
||||
Reference in New Issue
Block a user