trigger_switch_d
LICENSE
See LICENSE.txt
REQUIREMENTS
Mac OSX
-
USB dongle (such as tellstick from www.telldus.se)
-
ruby-serialport (ruby-serialport.rubyforge.org/)
-
VCP USB drivers (available at ftdichip.com)
DESCRIPTION
Scheduled (tsd) is run as a daemon without any need for user interaction. It sends commands to remote triggered devices such as lamps and switches, to activate/deactive them at scheduled times.
INSTALLATION
-
Get source
git clone git://github.com/pfspontus/trigger_switch_d.git
-
install gem:
<tt>sudo gem install trigger_switch_d</tt>
USAGE
Before running tsd you need to do a few things.
-
Setup required folders and files (home or system) by running
ts_setup (home|system)
make the necessary adjustments in environment.rb
-
Register you remote triggered devices in a file called devices using the following format (yaml):
<pre>—
-
name: “yttertrapp” switches:
-
unit_code: “5” house_code: A model_name: plain_tex
-
</pre>
-
Create a schedule in a file called scheduled_actions using the following format:
tänd yttertrapp klockan 08:15
where “tänd” is the action, yttertrapp is the device etc. Available actions are “tänd” and “släck”. Device names are the ones from step 1.
-
Copy the files devices and scheduled_actions to the sub-directory db
-
run tsd
COMMUNICATING WITH TSD WHEN IT IS RUNNING
Start IRB from a terminal and use UNIXSocket.open(“/tmp/com.adhocskill.trigger_switch_d”) to open a socket. Strings that tsd will respond to are:
-
list_schedule
-
list_devices
-
bye (disconnects client socket without stopping daemon)
-
stop (disconnects client socket and stops daemon)
The list of strings (commands) will get longer with time.
Here’s an example session:
bq. >> sock = UNIXSocket.open(“/tmp/com.adhocskill.trigger_switch_d”)
> #<UNIXSocket:0x1017ede78>
>> sock.send(“list_schedule”,0)
> 13
>> puts sock.recvfrom(1000)[0]
—
-
“släck källare vid soluppgång”
-
“släck källare klockan 00:15”
-
“tänd källare klockan 04:00”
-
“tänd yttertrapp vid solnedgång”
-
“släck yttertrapp vid soluppgång”
-
“tänd källare vid solnedgång”
> nil
>> sock.send(“bye”,0)
> 3
>> puts sock.recvfrom(1000)[0]
bye
> nil
>>
SUNRISE AND SUNSET
You can schedule an action to occur at sunrise or sunset by typing “vid soluppgång” or “vid solnedgång” instead of “klockan HH:MM” when you schedule your actions. As and example:
släck yttertrapp vid soluppgång
LOCALE
The file lookup.dsl in the config folder, contains words associated with the actions. The file is pretty much self explanatory feel free to set the words to the language of your choice.
FILE STRUCTURE
<pre>bin executable scripts config environment files db files used by tsd doc rdoc documentation of the whole project feature cucumber feature/step files lib project source log scheduled puts a running log here sample some sample files to put in db or config spec rspec bdd files</pre>