-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.sh
executable file
·60 lines (51 loc) · 1.75 KB
/
configure.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
# Create virtual environment
echo "[INFO] Creating virtual environment..."
python3 -m venv venv
source venv/bin/activate
# Install dependencies
echo "[INFO] Installing dependencies..."
pip install -r requirements.txt
# Download mediapipe models
echo "[INFO] Downloading mediapipe models..."
mkdir -p models
wget -q https://storage.googleapis.com/mediapipe-models/gesture_recognizer/gesture_recognizer/float16/1/gesture_recognizer.task -O models/gesture_recognizer.task
# Get bridge IP
echo "[INFO] Searching for bridge..."
response=$(curl -s "https://discovery.meethue.com/")
if [ $? -ne 0 ]; then
echo "[Warning] Could not find bridge"
read -p "Enter bridge IP: " bridge
else
bridge=$(echo "$response" | jq -r '.[0].internalipaddress')
echo "[INFO] Found bridge at $bridge"
fi
# Wait for user to press link button
read -p "Press the link button on the bridge and then press any key to continue..."
# Create user
echo "[INFO] Creating user..."
response=$(curl -s -X POST -d '{"devicetype": "mediapipe#mediapipe"}' "http://$bridge/api")
if [[ "$response" != *"success"* ]]; then
echo "[Warning] Could not create user"
read -p "Enter username: " username
else
username=$(echo "$response" | jq -r '.[0].success.username')
echo "[INFO] Created user $username"
fi
# List all lights
echo "[INFO] Listing lights..."
response=$(curl -s "http://$bridge/api/$username/lights")
echo "Available lights:"
echo -e "ID\tName"
echo "--------------------"
echo "$response" | jq -r 'to_entries[] | "\(.key)\t\(.value.name)"'
read -p "Enter light ID: " light
echo "[INFO] Selected light $light"
# Create config file
cat > config.yml <<EOL
lights:
bridge: $bridge
username: $username
light: $light
EOL
echo "[INFO] Configuration saved to config.yml"