-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrgbhue.sh
27 lines (25 loc) · 929 Bytes
/
rgbhue.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
#!/bin/bash
# rgbhue.sh - OLA Trigger config to control Philips Hue color lights
# https://github.com/gobo-ws/ola-trigger-rgb-hue-dmx
if [ "$5" = "brightness" ]
then
curl -s 'http://'$3'/rgbhue?brightness='$6'&&transitionTime='$7'' > /dev/null
fi
if [ "$4" = "0" ] && [ "$5" = "rgb" ]
then
dmx=$( curl -s http://"$1"/get_dmx?u="$2" )
rgb=$( echo ${dmx} | jq -r '"\(.dmx[1]),\(.dmx[2]),\(.dmx[3])"' )
curl -s 'http://'$3'/rgbhue-rgb?rgb='$rgb'&&transitionTime='$7'' > /dev/null
elif [ "$4" -gt "0" ] && [ "$5" = "rgb" ]
then
dmx=$( curl -s http://"$1"/get_dmx?u="$2" )
chanred=$(($4+1))
changreen=$((chanred+1))
chanblue=$((changreen+1))
rgb=$( echo ${dmx} | jq -r '"\(.dmx['$chanred']),\(.dmx['$changreen']),\(.dmx['$chanblue'])"' )
curl -s 'http://'$3'/rgbhue-rgb?rgb='$rgb'&&transitionTime='$7'' > /dev/null
fi
if [ "$5" = "colorTemp" ]
then
curl -s 'http://'$3'/rgbhue-ct?colorTemp='$6'&&transitionTime='$7'' > /dev/null
fi