first step to implement animations for lounge light
This commit is contained in:
parent
45d4c0028e
commit
aa79157891
22
light.sh
22
light.sh
|
@ -17,7 +17,7 @@ STATE_1="a\x00\x03\xff\xff\xff|255255255255255255;\
|
|||
STATE_2="n\x00\x02\x01\x00|170000070150000050;\
|
||||
000000000000000000;\
|
||||
000000000000000000"
|
||||
STATE_3="!/usr/bin/python3 /home/automation/fensterbogenbeleuchtung_animations/animations.py|170000070150000050;\
|
||||
STATE_3="!/usr/bin/python3 /home/automation/fensterbogenbeleuchtung_animations/animations.py|!;\
|
||||
000000000000000000;\
|
||||
000000000000000000"
|
||||
|
||||
|
@ -44,13 +44,7 @@ esac
|
|||
set_room_color() {
|
||||
case "$ROOM_NUMBER" in
|
||||
1)
|
||||
PID_FILES="$( find "$(dirname "$TMPFILE_PID_BASE")" -name "$(basename "${TMPFILE_PID_BASE}_1_*")" )"
|
||||
if ! [ -z "$PID_FILES" ]; then
|
||||
for i in "$PID_FILES"; do
|
||||
kill "$( cat "$i" )"
|
||||
rm -f "$i"
|
||||
done
|
||||
fi
|
||||
find "$(dirname "$TMPFILE_PID_BASE")" -name "$(basename "${TMPFILE_PID_BASE}_1_*")" -exec sh -c 'cat {} | xargs kill; rm -f {}' \;
|
||||
COLOR_A="$(echo "$STATE" | cut -d";" -f1 | cut -d"|" -f1)"
|
||||
COLOR_B="$(echo "$STATE" | cut -d";" -f1 | cut -d"|" -f2)"
|
||||
if [ "${COLOR_A:0:1}" == "!" ]; then
|
||||
|
@ -59,7 +53,17 @@ case "$ROOM_NUMBER" in
|
|||
else
|
||||
for i in {1..5}; do (echo -en "$COLOR_A" > /dev/udp/172.23.92.15/49152 &); sleep .01; done
|
||||
fi
|
||||
for i in {1..5}; do (echo -en "$COLOR_B" > /dev/udp/172.23.92.16/31302 &); done
|
||||
if [ "${COLOR_B:0:1}" == "!" ]; then
|
||||
(
|
||||
while true; do
|
||||
echo -en "255204017255204017" > /dev/udp/172.23.92.16/31302 &
|
||||
sleep .5
|
||||
done
|
||||
) &
|
||||
echo $! > ${TMPFILE_PID_BASE}_1_B
|
||||
else
|
||||
for i in {1..5}; do (echo -en "$COLOR_B" > /dev/udp/172.23.92.16/31302 &); sleep .01; done
|
||||
fi
|
||||
;;
|
||||
2)
|
||||
# COLOR_A="$(echo "$STATE" | cut -d";" -f2 | cut -d"|" -f1)"
|
||||
|
|
Loading…
Reference in New Issue