Controlling Philips Hue with XQuery

Feb 03, 2013    

Playing around with a set of Philips Hue light bulbs.  Turns out you can control them with simple REST calls.

l-mlhue.xqy library on github

Simple Controller:

xquery version "1.0-ml";

import module namespace lh = "http://derickson/lib/l-mlhue"
  at "/lib/l-mlhue.xqy";

for $i in (1 to 10)
for $state in (
  $lh:RED, $lh:MAGENTA, $lh:PURPLE, 
  $lh:BLUE, $lh:GREEN, $lh:YELLOW, 
  $lh:ORANGE
)
return (
  lh:put-all-state( $state ),
  xdmp:sleep(1000)
)


Results

Thanks to: http://rsmck.co.uk/hue and http://blog.ef.net/2012/11/02/philips-hue-api.html