| 1 |
# OLA Trigger config to control Philips Hue lights or Osram Lightify products (using a Philips Hue bridge) |
| 2 |
# Copyright (C) 2016 Johan Nilsson. www.gobo.ws |
| 3 |
# Thanks to Simon Newton and Sean Sill |
| 4 |
# Resources used from developers.meethue.com |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
# DMX protocol |
| 9 |
|
| 10 |
############################################################################### |
| 11 |
|
| 12 |
# Channel 1 lamp on/off. Value 0-114 lamp off. 140-255 lamp on |
| 13 |
# Channel 2 lamp intensity. Value 0-255 low -> high |
| 14 |
# Channel 3 Lightify plug on/off. Value 0-114 plug off. 140-255 plug on |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
# Comments |
| 19 |
|
| 20 |
############################################################################### |
| 21 |
|
| 22 |
# Responsiveness of the Hue bridge will slow down if you repeatedly send the on command, that's why we use 2 channels for the lamp |
| 23 |
# Please notice that the Hue bridge has some frame rate limits |
| 24 |
# Hue uses the range 1-254 to control the intensity, that's why the DMX value 0 is the same as 1 and the DMX value 255 is the same as 254 |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
# Configuration |
| 29 |
|
| 30 |
############################################################################### |
| 31 |
|
| 32 |
hostname='192.168.0.1' # Hue bridge hostname or IP address |
| 33 |
username='testuser' # Hue bridge username or MD5 hash |
| 34 |
light_id='1' # Light ID number |
| 35 |
plug_id='2' # Lightify plug ID number |
| 36 |
ttime='4' # Set the soft fade time from the light's current state to the new state. Default value is 4 (400 ms) Set 0 to disable |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
# Triggers |
| 41 |
|
| 42 |
############################################################################### |
| 43 |
# Slot Values Action |
| 44 |
|
| 45 |
1 0-114 -`curl '-H' '"Accept: application/json"' '-X' 'PUT' '--data' '{"on":false,"transitiontime":${ttime}}' 'http://${hostname}/api/${username}/lights/${light_id}/state'` |
| 46 |
1 140-255 +`curl '-H' '"Accept: application/json"' '-X' 'PUT' '--data' '{"on":true,"transitiontime":${ttime}}' 'http://${hostname}/api/${username}/lights/${light_id}/state'` |
| 47 |
2 0 `curl '-H' '"Accept: application/json"' '-X' 'PUT' '--data' '{"bri":1,"transitiontime":${ttime}}' 'http://${hostname}/api/${username}/lights/${light_id}/state'` |
| 48 |
2 1-254 `curl '-H' '"Accept: application/json"' '-X' 'PUT' '--data' '{"bri":${slot_value},"transitiontime":${ttime}}' 'http://${hostname}/api/${username}/lights/${light_id}/state'` |
| 49 |
2 255 `curl '-H' '"Accept: application/json"' '-X' 'PUT' '--data' '{"bri":254,"transitiontime":${ttime}}' 'http://${hostname}/api/${username}/lights/${light_id}/state'` |
| 50 |
3 0-114 -`curl '-H' '"Accept: application/json"' '-X' 'PUT' '--data' '{"on":false}' 'http://${hostname}/api/${username}/lights/${plug_id}/state'` |
| 51 |
3 140-255 +`curl '-H' '"Accept: application/json"' '-X' 'PUT' '--data' '{"on":true}' 'http://${hostname}/api/${username}/lights/${plug_id}/state'` |