ITach

Aus FHEMWiki
Version vom 2. August 2013, 07:58 Uhr von Ph1959de (Diskussion | Beiträge) (Kleinere Korrekturen)

iTach sind LAN / IR Gateways, mit denen über das Netzwerk Infrarotbefehle geschickt werden können.

BenWend hat im Forum den Code gepostet, wie man iTach Devices steuern kann.


Der Code

itach.pl

Die Datei itach.pl muss an der Stelle im Filesystem abgelegt werden, die später in Definitionen in der Konfigurationsdatei referiert wird (im diesem Beispiel also /opt/fhem/FHEM/).

use IO::Socket::INET;

my ($socket,$client_socket);
$socket = new IO::Socket::INET (
    PeerHost => '192.168.178.51',
    PeerPort => '4998',
    Proto => 'tcp',
) or die "ERROR in Socket Creation : $!\n";

# send itach command
$data = $ARGV[0]."\r\n";
$socket->send($data);
sleep (1);

$socket->close();

fhem.cfg

Die in der Konfiguration (fhem.cfg oder eine andere, mit include eingebundene Datei) erforderlichen Definitionen:

#---- itach ATV Schlafzimmer
define ATVSZ dummy
attr ATVSZ room itach
attr ATVSZ setList up down left right play menu select
attr ATVSZ webCmd up:down:left:right:play:menu:select

define ATVSZ_up notify ATVSZ:up.* {system("perl /opt/fhem/FHEM/itach.pl sendir,1:2,1,38000,1,1,348,171,21,22,21,64,21,64,21,64,21,22,21,64,21,64,21,64,21,64,21,64,21,64,21,22,21,22,21,22,21,22,21,64,21,64,21,64,21,22,21,64,21,22,21,22,21,22,21,22,21,22,21,64,21,22,21,64,21,22,21,64,21,22,21,64,21,1467,347,86,21,760");;}

define ATVSZ_down notify ATVSZ:down.* {system("perl /opt/fhem/FHEM/itach.pl sendir,1:2,1,39000,1,1,348,172,21,22,21,63,21,63,21,63,21,22,21,63,21,63,21,63,21,63,21,63,21,63,21,22,21,22,21,22,21,22,21,63,21,63,21,22,21,63,21,63,21,22,21,22,21,22,21,22,21,22,21,63,21,22,21,63,21,22,21,63,21,22,21,63,21,1472,347,86,21,780");;}

define ATVSZ_left notify ATVSZ:left.* {system("perl /opt/fhem/FHEM/itach.pl sendir,1:2,1,39000,1,1,341,173,21,22,21,65,21,65,21,65,21,22,21,65,21,65,21,65,21,65,21,65,21,65,21,22,21,22,21,22,21,22,21,65,21,22,21,22,21,22,21,65,21,22,21,22,21,22,21,22,21,22,21,65,21,22,21,65,21,22,21,65,21,22,21,65,21,1562,347,86,21,780");;}

define ATVSZ_right notify ATVSZ:right.* {system("perl /opt/fhem/FHEM/itach.pl sendir,1:2,1,39000,1,1,348,172,21,22,21,63,21,63,21,63,21,22,21,63,21,63,21,63,21,63,21,63,21,63,21,22,21,22,21,22,21,22,21,63,21,63,21,63,21,63,21,22,21,22,21,22,21,22,21,22,21,22,21,63,21,22,21,63,21,22,21,63,21,22,21,63,21,1472,347,87,21,780");;}

define ATVSZ_play notify ATVSZ:play.* {system("perl /opt/fhem/FHEM/itach.pl sendir,1:2,1,38000,1,1,348,171,21,22,21,64,21,64,21,64,21,22,21,64,21,64,21,64,21,64,21,64,21,64,21,22,21,22,21,22,21,22,21,64,21,22,21,64,21,64,21,64,21,64,21,22,21,64,21,22,21,22,21,64,21,22,21,64,21,22,21,64,21,22,21,64,21,760");;}

define ATVSZ_menu notify ATVSZ:menu.* {system("perl /opt/fhem/FHEM/itach.pl sendir,1:2,1,39000,1,1,348,172,21,22,21,63,21,63,21,63,21,22,21,63,21,63,21,63,21,63,21,63,21,63,21,22,21,22,21,22,21,22,21,63,21,22,21,63,21,22,21,22,21,22,21,22,21,22,21,22,21,22,21,63,21,22,21,63,21,22,21,63,21,22,21,63,21,1559,347,86,21,780");;}

define ATVSZ_select notify ATVSZ:select.* {system("perl /opt/fhem/FHEM/itach.pl sendir,1:2,1,39000,1,1,348,172,21,22,21,63,21,63,21,63,21,22,21,63,21,63,21,63,21,63,21,63,21,63,21,22,21,22,21,22,21,22,21,63,21,63,21,22,21,63,21,63,21,63,21,22,21,63,21,22,21,22,21,63,21,22,21,63,21,22,21,63,21,22,21,63,21,1391,348,172,21,22,21,63,21,63,21,63,21,22,21,63,21,63,21,63,21,63,21,63,21,63,21,22,21,22,21,22,21,22,21,63,21,22,21,22,21,63,21,22,21,22,21,22,21,22,21,22,21,22,21,63,21,22,21,63,21,22,21,63,21,22,21,63,21,780");;}

Links