Skip to content

Instantly share code, notes, and snippets.

@cdrum
Created October 26, 2014 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdrum/a1581826164dc579c943 to your computer and use it in GitHub Desktop.
Save cdrum/a1581826164dc579c943 to your computer and use it in GitHub Desktop.
example code
local http = require('socket.http')
http.TIMEOUT = 20
http.request{url='http://192.168.1.221:56780/lights/d073d5005654/on', method='PUT', headers = {['Content-Length'] = string.len(''),['Content-Type'] = 'application/x-www-form-urlencoded'}}
http.request{url='http://192.168.1.221:56780/lights/d073d5005654/color?hue=0&saturation=0&brightness=0.35138475623713&kelvin=2500', method='PUT', headers = {['Content-Length'] = string.len(''),['Content-Type'] = 'application/x-www-form-urlencoded'}}
http.request{url='http://192.168.1.221:56780/lights/d073d500114b/on', method='PUT', headers = {['Content-Length'] = string.len(''),['Content-Type'] = 'application/x-www-form-urlencoded'}}
http.request{url='http://192.168.1.221:56780/lights/d073d500114b/color?hue=0&saturation=0&brightness=0.28865491721981&kelvin=2500', method='PUT', headers = {['Content-Length'] = string.len(''),['Content-Type'] = 'application/x-www-form-urlencoded'}}
http.request{url='http://192.168.1.221:56780/lights/d073d5008af8/on', method='PUT', headers = {['Content-Length'] = string.len(''),['Content-Type'] = 'application/x-www-form-urlencoded'}}
http.request{url='http://192.168.1.221:56780/lights/d073d5008af8/color?hue=0&saturation=0&brightness=0.07510490577554&kelvin=2500', method='PUT', headers = {['Content-Length'] = string.len(''),['Content-Type'] = 'application/x-www-form-urlencoded'}}
http.request{url='http://192.168.1.221:56780/lights/d073d5003e99/on', method='PUT', headers = {['Content-Length'] = string.len(''),['Content-Type'] = 'application/x-www-form-urlencoded'}}
http.request{url='http://192.168.1.221:56780/lights/d073d5003e99/color?hue=0&saturation=0&brightness=0.10588235294118&kelvin=4000', method='PUT', headers = {['Content-Length'] = string.len(''),['Content-Type'] = 'application/x-www-form-urlencoded'}}
return true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment