Hallo,
Der Thread wurde Editiert. Die ehemalige Frage hat sich erledigt.
Anbei ein funktionierendes Plugin für das Onkyo IPSC Protokol.
Was geht:
Ein auschalten beider Zonen
Source Wahl
Lautstärke up/down step
Grundlautstärke wird gesendet (aber noch nicht richtig interpretiert)
Was geht nicht wirklich:
Lautstärke per Helligkeitswert (Onkyo hat da einen sehr seltsamen Bereich festgelegt. Plugin wird upgedated)
Was noch gar nicht geht:
- Stati vom Onkyo empfangen
Was kommt noch:
- Receiver Standby Sperre wenn von Radio auf Fernsehen umgeschalten wird
Wenn mir jemand sagen kann wie ich den socket zum Abfragen der Stati offen halten kann ohne die Perl Plugins komplett zu blockieren wäre ich sehr Dankbar!!
Irgendwie kann man einen Daemon draus machen??
Gruß
Der Thread wurde Editiert. Die ehemalige Frage hat sich erledigt.
Anbei ein funktionierendes Plugin für das Onkyo IPSC Protokol.
Was geht:
Ein auschalten beider Zonen
Source Wahl
Lautstärke up/down step
Grundlautstärke wird gesendet (aber noch nicht richtig interpretiert)
Was geht nicht wirklich:
Lautstärke per Helligkeitswert (Onkyo hat da einen sehr seltsamen Bereich festgelegt. Plugin wird upgedated)
Was noch gar nicht geht:
- Stati vom Onkyo empfangen
Was kommt noch:
- Receiver Standby Sperre wenn von Radio auf Fernsehen umgeschalten wird
Code:
#### Plugin für Radio mit Hilfe des Onkyo 414 ##### #### Vorraussetzung iscp #### ## TODO: # Wenn Fernseher an nicht aus sondern umschalten # Stati abfragen # Firstboot ##### Radio on/off ### my $Radio_GA = '13/1/32'; ###################### #### Amp Status GA ###### my $onkyo = '13/1/31'; ######################### ##### sources ############ my $FM = '13/1/36'; my $Sat = '13/1/37'; my $Video = '13/1/38'; my $Game = ''; ########################## ##### receive Volume ##### my $onkyo_volume = '13/1/33'; #DPT 5.001 my $faktor = "8/100"; ########################## ##### Volume step up/down ###### my $onkyo_vol_up_down= '13/1/34'; my $vol_up_data = "01"; my $vol_down_data = "09"; ################################ ### 2nd Amp ### my $verstaerker = '13/1/2'; ######################## ###### firstboot ############ my $start_volume = "05"; ############################# ## definition für iscp, Onkyo Receiver my $Port = "60128"; my $IP = "192.168.178.68"; my $folder = "/home/onkyo-iscp/./onkyo-iscp"; # my $iscp_folder = "/home/onkyo-iscp/./onkyo-iscp 192.168.178.68"; # /home/onkyo-iscp/./onkyo-iscp 192.168.178.68 $plugin_subscribe{$Radio_GA}{$plugname}=1; $plugin_subscribe{$onkyo_volume}{$plugname}=1; $plugin_subscribe{$onkyo_vol_up_down}{$plugname}=1; $plugin_subscribe{$FM}{$plugname}=1; $plugin_subscribe{$Sat}{$plugname}=1; $plugin_subscribe{$Video}{$plugname}=1; $plugin_info{$plugname.'_cycle'} = 0; my %commandlist = ("power", "PWR", "volume_main", "MVL", "volume_down", "MVLDOWN", "volume_up", "MVLUP", "main_selector", "SLI", "zone2", "ZPW", "z2_selector", "SLZ", "z2_vol", "ZVL", ); my %sources = ( "VIDEO", "10", "SAT", "01", "GAME", "02", "FM", "24", "PC", "05", ); ##### set Source ############################## if (($msg{'dst'} eq ($FM))) { if ($msg{'apci'} eq 'A_GroupValue_Write') {my $cmd = "$commandlist{'main_selector'}$sources{'FM'}"; command_exec($cmd);}} if (($msg{'dst'} eq ($Sat))) { if ($msg{'apci'} eq 'A_GroupValue_Write') {my $cmd = "$commandlist{'main_selector'}$sources{'SAT'}"; command_exec($cmd);}} if (($msg{'dst'} eq ($Video))) { if ($msg{'apci'} eq 'A_GroupValue_Write') {my $cmd = "$commandlist{'main_selector'}$sources{'VIDEO'}"; command_exec($cmd);}} if (($msg{'dst'} eq ($Game))) { if ($msg{'apci'} eq 'A_GroupValue_Write') {my $cmd = "$commandlist{'main_selector'}$sources{'GAME'}"; command_exec($cmd);}} ################################################ ####### Volume step ################# if (($msg{'dst'} eq ($onkyo_vol_up_down))) { if ($msg{'apci'} eq 'A_GroupValue_Write') { if ($msg{'data'} eq $vol_up_data) { my $cmd = "$commandlist{'volume_main'}$commandlist{'volume_up'}"; command_exec($cmd);} if ($msg{'data'} eq $vol_down_data) { my $cmd = "$commandlist{'volume_main'}$commandlist{'volume_down'}"; command_exec($cmd);}}} ##################################### ###### set volume DPT5 (receive Volume)########## if (($msg{'dst'} eq ($onkyo_volume))) { if ($msg{'apci'} eq 'A_GroupValue_Write') { my $volume1 = decode_dpt(0,$msg{'data'},5.001); my $volume2 = ($volume1*$faktor); my $volume = sprintf("%02d", $volume1); # return $volume; my $cmd = "$commandlist{'volume_main'}$volume"; command_exec($cmd);}} ###### End Volume receive ######################## ##### Ein Ausschalten ####### if ($msg{'dst'} eq ($Radio_GA)) { if ($msg{'apci'} eq 'A_GroupValue_Write') {if ($msg{'data'} == 01 ) { knx_write($verstaerker,1,1); my $cmd = "$commandlist{'power'}01"; knx_write($onkyo,1,1); knx_write($onkyo_volume,$start_volume,5.001); my $cmd3 = "$commandlist{'zone2'}01"; knx_write($FM,1,1); command_exec($cmd, $cmd3) ; #my $shcmd = "$folder $IP $commandlist{'main_selector'} $sources{'FM'}"; #my $debug = `$shcmd`; #my $shcmd2 = "$folder $IP $commandlist{'z2_selector'} $sources{'FM'}"; #my $debug = `$shcmd2`; } if ($msg{'data'} == 00 ) { my $cmd1 = "$commandlist{'power'}00"; my $cmd2 = "$commandlist{'zone2'}00"; command_exec($cmd1, $cmd2) ; } }} sub command_exec { foreach (@_) { my $cmd = $_; plugin_log($plugname, $cmd); use strict; use IO::Socket; # my $cmd="PWR01"; #my $cmd=$ARGV[0]; my @iscpPacket; my $IP = "192.168.178.68"; my $Port = "60128"; $iscpPacket[0] = chr(0x49); $iscpPacket[1] = chr(0x53); $iscpPacket[2] = chr(0x43); $iscpPacket[3] = chr(0x50); $iscpPacket[4] = chr(0x00); $iscpPacket[5] = chr(0x00); $iscpPacket[6] = chr(0x00); $iscpPacket[7] = chr(0x10); $iscpPacket[8] = chr(0x00); $iscpPacket[9] = chr(0x00); $iscpPacket[10] = chr(0x00); $iscpPacket[11] = chr(3+length($cmd)); $iscpPacket[12] = chr(0x01); $iscpPacket[13] = chr(0x00); $iscpPacket[14] = chr(0x00); $iscpPacket[15] = chr(0x00); $iscpPacket[16] = chr(0x21); $iscpPacket[17] = chr(0x31); for(my $a=18;$a<=18+length($cmd);$a++) #18 { my $s = substr($cmd,$a-18,1); # 18 $iscpPacket[$a] = $s; } $iscpPacket[18+length($cmd)] = chr(0x0D); # 18 print #@iscpPacket; my $host = $IP; my $port = $Port; my $SOCK = new IO::Socket::INET(PeerAddr => $host, PeerPort => $port, Proto => 'tcp', timeout => 3) || die "Socket Error: $!\n"; $SOCK->autoflush(1); print $SOCK @iscpPacket; my $datagram; $SOCK->recv($datagram, 32); close ($SOCK); }}
Irgendwie kann man einen Daemon draus machen??
Gruß
Kommentar