A really simple Ruby Sinatra server that uses the lightwave_rf gem to control the Lightwave RF Wifi Link and devices.
This sends broadcast messages over the network that the server runs on. Therefore it must be on the same network as the Wifi Link.
Install the required gems:
$ bundle --path ./vendor/bundle
Start the Sinatra Server (Default port is 9292)
$ bundle exec rackup
The format for the commands is:
http://localhost:9292/room/device/action(/level)
Examples:
# to turn on device 1 in room 1:
http://localhost:9292/1/1/on
# to turn off device 2 in room 3:
http://localhost:9292/3/2/off
# to dim device 1 in room 1 to 50%:
http://localhost:9292/1/1/dim/50
Note: This should probably be using POST
requests instead of GET
requests but it's easier to create GET
requests by just navigating with a browser for the purposes of demonstration. If you're going to use this for anything but messing about I'd recommend replacing the method.
There's also a branch with some scripts to deploy this onto the RaspberryPi.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request