I've made a bash script with an endless while loop to switch between two colours for my Limitless/Milight bulbs. I've created a scene and attached this script to the on action section.
But now how do I end this while loop? I want to create another scene which on action first stops this while loop and then does some other stuff but I can't get it to work with break or anything else.
Whenever I execute this script from my raspberry pi I can type in ctrl + c and it stops but when I use the on action mode of a scene I have to shutdown my raspberry because it keeps sending signals.

This is my bash script:
Code: Select all
echo -n -e "\x49\00\x55" >/dev/udp/xxx.xxx.xxx.xxx/8899 # Keuken ON
while :
do
echo -n -e "\x40\x20\x55" >/dev/udp/xxx.xxx.xxx.xxx/8899 # Baby Blue
sleep 0.500
echo -n -e "\x40\xC0\x55" >/dev/udp/xxx.xxx.xxx.xxx/8899 # Pink
sleep 0.500
done
echo done