42 | | |
43 | | == Usage == |
44 | | |
45 | | These arguments can be used with tellstickController: |
46 | | |
47 | | {{{ |
48 | | |
49 | | -h, --help Show this help text. |
50 | | -v, --verbose Show extra information. |
51 | | |
52 | | -d, --daemon Starts in daemon mode. |
53 | | |
54 | | -f, --file F Set configfile to file F. |
55 | | -c, --check Check content of configuration file. |
56 | | |
57 | | -t, --test Test mode, no real devices will used. |
58 | | |
59 | | -a, --aliases List of aliases for devices/groups. |
60 | | -l, --list List states for all devices/groups. |
61 | | |
62 | | -s, --set D S Set device/group D to state S. |
63 | | -g, --get D Get state for device/group D. |
64 | | |
65 | | -x, --swap D Swap state for device/group D. |
66 | | -w, --swapfirst G Swap states for group G based on first device state. |
67 | | |
68 | | }}} |
69 | | |
70 | | An example of how tellstickController can be used in the console: |
71 | | |
72 | | {{{ |
73 | | |
74 | | # tellstickController --help |
75 | | |
76 | | # tellstickController --aliases |
77 | | Alias testDevice1 = receiver (/dev/tellstick0 NEXA A 1) |
78 | | Alias testDevice2 = receiver (/dev/tellstick0 NEXA A 2) |
79 | | Group allDevices = delay 10 seconds, aliases (testDevice1 testDevice2) |
80 | | |
81 | | # tellstickController --set testDevice2 on |
82 | | |
83 | | # tellstickController --list |
84 | | Device testDevice1 = off |
85 | | Device testDevice2 = on |
86 | | Group allDevices = off on |
87 | | |
88 | | # tellstickController --swap testDevice1 |
89 | | |
90 | | # tellstickController --get testDevice1 |
91 | | On |
92 | | |
93 | | # tellstickController --daemon |
94 | | |
95 | | }}} |
96 | | |
97 | | An example of how simple shell scripts may be setup: |
98 | | |
99 | | {{{ |
100 | | |
101 | | #!/bin/sh |
102 | | # |
103 | | # Power on bedroom MythTV, turn on backlight leds and turn off window lamp. |
104 | | # |
105 | | tellstickController --set bedroom_mythtv_power on |
106 | | tellstickController --set bedroom_mythtv_leds on |
107 | | tellstickController --set bedroom_window off |
108 | | |
109 | | }}} |
110 | | |
111 | | |
112 | | == Inställningar == |
113 | | |
114 | | An example of hos the file tellstickController.conf can look like: |
115 | | |
116 | | {{{ |
| 41 | == tellstickControllerTdtool == |
| 42 | === tellstickControllerTdtool usage === |
| 43 | {{{ |
| 44 | NAME |
| 45 | tellstickControllerTdtool |
| 46 | |
| 47 | SYNOPSIS |
| 48 | tellstickControllerTdtool [options] |
| 49 | |
| 50 | DESCRIPTION |
| 51 | tellstickController is used for controlling wireless recevier devices from |
| 52 | a TellStick transmitter. This version uses the tdtool software to perform |
| 53 | the actual device control. tellstickController can be used for manual |
| 54 | control of devices, or used as a daemon that is controlled by a number of |
| 55 | configuration file rules. |
| 56 | Devices and groups can be accessed by either name or id. |
| 57 | States can be set to ON, OFF or an integer between 0-255 for dimmer. |
| 58 | |
| 59 | -h, --help Show this help text. |
| 60 | -v, --verbose Show extra information. |
| 61 | -d, --daemon Starts in daemon mode. |
| 62 | -f, --file F Set configfile to file F. |
| 63 | -c, --check Check content of configuration file. |
| 64 | -t, --test Test mode, no real devices will used. |
| 65 | -a, --aliases List of aliases for devices/groups. |
| 66 | -l, --list List states for all devices/groups. |
| 67 | -s, --set D S Set device D to state S |
| 68 | -g, --get D Get state for device/group D. |
| 69 | -w, --swapfirst G Swap states for group G based on first device state. |
| 70 | -x, --swap D Swap state for device/group D. |
| 71 | |
| 72 | EXAMPLES |
| 73 | tellstickControllerTdtool -l |
| 74 | tellstickControllerTdtool --set device_alias on |
| 75 | tellstickControllerTdtool --swap device_alias |
| 76 | tellstickControllerTdtool -d -f myConfigFile.conf |
| 77 | |
| 78 | DEPENDENCIES |
| 79 | The following Perl modules needs to be installed: |
| 80 | DateTime and DateTime::Event::Sunrise |
| 81 | |
| 82 | FILES |
| 83 | tellstickController.conf |
| 84 | tellstickController.log |
| 85 | tellstickController.pid |
| 86 | |
| 87 | CONFIGURATION |
| 88 | The configuration file consists of a number of settings 'Set', a number of |
| 89 | group aliases 'Group', and a number of device rules 'Rules'. |
| 90 | |
| 91 | The settings controls sunrise/sunset, logfile, pidfile, etc. |
| 92 | |
| 93 | The groups configures a list of devices and a delay time. |
| 94 | |
| 95 | The rules can be written as a string containing two parts. |
| 96 | The first part is optional and ends with an '/'. It can contain one or more |
| 97 | of these keywords 'Weekend', 'Workweek', 'Monday', 'Tuesday', 'Wednesday', |
| 98 | 'Thursday', 'Friday', 'Saturday' and 'Sunday'. A specified date like |
| 99 | '2008-03-18', '2008-03-##', '####-03-##' or '####-##-15' is also allowed. |
| 100 | The second part is mandatory and is either a expression or the keyword 'No'. |
| 101 | The expression can contain a micture of these keywords 'Sunrise', 'Sunset', |
| 102 | 'Random(HH:MM)', 'HH:MM' and 'Dimmer(HH:MM,startlevel,stoplevel,steplevel)'. |
| 103 | A Dimmer can be controlled to change dim level from startlevel to stoplevel |
| 104 | by adding/subtracting steplevel value every HH:MM time period. |
| 105 | |
| 106 | Example rule: Weekend/07:15 |
| 107 | Example rule: Monday+Sunday/07:15 |
| 108 | Example rule: 2008-03-##/12:10 |
| 109 | Example rule: 07:15+Random(02:00) |
| 110 | Example rule: Sunset-00:30 |
| 111 | Example rule: Workweek/07:00+Dimmer(00:01,5,255,25) |
| 112 | |
| 113 | AUTHOR |
| 114 | Original version written by Rickard Andersson |
| 115 | |
| 116 | LICENSE |
| 117 | Copyright (C) 2008-2010 Rickard Andersson. Version 2.0.0 |
| 118 | This program comes with ABSOLUTELY NO WARRANTY. |
| 119 | This is free software, and you are welcome to redistribute it under certain |
| 120 | conditions; See license file for details. |
| 121 | }}} |
| 122 | === tellstickControllerTdtool configuration file === |
| 123 | {{{ |
| 124 | Set pidfile /var/run/tellstickController.pid |
| 125 | Set logfile /var/log/tellstickController.log |
| 126 | Set program /usr/bin/tdtool |
| 127 | |
| 128 | }}} |
| 129 | == tellstickControllerRfcmd == |
| 130 | {{{ |
| 131 | NAME |
| 132 | tellstickControllerRfcmd |
| 133 | |
| 134 | SYNOPSIS |
| 135 | tellstickControllerRfcmd [options] |
| 136 | |
| 137 | DESCRIPTION |
| 138 | tellstickController is used for controlling wireless recevier devices from |
| 139 | a TellStick transmitter. This version uses the rfcmd software to perform |
| 140 | the actual device control. tellstickController can be used for manual |
| 141 | control of devices, or used as a daemon that is controlled by a number of |
| 142 | configuration file rules. |
| 143 | A small database is used for keeping track of device states between every |
| 144 | execution of tellstickController. |
| 145 | |
| 146 | -h, --help Show this help text. |
| 147 | -v, --verbose Show extra information. |
| 148 | -d, --daemon Starts in daemon mode. |
| 149 | -f, --file F Set configfile to file F. |
| 150 | -c, --check Check content of configuration file. |
| 151 | -t, --test Test mode, no real devices will used. |
| 152 | -a, --aliases List of aliases for devices/groups. |
| 153 | -l, --list List states for all devices/groups. |
| 154 | -s, --set D S Set device D to state S. |
| 155 | -g, --get D Get state for device/group D. |
| 156 | -w, --swapfirst G Swap states for group G based on first device state. |
| 157 | -x, --swap D Swap state for device/group D. |
| 158 | |
| 159 | EXAMPLES |
| 160 | tellstickControllerRfcmd -l |
| 161 | tellstickControllerRfcmd --set device_alias on |
| 162 | tellstickControllerRfcmd --swap device_alias |
| 163 | tellstickControllerRfcmd -d -f myConfigFile.conf |
| 164 | |
| 165 | DEPENDENCIES |
| 166 | The following Perl modules needs to be installed: |
| 167 | DB_File, DateTime and DateTime::Event::Sunrise |
| 168 | |
| 169 | FILES |
| 170 | tellstickController.conf |
| 171 | tellstickController.db |
| 172 | tellstickController.log |
| 173 | tellstickController.pid |
| 174 | |
| 175 | CONFIGURATION |
| 176 | The configuration file consists of a number of settings 'Set', a number of |
| 177 | device aliases 'Alias', and a number of device rules 'Rules'. |
| 178 | |
| 179 | The settings controls sunrise/sunset, logfile, pidfile, etc. |
| 180 | |
| 181 | The aliases configures device name, channel, code, etc. |
| 182 | |
| 183 | The groups configures a list of devices and a delay time. |
| 184 | |
| 185 | The rules can be written as a string containing two parts. |
| 186 | The first part is optional and ends with an '/'. It can contain one or more |
| 187 | of these keywords 'Weekend', 'Workweek', 'Monday', 'Tuesday', 'Wednesday', |
| 188 | 'Thursday', 'Friday', 'Saturday' and 'Sunday'. A specified date like |
| 189 | '2008-03-18', '2008-03-##', '####-03-##' or '####-##-15' is also allowed. |
| 190 | The second part is mandatory and is either a expression or the keyword 'No'. |
| 191 | The expression can contain a micture of these keywords 'Sunrise', 'Sunset', |
| 192 | 'Random(HH:MM)' and 'HH:MM'. |
| 193 | |
| 194 | Example rule: Weekend/07:15 |
| 195 | Example rule: Monday+Sunday/07:15 |
| 196 | Example rule: 2008-03-##/12:10 |
| 197 | Example rule: 07:15+Random(02:00) |
| 198 | Example rule: Sunset-00:30 |
| 199 | |
| 200 | AUTHOR |
| 201 | Original version written by Rickard Andersson |
| 202 | |
| 203 | LICENSE |
| 204 | Copyright (C) 2008-2010 Rickard Andersson. Version 2.0.0 |
| 205 | This program comes with ABSOLUTELY NO WARRANTY. |
| 206 | This is free software, and you are welcome to redistribute it |
| 207 | under certain conditions; See license file for details. |
| 208 | }}} |
| 209 | === tellstickControllerRfcmd configuration file === |
| 210 | {{{ |
| 211 | ################################################################################ |
| 212 | # |
| 213 | # Configuration file for tellstickController |
| 214 | # |
| 215 | # Copyright (C) 2008-2010 Rickard Andersson (ran42ran@gmail.com) |
| 216 | # Version: 2.0.0 |
| 217 | # |
| 218 | ################################################################################ |
| 219 | # |
| 220 | # This program is free software: you can redistribute it and/or modify |
| 221 | # it under the terms of the GNU General Public License as published by |
| 222 | # the Free Software Foundation, either version 3 of the License, or |
| 223 | # (at your option) any later version. |
| 224 | # |
| 225 | # This program is distributed in the hope that it will be useful, |
| 226 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 227 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 228 | # GNU General Public License for more details. |
| 229 | # |
| 230 | # You should have received a copy of the GNU General Public License |
| 231 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 232 | # |
| 233 | ################################################################################ |
193 | | |
194 | | * By using the button KEY_CCTELETEXT which has a shift button on the remote control it is possible to add two-button macros for different events. For example, tellstickController can be used to control a lamp in the living room by pressing both KEY_CCTELETEXT + KEY_1 at the same time. This is what the creator's config file for KeyWatcher looks like (created via KeyConfig / GUI frontend for KeyWatcher). |
195 | | |
196 | | {{{ |
197 | | |
198 | | # This is a generated file. Edit carefully! |
199 | | # --- Variable section --- |
200 | | set filter11+388 = true |
201 | | set filter111+388 = true |
202 | | set filter10+388 = true |
203 | | set filter410 = true |
204 | | set filter405 = true |
205 | | set filter403 = true |
206 | | set filter402 = true |
207 | | set filter398 = true |
208 | | set filter393 = true |
209 | | set filter392 = true |
210 | | set filter391 = true |
211 | | set filter389 = true |
212 | | set filter385 = true |
213 | | set filter377 = true |
214 | | set filter371 = true |
215 | | set filter370 = true |
216 | | set filter368 = true |
217 | | set filter226 = true |
218 | | set filter208 = true |
219 | | set filter206 = true |
220 | | set filter168 = true |
221 | | set filter167 = true |
222 | | set filter166 = true |
223 | | set filter165 = true |
224 | | set filter164 = true |
225 | | set filter163 = true |
226 | | set filter158 = true |
227 | | set filter139 = true |
228 | | set filter130 = true |
229 | | set filter129 = true |
230 | | set filter115 = true |
231 | | set filter114 = true |
232 | | set filter113 = true |
233 | | set filter102 = true |
234 | | set filter388 = true |
235 | | set filter96+388 = true |
236 | | set filter9+388 = true |
237 | | set filter8+388 = true |
238 | | set filter7+388 = true |
239 | | set filter6+388 = true |
240 | | set filter5+388 = true |
241 | | set filter4+388 = true |
242 | | set filter3+388 = true |
243 | | set filter2+388 = true |
244 | | set label11+388 = KEY_0+KEY_CCTELETEXT |
245 | | set label10+388 = KEY_9+KEY_CCTELETEXT |
246 | | set label4+388 = KEY_3+KEY_CCTELETEXT |
247 | | set label5+388 = KEY_4+KEY_CCTELETEXT |
248 | | set label6+388 = KEY_5+KEY_CCTELETEXT |
249 | | set label111+388 = KEY_CLEAR+KEY_CCTELETEXT |
250 | | set label7+388 = KEY_6+KEY_CCTELETEXT |
251 | | set label8+388 = KEY_7+KEY_CCTELETEXT |
252 | | set label9+388 = KEY_8+KEY_CCTELETEXT |
253 | | set label96+388 = KEY_ENTER+KEY_CCTELETEXT |
254 | | set label2+388 = KEY_1+KEY_CCTELETEXT |
255 | | set label3+388 = KEY_2+KEY_CCTELETEXT |
256 | | set label410 = KEY_SHUFFLE |
257 | | set label405 = KEY_LASTCH |
258 | | set label403 = KEY_CHANNELDOWN |
259 | | set label402 = KEY_CHANNELUP |
260 | | set label398 = KEY_RED |
261 | | set label393 = KEY_VIDEO |
262 | | set label392 = KEY_SAP |
263 | | set label391 = KEY_MUSIC |
264 | | set label389 = KEY_DVD |
265 | | set label385 = KEY_RADIO |
266 | | set label377 = KEY_TV |
267 | | set label371 = KEY_ANGLE |
268 | | set label370 = KEY_REPEAT |
269 | | set label368 = KEY_LANGUAGE |
270 | | set label226 = KEY_PICTURES |
271 | | set label208 = KEY_FASTFORWARD |
272 | | set label206 = KEY_CLOSE |
273 | | set label168 = KEY_REWIND |
274 | | set label167 = KEY_RECORD |
275 | | set label166 = KEY_STOPCD |
276 | | set label165 = KEY_PREVIOUSSONG |
277 | | set label164 = KEY_PLAYPAUSE |
278 | | set label163 = KEY_NEXTSONG |
279 | | set label158 = KEY_BACK |
280 | | set label139 = KEY_DVDMENU |
281 | | set label130 = KEY_SUBTITLE |
282 | | set label129 = KEY_INFOEPG |
283 | | set label115 = KEY_VOLUMEUP |
284 | | set label114 = KEY_VOLUMEDOWN |
285 | | set label113 = KEY_MIN_INTERESTING |
286 | | set label102 = KEY_HOME |
287 | | set ConfigFile = .keyWatcher |
288 | | set action410 = "xmacroplay-keys :0.0 D" |
289 | | set action405 = "xmacroplay-keys :0.0 Y" |
290 | | set action403 = "xmacroplay-keys :0.0 Z" |
291 | | set action402 = "xmacroplay-keys :0.0 E" |
292 | | set action398 = "killall mythfrontend.real" |
293 | | set action393 = "xmacroplay-keys :0.0 F32" |
294 | | set action392 = "xmacroplay-keys :0.0 X" |
295 | | set action391 = "xmacroplay-keys :0.0 F33" |
296 | | set action389 = "xmacroplay-keys :0.0 F29" |
297 | | set action385 = "xmacroplay-keys :0.0 F30" |
298 | | set action377 = "xmacroplay-keys :0.0 F28" |
299 | | set action371 = "xmacroplay-keys :0.0 W" |
300 | | set action370 = "xmacroplay-keys :0.0 Q" |
301 | | set action368 = "xmacroplay-keys :0.0 +" |
302 | | set action226 = "xmacroplay-keys :0.0 F31" |
303 | | set action208 = "xmacroplay-keys :0.0 Next" |
304 | | set action206 = "xmacroplay-keys :0.0 F27" |
305 | | set action168 = "xmacroplay-keys :0.0 Prior" |
306 | | set action167 = "xmacroplay-keys :0.0 R" |
307 | | set action166 = "xmacroplay-keys :0.0 Escape" |
308 | | set action165 = "xmacroplay-keys :0.0 Left" |
309 | | set action164 = "xmacroplay-keys :0.0 P" |
310 | | set action163 = "xmacroplay-keys :0.0 Right" |
311 | | set action158 = "sudo eject -T" |
312 | | set action139 = "xmacroplay-keys :0.0 I" |
313 | | #set action130 = "xmacroplay-keys :0.0 C" |
314 | | set action130 = "osd_show_date" |
315 | | set action129 = "xmacroplay-keys :0.0 V" |
316 | | set action115 = "xmacroplay-keys :0.0 U" |
317 | | set action114 = "xmacroplay-keys :0.0 O" |
318 | | set action113 = "xmacroplay-keys :0.0 M" |
319 | | set action102 = "xmacroplay-keys :0.0 F26" |
320 | | set action96+388 = "sudo power_on_bedroom_mythtv" |
321 | | set action11+388 = "sudo power_off_all_lights" |
322 | | set action10+388 = "sudo tellstickController --swap bedroom_mythtv_leds" |
323 | | set action111+388 = "sudo swap_livingroom_tv_mode" |
324 | | set action9+388 = "sudo tellstickController --swap Bedroom_window" |
325 | | set action8+388 = "sudo tellstickController --swap Kitchen_cabinets" |
326 | | set action7+388 = "sudo tellstickController --swap Livingroom_uplight" |
327 | | set action6+388 = "sudo tellstickController --swap Livingroom_mythtv_leds" |
328 | | set action5+388 = "sudo tellstickController --swap Livingroom_window" |
329 | | set action4+388 = "sudo tellstickController --swap Livingroom_cabinets" |
330 | | set action3+388 = "sudo tellstickController --swap Livingroom_wall_east" |
331 | | set action2+388 = "sudo tellstickController --swap Livingroom_wall_north" |
332 | | set enableFiltering = true |
333 | | set ignoreProductName5 = "Power Button (FF)" |
334 | | set ignoreProductName4 = "Power Button (CM)" |
335 | | set ignoreProductName3 = "PC Speaker" |
336 | | set ignoreProductName2 = "Macintosh mouse button emulation" |
337 | | set ignoreProductName1 = "Logitech USB-PS/2 Optical Mouse" |
338 | | set ignoreProductName0 = "Logitech HID compliant keyboard" |
339 | | set volumeStepSize = 5 |
340 | | |
341 | | }}} |
342 | | |
343 | | As tellstickController attemps to continuously keep track of status of all receivers, these scripts function pretty well to turn lamps (etc.) on and off. |
344 | | |
345 | | Also see [http://www.telldus.se/wiki/index.php?title=TellstickControllerHTML TellstickControllerHTML] |