2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

added "use SetExtensions", commandref updates, fixed RC_layout

git-svn-id: https://svn.fhem.de/fhem/trunk@6157 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
hofrichter 2014-06-23 21:23:05 +00:00
parent 02b8da56eb
commit c2a6d11f08
3 changed files with 57 additions and 15 deletions

View File

@ -1,5 +1,7 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- bugfix: 70_PIONEERAVR.pm and PIONEERAVRZONE.pm: added "use SetExtensions", commandref updates
fixed RC_layout
- feature: new modules 70_PIONEERAVR.pm and PIONEERAVRZONE.pm
- feature: FLOORPLAN has new style 7 to display commands only.
- added: 89_HEATRONIC.pm (heikoranft)

View File

@ -46,6 +46,10 @@
# supress the "on" command if networkStandby = "off"
#
# changelog
# 23.6.2014: added "use SetExtensions qw/ :all /;"
# added set extension to documentation
# 21.6.2014:version
# fixed RC_layout
# 10.6.2014:version 0007
# unified logging texts
# added "verbose 5" log messages for all reads (messages coming from the PioneerAVR)
@ -77,6 +81,7 @@ if( $^O =~ /Win/ ) {
} else {
require Device::SerialPort;
}
use SetExtensions qw/ :all /;
#########################
# Forward declaration
sub PIONEERAVR_Set($@);
@ -114,7 +119,7 @@ sub
PIONEERAVR_Initialize($) {
my ($hash) = @_;
# require "$attr{global}{modpath}/FHEM/DevIo.pm";
require "$attr{global}{modpath}/FHEM/DevIo.pm";
# Provider
$hash->{ReadFn} = "PIONEERAVR_Read";
@ -141,7 +146,7 @@ PIONEERAVR_Initialize($) {
#Die Define-Funktion eines Moduls wird von Fhem aufgerufen wenn der Define-Befehl für ein Geräte ausgeführt wird
# und das Modul bereits geladen und mit der Initialize-Funktion initialisiert ist. Sie ist typischerweise dazu da,
# die übergebenen Parameter zu prüfen und an geeigneter Stelle zu speichern sowie
# einen Kommunikationsweg zum Pioneer Receiver zu öffnen (z.B. TCP-Verbindung, RS232-Schnittstelle)
# einen Kommunikationsweg zum Pioneer AV Receiver zu öffnen (TCP-Verbindung bzw. RS232-Schnittstelle)
#Als Übergabeparameter bekommt die Define-Funktion den Hash der Geräteinstanz sowie den Rest der Parameter, die im Befehl angegeben wurden.
#
# Damit die übergebenen Werte auch anderen Funktionen zur Verfügung stehen und an die jeweilige Geräteinstanz gebunden sind,
@ -735,7 +740,8 @@ sub
PIONEERAVR_Ready($)
{
my ($hash) = @_;
my $name = $hash->{NAME};
Log3 $name, 5, "PIONEERAVR $name: PIONEER_Ready() called";
return DevIo_OpenDev($hash, 1, "PIONEERAVR_DoInit")
if($hash->{STATE} eq "disconnected");
@ -754,7 +760,7 @@ PIONEERAVR_DoInit($)
{
my $hash = shift;
my $name = $hash->{NAME};
my $msg = undef;
Log3 $name, 5, "PIONEERAVR $name: PIONEER_DoInit() called";
PIONEERAVR_Clear($hash);
@ -768,6 +774,8 @@ sub
PIONEERAVR_Clear($)
{
my $hash = shift;
my $name = $hash->{NAME};
Log3 $name, 5, "PIONEERAVR $name: PIONEERAVR_Clear() called";
# Clear the pipe
DevIo_TimeoutRead($hash, 0.1);
@ -1439,7 +1447,7 @@ RC_layout_PioneerAVR() {
$row[0]="toggle:POWEROFF";
$row[1]="volumeUp:UP,mute toggle:MUTE,inputUp:CHUP";
$row[2]=":VOL,:blank,:PROG";
$row[3]="channelDown:DOWN,:blank,channelDown:CHDOWN";
$row[3]="volumeDown:DOWN,:blank,inputDown:CHDOWN";
$row[4]="attr rc_iconpath icons/remotecontrol";
$row[5]="attr rc_iconprefix black_btn_";
@ -1527,6 +1535,7 @@ RC_layout_PioneerAVR() {
<li>stop<br>stops playback for the same inputs as play</li>
<li>repeat<br>repeat for the following inputs: AdapterPort, Ipod, Favorites, InternetRadio, MediaServer</li>
<li>shuffle<br>random play for the same inputs as repeat</li>
<li><a href="#setExtensions">set extensions</a> are supported (except <blink>)</li>
<br><br>
Example:
<ul>
@ -1646,6 +1655,7 @@ RC_layout_PioneerAVR() {
<li>stop<br>Stoppt die Wiedergabe für die gleichen Eingangsquellen wie "play"</li>
<li>repeat<br>Wiederholung für folgende Eingangsquellen: AdapterPort, Ipod, Favorites, InternetRadio, MediaServer</li>
<li>shuffle<br>Zufällige Wiedergabe für die gleichen Eingangsquellen wie "repeat"</li>
<li><a href="#setExtensions">set extensions</a> (ausser <blink>) werden unterstützt</li>
<br><br>
Beispiel:
<ul>

View File

@ -26,6 +26,7 @@ package main;
use strict;
use warnings;
use Time::HiRes qw(gettimeofday);
use SetExtensions qw/ :all /;
sub PIONEERAVRZONE_Get($@);
sub PIONEERAVRZONE_Set($@);
@ -293,6 +294,7 @@ PIONEERAVRZONE_Parse($$)
# ZVXX
# XX 00 ... 81 -> -81dB ... 0dB
if ( $msg =~ m/^ZV(\d\d)$/ ) {
Log3 $name, 5, "PIONEERAVRZONE $name: ". dq($msg) ." interpreted as: Zone2 - New volume = " . $1 . " (raw volume data).";
readingsBulkUpdate($hash, "volumeStraight", $1 - 81 );
readingsBulkUpdate($hash, "volume", sprintf "%d", $1/0.8 );
push @matches, $d;
@ -302,21 +304,28 @@ PIONEERAVRZONE_Parse($$)
} elsif ( $msg =~ m/^Z2MUT(\d)$/) {
if ($1) {
readingsBulkUpdate($hash, "mute", "off" );
Log3 $name, 5, "PIONEERAVRZONE $name: ". dq($msg) ." interpreted as: Zone2 - Mute off.";
}
else {
readingsBulkUpdate($hash, "mute", "on" );
Log3 $name, 5, "PIONEERAVRZONE $name: ". dq($msg) ." interpreted as: Zone2 - Mute on.";
}
push @matches, $d;
# Input zone2
# Z2FXX
# XX -> input number 00 ... 49
} elsif ($msg =~ m/^Z2F(\d\d)$/ ) {
if ( defined ( $IOhash->{helper}{INPUTNAMES}->{$1}{aliasName}) ) {
readingsBulkUpdate($hash, "input", $IOhash->{helper}{INPUTNAMES}->{$1}{aliasName} );
} elsif ( defined ( $IOhash->{helper}{INPUTNAMES}->{$1}{name}) ) {
readingsBulkUpdate($hash, "input", $IOhash->{helper}{INPUTNAMES}->{$1}{name} );
my $inputNr = $1;
Log3 $hash,5,"PIONEERAVRZONE $name: ".dq($msg) ." interpreted as: Zone2 - Input is set to inputNr: $inputNr ";
if ( defined ( $IOhash->{helper}{INPUTNAMES}->{$inputNr}{aliasName}) ) {
Log3 $hash,5,"PIONEERAVRZONE $name: Zone2 - Input aliasName for input $inputNr is " . $hash->{helper}{INPUTNAMES}{$inputNr}{aliasName};
readingsBulkUpdate($hash, "input", $IOhash->{helper}{INPUTNAMES}->{$inputNr}{aliasName} );
} elsif ( defined ( $IOhash->{helper}{INPUTNAMES}->{$inputNr}{name}) ) {
Log3 $hash,5,"PIONEERAVRZONE $name: Zone2 - Input Name for input $inputNr is " . $hash->{helper}{INPUTNAMES}{$inputNr}{name};
readingsBulkUpdate($hash, "input", $IOhash->{helper}{INPUTNAMES}->{$inputNr}{name} );
} else {
readingsBulkUpdate($hash, "input", $msg );
Log3 $hash,5,"PIONEERAVRZONE $name: Zone2 - InputName: can't find Name for input $inputNr";
}
push @matches, $d;
# Power zone2
@ -326,9 +335,11 @@ PIONEERAVRZONE_Parse($$)
if ($1 == "0") {
readingsBulkUpdate($hash, "power", "on" );
$state = "on";
} elsif ($1 == "1") {
Log3 $hash,5,"PIONEERAVRZONE $name: ".dq($msg) ." interpreted as: Zone2 - Power: on";
} elsif ($1 == "1") {
readingsBulkUpdate($hash, "power", "off" );
$state = "off";
Log3 $hash,5,"PIONEERAVRZONE $name: ".dq($msg) ." interpreted as: Zone2 - Power: off";
}
# Set reading for state
#
@ -345,6 +356,7 @@ PIONEERAVRZONE_Parse($$)
# YVXX
# XX 00 ... 81 -> -81dB ... 0dB
if ( $msg =~ m/^YV(\d\d)$/ ) {
Log3 $name, 5, "PIONEERAVRZONE $name: ". dq($msg) ." interpreted as: Zone3 - New volume = " . $1 . " (raw volume data).";
readingsBulkUpdate($hash, "volumeStraight", $1 - 81 );
readingsBulkUpdate($hash, "volume", sprintf "%d", $1/0.8 );
push @matches, $d;
@ -354,20 +366,27 @@ PIONEERAVRZONE_Parse($$)
} elsif ( $msg =~ m/^Z3MUT(\d)$/) {
if ($1) {
readingsBulkUpdate($hash, "mute", "off" );
Log3 $name, 5, "PIONEERAVRZONE $name: ". dq($msg) ." interpreted as: Zone3 - Mute off.";
}
else {
readingsBulkUpdate($hash, "mute", "on" );
Log3 $name, 5, "PIONEERAVRZONE $name: ". dq($msg) ." interpreted as: Zone3 - Mute on.";
}
push @matches, $d;
# Input zone3
# Z3FXX
# XX -> input number 00 ... 49
} elsif ($msg =~ m/^Z3F(\d\d)$/ ) {
if ( defined ( $IOhash->{helper}{INPUTNAMES}->{$1}{aliasName}) ) {
readingsBulkUpdate($hash, "input", $IOhash->{helper}{INPUTNAMES}->{$1}{aliasName} );
} elsif ( defined ( $IOhash->{helper}{INPUTNAMES}->{$1}{name}) ) {
readingsBulkUpdate($hash, "input", $IOhash->{helper}{INPUTNAMES}->{$1}{name} );
my $inputNr = $1;
Log3 $hash,5,"PIONEERAVRZONE $name: ".dq($msg) ." interpreted as: Zone3 - Input is set to inputNr: $inputNr ";
if ( defined ( $IOhash->{helper}{INPUTNAMES}->{$inputNr}{aliasName}) ) {
readingsBulkUpdate($hash, "input", $IOhash->{helper}{INPUTNAMES}->{$inputNr}{aliasName} );
Log3 $hash,5,"PIONEERAVRZONE $name: Zone3 - Input aliasName for input $inputNr is " . $hash->{helper}{INPUTNAMES}{$inputNr}{aliasName};
} elsif ( defined ( $IOhash->{helper}{INPUTNAMES}->{$inputNr}{name}) ) {
Log3 $hash,5,"PIONEERAVRZONE $name: Zone3 - Input Name for input $inputNr is " . $hash->{helper}{INPUTNAMES}{$inputNr}{name};
readingsBulkUpdate($hash, "input", $IOhash->{helper}{INPUTNAMES}->{$inputNr}{name} );
} else {
Log3 $hash,5,"PIONEERAVRZONE $name: Zone3 - InputName: can't find Name for input $inputNr";
readingsBulkUpdate($hash, "input", $msg );
}
push @matches, $d;
@ -376,9 +395,11 @@ PIONEERAVRZONE_Parse($$)
# X = 0: Power on; X = 1: Power off
} elsif ( $msg =~ m/^BPR(0|1)$/ ) {
if ($1 == "0") {
Log3 $hash,5,"PIONEERAVRZONE $name: ".dq($msg) ." interpreted as: Zone3 - Power: on";
readingsBulkUpdate($hash, "power", "on" );
$state = "on";
} elsif ($1 == "1") {
Log3 $hash,5,"PIONEERAVRZONE $name: ".dq($msg) ." interpreted as: Zone3 - Power: off";
readingsBulkUpdate($hash, "power", "off" );
$state = "off";
}
@ -397,11 +418,16 @@ PIONEERAVRZONE_Parse($$)
# ZEAXX
# XX -> input number 00 ... 49
if ($msg =~ m/^ZEA(\d\d)$/ ) {
my $inputNr = $1;
Log3 $hash,5,"PIONEERAVRZONE $name: ".dq($msg) ." interpreted as: hdZone - Input is set to inputNr: $inputNr ";
if ( defined ( $IOhash->{helper}{INPUTNAMES}->{$1}{aliasName}) ) {
Log3 $hash,5,"PIONEERAVRZONE $name: hdZone - Input aliasName for input $inputNr is " . $hash->{helper}{INPUTNAMES}{$inputNr}{aliasName};
readingsBulkUpdate($hash, "input", $IOhash->{helper}{INPUTNAMES}->{$1}{aliasName} );
} elsif ( defined ( $IOhash->{helper}{INPUTNAMES}->{$1}{name}) ) {
Log3 $hash,5,"PIONEERAVRZONE $name: hdZone - Input Name for input $inputNr is " . $hash->{helper}{INPUTNAMES}{$inputNr}{name};
readingsBulkUpdate($hash, "input", $IOhash->{helper}{INPUTNAMES}->{$1}{name} );
} else {
Log3 $hash,5,"PIONEERAVRZONE $name: Zone3 - InputName: can't find Name for input $inputNr";
readingsBulkUpdate($hash, "input", $msg );
}
push @matches, $d;
@ -410,9 +436,11 @@ PIONEERAVRZONE_Parse($$)
# X = 0: Power on; X = 1: Power off
} elsif ( $msg =~ m/^ZEP(0|1)$/ ) {
if ($1 == "0") {
Log3 $hash,5,"PIONEERAVRZONE $name: ".dq($msg) ." interpreted as: hdZone - Power: on";
readingsBulkUpdate($hash, "power", "on" );
$state = "on";
} elsif ($1 == "1") {
Log3 $hash,5,"PIONEERAVRZONE $name: ".dq($msg) ." interpreted as: hdZone - Power: off";
readingsBulkUpdate($hash, "power", "off" );
$state = "off";
}
@ -549,7 +577,7 @@ PIONEERAVRZONE_Define($$)
inputs is read in during Fhem start and with <code>get <name> statusRequest</code></li>
<li>inputUp<br>change zone input to next input</li>
<li>inputDown<br>change zone input to previous input</li>
<li><a href="#setExtensions">set extensions</a> are supported (except <blink>)</li>
<br><br>
Example:
<ul>
@ -624,6 +652,8 @@ PIONEERAVRZONE_Define($$)
Eingangsquellen wird beim Start von Fhem und auch mit <code>get <name> statusRequest</code> eingelesen</li>
<li>inputUp<br>nächste Eingangsquelle für die Zone auswählen</li>
<li>inputDown<br>vorherige Eingangsquelle für die Zone auswählen</li>
<li><a href="#setExtensions">set extensions</a> (ausser <blink>) werden unterstützt</li>
<br><br>
Beispiel: