Hardware Reference
In-Depth Information
Sending Messages
This is done simply with commands such as the following:
heyu turn studio on
heyu onstate studio
heyu bright lounge 5
heyu lightsoff _ # the underscore means current house code
which can be placed in larger shell scripts, called out from other languages, or triggered through a web site with CGI.
Note that these are all blocking commands, so the rest of the script won't execute until the X10 messages have been
sent—unless you begin the task in background mode, of course:
heyu turn studio on &
These commands can also be placed in your crontab, saving the need to upload changes to the CM11U's
internal EEPROM:
export EDITOR=vi
crontab -e
Then as a sample line, add the following:
30 9 * * 1-5 /usr/bin/play /usr/share/sounds/alsa/Noise.wav
This adds an alarm call at 9:30 a.m. (when else!?) on every day of the month (the first wildcard) in every month of
the year (second wildcard) when it's also a weekday (Monday=1, Friday=5).
If you want to add a random element, say within half an hour of 9:30, then you can use some simple bash to
instead call this:
00 9 * * 1-5 sleep `echo $((RANDOM%60))m`; /usr/bin/play «
/usr/share/sounds/alsa/Noise.wav
Note that I've begun the delay 30 minutes earlier but created a random value that lasts up to 60 minutes.
Receiving Messages
Whenever a command is received, Heyu is able to launch an external script as specified in the configuration file.
In many cases, this might be to switch on additional lights, acting like a scene or macro:
SCRIPT bedroom on :: /usr/local/bin/heyu turn bedside_light1_mine on
SCRIPT bedroom on :: /usr/local/bin/heyu turn bedside_light2_theirs on
Instead of controlling only lights, it could run an external script. This has the benefit of being editable by a user
other than root, it doesn't require a heyu restart , and it provides a lot of flexibility that can't be squashed onto a
single line. Code such as the following:
SCRIPT bedroom off :: ~steev/bin/housenight
Search WWH ::




Custom Search