4 ms·
@prof_hobart, your 'smart' switch (Pi/http/touch-screen) sounds nifty. Are you willing to share any tips, methods, or even code for that hack?
by Dan_in_Brighton 11y ago
@prof_hobart, your 'smart' switch (Pi/http/touch-screen) sounds nifty. Are you willing to share any tips, methods, or even code for that hack?
- prof_hobart 11y agoSure. I can post some more details (such as scripts and photo) when I get home if you're interested. But at a high level, it's pretty straightforward, and there's also almost certainly far better ways of doing it. The key components are - a Philips Hue light - The Openhab[1] open source home automation server (currently running on an old Windows box that's always on for various other reasons). This controls the lights. - Apache, also running on the same box. This provides a very simple web UI for the Pi. - A Raspberry Pi - it's one of the original Pi model Bs. - Firefox (Iceweasel version) on the Pi - the built-in one didn't seem to run the jquery that I needed. - A cheapo touchscreen [2] attached to the Pi. The OpenHab server has a plugin for Hue lights, and you can write scripts to make it do various things, such as switch on/off at a particular time, or on getting a command from somewhere else. It also has a REST API interface. It's this API interface that the web app is calling. That's made up at the moment of 3 buttons (on, off and dim), and when one is pressed it sends a jquery REST call to the OpenHab server to trigger one of the commands. Technically, what it's doing is setting one of 3 OpenHab "buttons" to ON. This triggers the OpenHab rule to change the light. The touchscreen attaches straight onto the Pi's GPIO pins. I pointed Firefox at the Apache on my server and set it to full screen mode. The screen's not great - it feels as cheap as you'd expect for £16 - but it works, and most importantly my daughter loves it. Like I say, there's almost certainly better/simpler ways to achieve some of this - I suspect I could run the entire thing on the Pi for example, or replace the Pi with an old iPhone that I've got lying around. The OpenHab software also allows you to build a custom UI itself. But I like playing, and there's a bunch of tech things that I wanted to try out, and this seemed like a fun and useful project to test them out on. My next plan is to get an Arduino and connect some dials to it to allow direct control of brightness and RGB. [1] http://www.openhab.org/ http://www.openhab.org/ [2] http://www.amazon.co.uk/dp/B00YE0UPES http://www.amazon.co.uk/dp/B00YE0UPES