Ich hab heute mal daran geforscht, wie man die FB-Tasten direkt im perl erledigen kann, ohne den umweg über das node-modul.
Wenn ich Zeit habe, baue ich das mal in das Fhem-Modul ein. Damit reagiert der SkyQ nun viel direkter.
Aber hier schon mal der Code dazu, falls das jemand auch noch irgendwoanders benutzen will. Es muss nur der peerHost angepasst werden und die variable code mit dem tastencode.
use strict;
use IO::Socket;
use POSIX qw/floor/;
my $code = 8; #sidebar
my @commandBytes = (4,1,0,0,0,0,224 + floor($code/16), $code % 16);
my $socket;
$socket = new IO::Socket::INET (PeerHost => 'skyq.fritz.box',PeerPort => '49160',Proto => 'tcp',) or die "ERROR in Socket Creation : $!\n";
my $data;
my $length = 12;
my $cb;
while(1)
{
$socket->recv($data,512);
print "$data - " . length($data) . "\n";
if ( length($data) < 24 ) { # box sends 24 x \x00 to signal end of hand-shake.
$socket->send(substr($data,0,$length));
print "Sent data: " . substr($data,0,$length);
$length = 1
}
else {
print "Handshake finished";
last;
}
}
print "\nSending Commands...\n";
print "@commandBytes\n";
$cb = join '', pack('c*',@commandBytes);
print "$cb\n";
$socket->send($cb);
@commandBytes[1] = 0;
print "@commandBytes\n";
$cb = join '', pack('c*',@commandBytes);
print "$cb\n";
$socket->send($cb);
$socket->close();
=codes
SkyRemote.commands = {
power: 0,
select: 1,
backup: 2,
dismiss: 2,
channelup: 6,
channeldown: 7,
interactive: 8,
sidebar: 8,
help: 9,
services: 10,
search: 10,
tvguide: 11,
home: 11,
i: 14,
text: 15,
up: 16,
down: 17,
left: 18,
right: 19,
red: 32,
green: 33,
yellow: 34,
blue: 35,
0: 48,
1: 49,
2: 50,
3: 51,
4: 52,
5: 53,
6: 54,
7: 55,
8: 56,
9: 57,
play: 64,
pause: 65,
stop: 66,
record: 67,
fastforward: 69,
rewind: 71,
boxoffice: 240,
sky: 241
}
=cut
Gruß
Ryker