add phillips hue sync script

This commit is contained in:
Simon Rieger 2024-03-11 11:14:58 +01:00
parent 63d7f1d6bf
commit 9c3c65387f
2 changed files with 48 additions and 27 deletions

View file

@ -3,3 +3,5 @@
set -x
wl-paste -t text --watch clipman store &
~/scripts/phillips_hue-sync.sh &

View file

@ -1,6 +1,8 @@
#!/bin/bash
set -ex
#set -ex
while true; do
# Konfiguration
screenshot_path="$HOME/Desktop/screenshot.png"
@ -8,6 +10,19 @@ bridge_ip='192.168.1.115'
username='Jhw0h63UZOXZCkGsRUvMtAH7kbjWEe1YS1xh0yrl'
light_id='7'
# Test, ob die Bridge erreichbar ist
max_attempts=10
attempt=0
while ! ping -c 1 $bridge_ip &>/dev/null; do
attempt=$((attempt+1))
echo "Versuch $attempt von $max_attempts: Bridge nicht erreichbar, warte 10 Sekunden..."
if [ $attempt -ge $max_attempts ]; then
echo "Bridge nach $max_attempts Versuchen nicht erreichbar, breche Skript ab."
exit 1
fi
sleep 10
done
# 1. Screenshot erstellen
spectacle -b -f -n -o $screenshot_path
@ -35,3 +50,7 @@ response=$(curl --request PUT --data "$payload" $url)
echo $response
echo "Farbe erfolgreich gesendet!"
sleep 1
done