Does anyone else use scripting to control lights using OpenHAB? I recently have been on a quest to get a script file (bash on a linux box) to run thru OpenHAB which controls my Lifx and Hue bulbs. So far I have found lightsd to control my Lifx bulbs and if you use a Hue hub, the hub actually has a interface built in. Using GET and Put commands you can control your Hue bulbs. So far, I have gotten a script to run using executeCommandLine and run it from within OpenHAB. (I will post step by step instructions to do all this in this thread as soon as I can)
OK, great, but why bother?
OpenHAB can do a great job controlling the lights. Most the time this is true for switching them on and off based on motion, daylight, whatever using rules. But one thing it doesn’t do very well. This may sound really dumb but… I wanted to blink the lights. Why? because it gets my attention. Like sounds, blinking the light can signal the phone is ringing or… the building is on fire!
It is easily possible to blink the lights using OpenHAB rules and I will post my working example in this thread as well (derived from threads on this forum by the masters) but, I’ve noticed doing to much more then blinking them starts not working so great. In other words, if I need to send commands to change the color, dimmer value and blink on and off with expire binding timers and such, if tested on it’s own works but combined with other activity on the event bus (such as dealing with whatever triggered the lights to blink) gets sluggish, skips steps or gets stuck half way thru in a weird state. There is also a limit in how fast they will blink. For me on a small pc, that is about once a second
This quickly starts to feel like I am trying to drive a nail into a piece of wood but instead of using a hammer, all I have is a pipe wrench. It works but not that well.
This is where lightsd and the Hue bridge api come in. Using a command line to run a script, OpenHAB fires the script and moves on doing other important stuff OpenHAB can do and does not waste resources doing something stupid it was never made to do. I have one working script using a single waveform command to my Lifx bulb that makes it look like there is a police car in the living room. I will post my working scripts and instructions as soon as I can.
Anyone have tips or working examples of using executeCommandLine and the exec binding or experience setting up permissions and stuff (permissions and user right seem to be the really difficult part of this and I will post what I’ve learned)
other api for other bulbs or whatever you do that works and I haven’t thought of
using scripts to do other cool stuff (I’m also using all this to play sounds)
What cool stuff you use your lights for in automating you setup using OpenHAB