X10 Scheduling
In the last entry we just did some basics of the X10 system, now we’ll go over using them efficiently. The CM11A device allows you to upload a schedule to it that it will store in it’s own memory, so even if your computer is off, your X10 still works without missing a beat. All it takes is a small config file stored in /etc/heyu (or in ~/.heyu) called x10.sched . Heyu comes with a sample file, it’s very lengthy and can be confusing to some people.
Let’s just start by explaining what each section does, below is some of my x10.sched:
timer smtwtfs 01/01-12/31 05:20 07:30 kitchen_on kitchen_off
macro kitchen_on 0 on a3-4
macro kitchen_off 0 off a3-4
The above will run a timer every day of the week, from 5:20 AM to 7:30AM. The kitchen_on command will be run at 5:20AM (when my fiance is getting up. The kitchen_off command will be run at 7:30AM when the sun has come up and she is normally gone to work. The macro section tells the system what you want the kitchen_on/kitchen_off to actually do. As you can see the first macro will turn devices A3 & A4 on, being my kitchen overhead light and the laundry room. The second macro will turn the same devices off. Pretty basic, but effective, the 0 in between the macro name and the command seems to be a default and is needed. Now onwards to triggers!
trigger a9 off a9off
macro a9off 0 off a1-2,6
The above will trigger the macro a9off when device A9 is turned off. It’s useful for tying whole living rooms together, and works vice versa for turning things on assuming you change the off commands to on. The macro a9off is set to control devices A1, A2, and A6.
Below is what I use for my outside lights, I want them to come on right about the time it gets dark outside and turn off about the time I usually go to bed. Who really likes walking up to your house, hands full and have to fumble for your key in the dark? As you can tell, it runs 7 days a week, the whole year. Now these look a little bit different than the previous, we have two macros running at the same time? The first macro on the first timer will turn the light on, the second macro will make sure it’s set to 100% power before we start to dim it, yes we’re going to dim these lights every day, I don’t see much point in using full bright lights, I want enough to see, but I can save a few bucks a months by toning down the power usage. So the second timer will run the macro that will dim the lights, as you can see the second time in the second time is 00:00 and the macro for that time is null, meaning it will do nothing. The third timer is the one that will turn off the light at 12:30am and again I use a null for the second macro since I don’t need it.
timer smtwtfs 01/01-12/31 17:45 17:45 outside_on outside_bright
timer smtwtfs 01/01-12/31 17:45 00:00 outside_dim null
timer smtwtfs 01/01-12/31 00:30 00:00 outside_off null
macro outside_on 0 on a5
macro outside_bright 0 bright a5 22
macro outside_dim 0 dim a5 9
macro outside_off 0 off a5
This timer below is kinda like a failsafe if I don’t turn out my lights, I run it every day except Friday and Saturday since I’m normally up later, and sometimes into the early and light AM.
timer smtwt.. 01/01-12/31 01:30 00:00 lightsout null
macro lightsout 0 off a2-4,6
This should give you a basic understanding on writing your own schedule, and using triggers to perhaps even ’set the mood’ with the push of ONE button, or even a timer :-p
Now how do we make the CM11A use it? Well that’s easy, once you’ve typed it all up, save it to either /etc/heyu/x10.sched or /home/YOURHOME/.heyu/x10.sched. Then just open up a terminal on your box that has the CM11A and heyu and type heyu upload this should tell you it got uploaded successfully and your good to go.
On a side note, in the last entry there was a comment by Dan, visiting his page I saw some people showed interest in having an alarm clock that would slowly turn lights on. Well here it is, set a timer for the same time your alarm clock is set for, and you can even have it increase the brightness every few minutes. And there you have a homebrew way to make it seem like your alarm clock and lights are in cahoots together.
We’re still only scratching the surface of what linux can do when it’s tied to the rest of your world.
Click here to download a copy of my x10.sched

I didn’t event know i could upload commands to my CM11, I’ll have a play with that later, great write up, cheers!