# OLA Trigger config to control Philips Hue lights or Osram Lightify products (using a Philips Hue bridge) # Copyright (C) 2016 Johan Nilsson. www.gobo.ws # Thanks to Simon Newton and Sean Sill # Resources used from developers.meethue.com # DMX protocol ############################################################################### # Channel 1 lamp on/off. Value 0-114 lamp off. 140-255 lamp on # Channel 2 lamp intensity. Value 0-255 low -> high # Channel 3 Lightify plug on/off. Value 0-114 plug off. 140-255 plug on # Comments ############################################################################### # 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 # Please notice that the Hue bridge has some frame rate limits # 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 # Configuration ############################################################################### hostname='192.168.0.1' # Hue bridge hostname or IP address username='testuser' # Hue bridge username or MD5 hash light_id='1' # Light ID number plug_id='2' # Lightify plug ID number 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 # Triggers ############################################################################### # Slot Values Action 1 0-114 -`curl '-H' '"Accept: application/json"' '-X' 'PUT' '--data' '{"on":false,"transitiontime":${ttime}}' 'http://${hostname}/api/${username}/lights/${light_id}/state'` 1 140-255 +`curl '-H' '"Accept: application/json"' '-X' 'PUT' '--data' '{"on":true,"transitiontime":${ttime}}' 'http://${hostname}/api/${username}/lights/${light_id}/state'` 2 0 `curl '-H' '"Accept: application/json"' '-X' 'PUT' '--data' '{"bri":1,"transitiontime":${ttime}}' 'http://${hostname}/api/${username}/lights/${light_id}/state'` 2 1-254 `curl '-H' '"Accept: application/json"' '-X' 'PUT' '--data' '{"bri":${slot_value},"transitiontime":${ttime}}' 'http://${hostname}/api/${username}/lights/${light_id}/state'` 2 255 `curl '-H' '"Accept: application/json"' '-X' 'PUT' '--data' '{"bri":254,"transitiontime":${ttime}}' 'http://${hostname}/api/${username}/lights/${light_id}/state'` 3 0-114 -`curl '-H' '"Accept: application/json"' '-X' 'PUT' '--data' '{"on":false}' 'http://${hostname}/api/${username}/lights/${plug_id}/state'` 3 140-255 +`curl '-H' '"Accept: application/json"' '-X' 'PUT' '--data' '{"on":true}' 'http://${hostname}/api/${username}/lights/${plug_id}/state'`