add phillips hue sync script
This commit is contained in:
parent
63d7f1d6bf
commit
9c3c65387f
2 changed files with 48 additions and 27 deletions
|
@ -3,3 +3,5 @@
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
wl-paste -t text --watch clipman store &
|
wl-paste -t text --watch clipman store &
|
||||||
|
|
||||||
|
~/scripts/phillips_hue-sync.sh &
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -ex
|
#set -ex
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
|
||||||
# Konfiguration
|
# Konfiguration
|
||||||
screenshot_path="$HOME/Desktop/screenshot.png"
|
screenshot_path="$HOME/Desktop/screenshot.png"
|
||||||
|
@ -8,6 +10,19 @@ bridge_ip='192.168.1.115'
|
||||||
username='Jhw0h63UZOXZCkGsRUvMtAH7kbjWEe1YS1xh0yrl'
|
username='Jhw0h63UZOXZCkGsRUvMtAH7kbjWEe1YS1xh0yrl'
|
||||||
light_id='7'
|
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
|
# 1. Screenshot erstellen
|
||||||
spectacle -b -f -n -o $screenshot_path
|
spectacle -b -f -n -o $screenshot_path
|
||||||
|
|
||||||
|
@ -35,3 +50,7 @@ response=$(curl --request PUT --data "$payload" $url)
|
||||||
echo $response
|
echo $response
|
||||||
|
|
||||||
echo "Farbe erfolgreich gesendet!"
|
echo "Farbe erfolgreich gesendet!"
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
done
|
||||||
|
|
Loading…
Reference in a new issue