wiki:tellstickController

Version 1 (modified by jsandahl, 15 years ago) ( diff )

--

tellstickController

tellstickController be used to control a number of remote receivers from the console or be run as a daemon controlling receivers according to certain rules.

tellstickController was created with the objective of:

  • enable control via aliases such as "BedroomMythtvPower" instead of "Nexa A 2".
  • having a saved permission (in a database file) for each receiver enabling turning on and off with one command.
  • running the software as a daemon and as regular commands (of course simultaneously).
  • having rules based on extendable expressions such as "monday+weekend/sunrise-00:30+random(01:00)".
  • having group management of receivers making it easier to establish rules.
  • enabling the use of more than one TellStick connected to a computer.
  • working in MythTV backend which requires the software to function in Linux.
  • enabling control of the software with a RF remote control from all rooms.

Download

A stable versio can be downloaded from the ftp server: En stabil version kan laddas ned från http://download.telldus.se/TellStick/Software/tellstickController/tellstickController_v1_5_0.tar.gz.

Moreover, the Rfcmd program is installed as it is required for communication in tellstickController.

tellstickController is written in Perl and functions with a standard installation plus these three Perl-modules:

{{

  • DB_File;
  • DateTime;
  • DateTime::Event::Sunrise;

}}

De extra Perl-modulerna kan installeras så här om du använder en Ubuntu distribution: (Använda apt-get går också bra om aptitude inte fungerar)

  • sudo aptitude install libmldbm-perl
  • sudo aptitude install libdatetime-event-sunrise-perl

[edit] Användning

Dessa argument kan man använda med tellstickController:

-h, --help Show this help text. -v, --verbose Show extra information.

-d, --daemon Starts in daemon mode.

-f, --file F Set configfile to file F. -c, --check Check content of configuration file.

-t, --test Test mode, no real devices will used.

-a, --aliases List of aliases for devices/groups. -l, --list List states for all devices/groups.

-s, --set D S Set device/group D to state S. -g, --get D Get state for device/group D.

-x, --swap D Swap state for device/group D. -w, --swapfirst G Swap states for group G based on first device state.

Exempel på hur man kan använda tellstickController på kommandoprompten:

# tellstickController --help

# tellstickController --aliases Alias testDevice1 = receiver (/dev/tellstick0 NEXA A 1) Alias testDevice2 = receiver (/dev/tellstick0 NEXA A 2) Group allDevices = delay 10 seconds, aliases (testDevice1 testDevice2)

# tellstickController --set testDevice2 on

# tellstickController --list Device testDevice1 = off Device testDevice2 = on Group allDevices = off on

# tellstickController --swap testDevice1

# tellstickController --get testDevice1 On

# tellstickController --daemon

Exempel på hur man kan sätta ihop enkla shell script:

#!/bin/sh # # Power on bedroom MythTV, turn on backlight leds and turn off window lamp. # tellstickController --set bedroom_mythtv_power on tellstickController --set bedroom_mythtv_leds on tellstickController --set bedroom_window off

[edit] Inställningar

Här är ett exempel på hur filen tellstickController.conf kan se ut.

# List of location settings. # # Usage example: # Set Key Value # Set Timezone Europe/Stockholm # Set Timezone Europe/Stockholm Set Latitude 58.24 Set Longitude 15.31 Set dbfile /var/lib/tellstickController.db Set pidfile /var/run/tellstickController.pid Set logfile /var/log/tellstickController.log

# Aliases for recevier devices. # # Usage example: # Alias Name Sender Dimmer Protocol Housecode Channel # # Alias BedroomWindow /dev/tellstick0 yes Nexa A 1 # Alias device42 /dev/tellstick1 No Waveman B 3 # # or # # Usage example: # Alias Name Sender Dimmer Protocol Channel # # Alias MythTv_Backlight /dev/ttyUSB0 No Sartano 000000001 # Alias testDevice1 /dev/tellstick0 No Nexa A 1 Alias testDevice2 /dev/tellstick0 No Nexa A 2

# Groups used for handling a list of aliases. # # Usage examples: # Group Name Delay Aliases # Group Livingroom_walls 60 Livingroom_wall_north Livingroom_wall_east # Group Kitchen 5 Kitchen_cabinets Kitchen_window # Group allDevices 10 testDevice1 testDevice2

# Timer rules for reciever devices. # # Usage examples: # Rule Alias DeviceOn DeviceOff # Rule BedroomWindow Sunrise Sunrise+01:30 # Rule BedroomWindow 18:33 23:10+Random(00:45) # Rule MythTv_Backlight Weekend/Sunset Weekend/23:45 # Rule testDevice1 weekend/sunrise weekend/08:45 Rule testDevice1 sunset+00:15 23:30+Random(00:20) Rule testDevice2 monday/20:42 wednesday/20:42 Rule allDevices 16:45 23:45

[edit] SVN

Den absolut senaste version (som oftast fungerar helt okey ;-) finns i subversion och kan checkas ut med detta kommando: svn checkout http://svn.telldus.se/telldus/trunk/tellstickcontroller [edit] Tips

Jag kör tellstickController på min MythTV backend för att styra lampor, MythTV frontend, mm.

Förutom att automatiskt styra lamporna via regler i tellstickcontroller.conf och tellstickcontrollerDaemon, så kan jag styra alla mottagare manuellt med en Logitech UltraX rf remote ifrån alla rum.

Alla knappar på fjärrkontrollen är bundna till olika händelser genom programmen KeyWatcher och XMacro.

Information om hur man kan använda alla knappar på fjärrkontrollen finns här, http://mythtv.org/wiki/index.php/Logitech_UltraX_Media_Remote

Information om KeyWatcher programmet finns här, http://criticalmass.sourceforge.net/keyWatcher.php

Information om XMacro programmet finns här, http://xmacro.sourceforge.net/

Genom att använda knappen KEY_CCTELETEXT som en shift-knapp på fjärrkontrollen, så har jag kunnat lägga in två-knapps makros för olika händelser. Tex genom att trycka på de båda knapparna KEY_CCTELETEXT + KEY_1 samtidigt, kan jag styra en en lampa i vardagsrummet mha tellstickController. Så här ser min konfig-fil för KeyWatcher ut. Den är skapad via KeyConfig (GUI frontend för KeyWatcher).

# This is a generated file. Edit carefully! # --- Variable section --- set filter11+388 = true set filter111+388 = true set filter10+388 = true set filter410 = true set filter405 = true set filter403 = true set filter402 = true set filter398 = true set filter393 = true set filter392 = true set filter391 = true set filter389 = true set filter385 = true set filter377 = true set filter371 = true set filter370 = true set filter368 = true set filter226 = true set filter208 = true set filter206 = true set filter168 = true set filter167 = true set filter166 = true set filter165 = true set filter164 = true set filter163 = true set filter158 = true set filter139 = true set filter130 = true set filter129 = true set filter115 = true set filter114 = true set filter113 = true set filter102 = true set filter388 = true set filter96+388 = true set filter9+388 = true set filter8+388 = true set filter7+388 = true set filter6+388 = true set filter5+388 = true set filter4+388 = true set filter3+388 = true set filter2+388 = true set label11+388 = KEY_0+KEY_CCTELETEXT set label10+388 = KEY_9+KEY_CCTELETEXT set label4+388 = KEY_3+KEY_CCTELETEXT set label5+388 = KEY_4+KEY_CCTELETEXT set label6+388 = KEY_5+KEY_CCTELETEXT set label111+388 = KEY_CLEAR+KEY_CCTELETEXT set label7+388 = KEY_6+KEY_CCTELETEXT set label8+388 = KEY_7+KEY_CCTELETEXT set label9+388 = KEY_8+KEY_CCTELETEXT set label96+388 = KEY_ENTER+KEY_CCTELETEXT set label2+388 = KEY_1+KEY_CCTELETEXT set label3+388 = KEY_2+KEY_CCTELETEXT set label410 = KEY_SHUFFLE set label405 = KEY_LASTCH set label403 = KEY_CHANNELDOWN set label402 = KEY_CHANNELUP set label398 = KEY_RED set label393 = KEY_VIDEO set label392 = KEY_SAP set label391 = KEY_MUSIC set label389 = KEY_DVD set label385 = KEY_RADIO set label377 = KEY_TV set label371 = KEY_ANGLE set label370 = KEY_REPEAT set label368 = KEY_LANGUAGE set label226 = KEY_PICTURES set label208 = KEY_FASTFORWARD set label206 = KEY_CLOSE set label168 = KEY_REWIND set label167 = KEY_RECORD set label166 = KEY_STOPCD set label165 = KEY_PREVIOUSSONG set label164 = KEY_PLAYPAUSE set label163 = KEY_NEXTSONG set label158 = KEY_BACK set label139 = KEY_DVDMENU set label130 = KEY_SUBTITLE set label129 = KEY_INFOEPG set label115 = KEY_VOLUMEUP set label114 = KEY_VOLUMEDOWN set label113 = KEY_MIN_INTERESTING set label102 = KEY_HOME set ConfigFile = .keyWatcher set action410 = "xmacroplay-keys :0.0 D" set action405 = "xmacroplay-keys :0.0 Y" set action403 = "xmacroplay-keys :0.0 Z" set action402 = "xmacroplay-keys :0.0 E" set action398 = "killall mythfrontend.real" set action393 = "xmacroplay-keys :0.0 F32" set action392 = "xmacroplay-keys :0.0 X" set action391 = "xmacroplay-keys :0.0 F33" set action389 = "xmacroplay-keys :0.0 F29" set action385 = "xmacroplay-keys :0.0 F30" set action377 = "xmacroplay-keys :0.0 F28" set action371 = "xmacroplay-keys :0.0 W" set action370 = "xmacroplay-keys :0.0 Q" set action368 = "xmacroplay-keys :0.0 +" set action226 = "xmacroplay-keys :0.0 F31" set action208 = "xmacroplay-keys :0.0 Next" set action206 = "xmacroplay-keys :0.0 F27" set action168 = "xmacroplay-keys :0.0 Prior" set action167 = "xmacroplay-keys :0.0 R" set action166 = "xmacroplay-keys :0.0 Escape" set action165 = "xmacroplay-keys :0.0 Left" set action164 = "xmacroplay-keys :0.0 P" set action163 = "xmacroplay-keys :0.0 Right" set action158 = "sudo eject -T" set action139 = "xmacroplay-keys :0.0 I" #set action130 = "xmacroplay-keys :0.0 C" set action130 = "osd_show_date" set action129 = "xmacroplay-keys :0.0 V" set action115 = "xmacroplay-keys :0.0 U" set action114 = "xmacroplay-keys :0.0 O" set action113 = "xmacroplay-keys :0.0 M" set action102 = "xmacroplay-keys :0.0 F26" set action96+388 = "sudo power_on_bedroom_mythtv" set action11+388 = "sudo power_off_all_lights" set action10+388 = "sudo tellstickController --swap bedroom_mythtv_leds" set action111+388 = "sudo swap_livingroom_tv_mode" set action9+388 = "sudo tellstickController --swap Bedroom_window" set action8+388 = "sudo tellstickController --swap Kitchen_cabinets" set action7+388 = "sudo tellstickController --swap Livingroom_uplight" set action6+388 = "sudo tellstickController --swap Livingroom_mythtv_leds" set action5+388 = "sudo tellstickController --swap Livingroom_window" set action4+388 = "sudo tellstickController --swap Livingroom_cabinets" set action3+388 = "sudo tellstickController --swap Livingroom_wall_east" set action2+388 = "sudo tellstickController --swap Livingroom_wall_north" set enableFiltering = true set ignoreProductName5 = "Power Button (FF)" set ignoreProductName4 = "Power Button (CM)" set ignoreProductName3 = "PC Speaker" set ignoreProductName2 = "Macintosh mouse button emulation" set ignoreProductName1 = "Logitech USB-PS/2 Optical Mouse" set ignoreProductName0 = "Logitech HID compliant keyboard" set volumeStepSize = 5

Eftersom tellstickController försöker att hela tiden hålla koll på status för alla mottagare så funkar dessa skript rätt bra för att slå av/på lampor, mm.

Se även TellstickControllerHTML

Note: See TracWiki for help on using the wiki.