In my old flat I had a couple of simple radio-controlled switches,
which allowed me to toggle power to a pair of standing lamps - one at
each side of the bed. This was very lazy, but also really handy and
I've always been curious about automation..
When it comes to automation there seems to be three main flavours:
- X10
The original standard, with stuff produced by many vendors and
good Linux support.
X10 supports two ways of sending/receiving commands - over
the electrical wiring, and over RF.
- Z-Wave
This is the newcomer, which despite that seems to be
well-supported and extensible. It allows "measurements" to be
sent/received in addition to the broadcast of events like "switch on",
and "switch off".
- Other systems - often lighting-centric
There are toy-things like the previously noted power-controlling
things, there are also stand-alone devices from people like
Philips with their philips hue
system, but given how Philips recently crippled their devices to disable
third-party bulbs I've no desire to use them.
One company caught my eye though, Osram make a
smart lightbulb and mini-hub to work with it.
So I bought one of the osram lightify systems, consisting of a magic box
and a pair of lightbulbs. The box connects to your wifi, and gets an
IP address. The IP address is then used by the application on your
mobile phone (i.e. the magic box does the magic, not the bulbs). The
phone application can be used to trigger "on", "off", "dim", "brighter", and the
various colour-changing commands, as you would expect.
You absolutely must use the phone-based application to do
the setup, but after that the whole point was that I could automate
things. I wanted to be able to setup my desktop computer to schedule
events, and started hacking.
I've written a simple Perl module to let me discover bulbs, and
turn them off and on. No doubt it'll be on CPAN in the near future,
once I can pick a suitable name for it:
$ ol --bridge=192.168.10.136 --list
hall MAC:8418260000d9c70c RGBW:255,255,255,255 STATE:On
kitchen MAC:8418260000cb433b RGBW:255,255,255,255 STATE:On
$ ol --bridge=192.168.10.136 --off=kitchen
$ ol --bridge=192.168.10.136 --list
hall MAC:8418260000d9c70c RGBW:255,255,255,255 STATE:On
kitchen MAC:8418260000cb433b RGBW:255,255,255,255 STATE:Off
The only niggle was the fiddly pairing, and the lack of any decent
documentation. The code I wrote was loosely based on the python
project python-lightify
written by Mikael Magnusson. Also worth noting that the
bridge/magic-box only exposes a single port so you can find the device
on your VLAN by nmapping for port 4000:
$ nmap -v 192.168.10.0/24 -p 4000
The device doesn't seem to allow any network setup at all - it only
uses DHCP. So you might want to make sure it gets assigned a stable
IP.
Anyway I'm going to bed. When I do so I'll turn the lights off
with my mobile phone. Neat.
In the future I will look at more complex automation, and I think
Z-wave is the way I'll go. Right now I'm in a rented flat so
replacing wall-switches, etc, is something I can't do. But the
systems I've looked at seem neat, and this current setup will keep me
amused for several months!
Tags: automation, lighting, osram lightify
|