YAMAHA_AVR: new readings for extended informations on several inputs, add model attribute for statistical purpose
git-svn-id: https://svn.fhem.de/fhem/trunk@4620 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# 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.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
- SVN
|
- SVN
|
||||||
|
- feature: YAMAHA_AVR: new readings for radio stations, current title
|
||||||
|
and more. see commandref for more details.
|
||||||
- feature: new module 32_withings.pm added (justme1968)
|
- feature: new module 32_withings.pm added (justme1968)
|
||||||
- bugfix: PRESENCE: fixing user detection on FritzBox!
|
- bugfix: PRESENCE: fixing user detection on FritzBox!
|
||||||
- feature: new module 38_CO20.pm added (justme1968)
|
- feature: new module 38_CO20.pm added (justme1968)
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ YAMAHA_AVR_Initialize($)
|
|||||||
$hash->{DefFn} = "YAMAHA_AVR_Define";
|
$hash->{DefFn} = "YAMAHA_AVR_Define";
|
||||||
$hash->{UndefFn} = "YAMAHA_AVR_Undefine";
|
$hash->{UndefFn} = "YAMAHA_AVR_Undefine";
|
||||||
|
|
||||||
$hash->{AttrList} = "do_not_notify:0,1 request-timeout:1,2,3,4,5 volumeSteps:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 volume-smooth-change:0,1 volume-smooth-steps:1,2,3,4,5,6,7,8,9,10 ".
|
$hash->{AttrList} = "do_not_notify:0,1 request-timeout:1,2,3,4,5 volumeSteps:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 model volume-smooth-change:0,1 volume-smooth-steps:1,2,3,4,5,6,7,8,9,10 ".
|
||||||
$readingFnAttributes;
|
$readingFnAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,6 +154,48 @@ YAMAHA_AVR_GetStatus($;$)
|
|||||||
if($return =~ /<Input_Sel>(.+)<\/Input_Sel>/)
|
if($return =~ /<Input_Sel>(.+)<\/Input_Sel>/)
|
||||||
{
|
{
|
||||||
readingsBulkUpdate($hash, "input", YAMAHA_AVR_InputParam2Fhem(lc($1), 0));
|
readingsBulkUpdate($hash, "input", YAMAHA_AVR_InputParam2Fhem(lc($1), 0));
|
||||||
|
|
||||||
|
if($return =~ /<Src_Name>(.+?)<\/Src_Name>/)
|
||||||
|
{
|
||||||
|
Log3 $name, 4, "YAMAHA_AVR $name: check for extended informations";
|
||||||
|
|
||||||
|
my $infos = YAMAHA_AVR_SendCommand($hash, "<YAMAHA_AV cmd=\"GET\"><$1><Play_Info>GetParam</Play_Info></$1></YAMAHA_AV>");
|
||||||
|
|
||||||
|
if($infos =~ /<Meta_Info>.*?<Artist>(.+?)<\/Artist>.*?<\/Meta_Info>/)
|
||||||
|
{
|
||||||
|
readingsBulkUpdate($hash, "currentArtist", $1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($infos =~ /<Meta_Info>.*?<Station>(.+?)<\/Station>.*?<\/Meta_Info>/)
|
||||||
|
{
|
||||||
|
readingsBulkUpdate($hash, "currentStation", $1);
|
||||||
|
}
|
||||||
|
elsif($infos =~ /<Meta_Info>.*?<Program_Service>(.+?)<\/Program_Service>.*?<\/Meta_Info>/)
|
||||||
|
{
|
||||||
|
readingsBulkUpdate($hash, "currentStation", $1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($infos =~ /<Meta_Info>.*?<Channel>(.+?)<\/Channel>.*?<\/Meta_Info>/)
|
||||||
|
{
|
||||||
|
readingsBulkUpdate($hash, "currentChannel", $1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($infos =~ /<Meta_Info>.*?<Album>(.+?)<\/Album>.*?<\/Meta_Info>/)
|
||||||
|
{
|
||||||
|
readingsBulkUpdate($hash, "currentAlbum", $1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($infos =~ /<Meta_Info>.*?<Song>(.+?)<\/Song>.*?<\/Meta_Info>/)
|
||||||
|
{
|
||||||
|
readingsBulkUpdate($hash, "currentTitle", $1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($infos =~ /<Playback_Info>(.+?)<\/Playback_Info>/)
|
||||||
|
{
|
||||||
|
readingsBulkUpdate($hash, "playStatus", lc($1));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# input name as it is displayed on the receivers front display
|
# input name as it is displayed on the receivers front display
|
||||||
@@ -177,12 +219,13 @@ YAMAHA_AVR_Get($@)
|
|||||||
{
|
{
|
||||||
my ($hash, @a) = @_;
|
my ($hash, @a) = @_;
|
||||||
my $what;
|
my $what;
|
||||||
|
my $return;
|
||||||
|
|
||||||
return "argument is missing" if(int(@a) != 2);
|
return "argument is missing" if(int(@a) != 2);
|
||||||
|
|
||||||
$what = $a[1];
|
$what = $a[1];
|
||||||
|
|
||||||
if($what =~ /^(power|input|inputName|output|volume|volumeStraight|mute)$/)
|
if(exists($hash->{READINGS}{$what}))
|
||||||
{
|
{
|
||||||
YAMAHA_AVR_GetStatus($hash, 1);
|
YAMAHA_AVR_GetStatus($hash, 1);
|
||||||
|
|
||||||
@@ -197,8 +240,15 @@ YAMAHA_AVR_Get($@)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return "Unknown argument $what, choose one of power:noArg input:noArg inputName:noArg volume:noArg mute:noArg".(exists($hash->{READINGS}{output})?" output:noArg":"");
|
$return = "unknown argument $what, choose one of";
|
||||||
}
|
|
||||||
|
foreach my $reading (keys $hash->{READINGS})
|
||||||
|
{
|
||||||
|
$return .= " $reading:noArg";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -629,8 +679,6 @@ YAMAHA_AVR_SendCommand($$;$)
|
|||||||
my $address = $hash->{helper}{ADDRESS};
|
my $address = $hash->{helper}{ADDRESS};
|
||||||
my $response;
|
my $response;
|
||||||
|
|
||||||
$loglevel = 3;
|
|
||||||
|
|
||||||
Log3 $name, 5, "YAMAHA_AVR: execute on $name: $command";
|
Log3 $name, 5, "YAMAHA_AVR: execute on $name: $command";
|
||||||
|
|
||||||
# In case any URL changes must be made, this part is separated in this function".
|
# In case any URL changes must be made, this part is separated in this function".
|
||||||
@@ -799,23 +847,25 @@ sub YAMAHA_AVR_getModel($)
|
|||||||
|
|
||||||
Log3 $name, 3, "YAMAHA_AVR: could not get system configuration from device $name. Please turn on the device or check for correct hostaddress!" if (not defined($response) and defined($hash->{helper}{AVAILABLE}) and $hash->{helper}{AVAILABLE} eq 1);
|
Log3 $name, 3, "YAMAHA_AVR: could not get system configuration from device $name. Please turn on the device or check for correct hostaddress!" if (not defined($response) and defined($hash->{helper}{AVAILABLE}) and $hash->{helper}{AVAILABLE} eq 1);
|
||||||
|
|
||||||
if(defined($response) and $response =~ /<Model_Name>(.+?)<\/Model_Name>.*<System_ID>(.+?)<\/System_ID>.*<Version>(.+?)<\/Version>/)
|
if(defined($response) and $response =~ /<Model_Name>(.+?)<\/Model_Name>.*<System_ID>(.+?)<\/System_ID>.*<Version>.*<Main>(.+?)<\/Main>.*<Sub>(.+?)<\/Sub>.*<\/Version>/)
|
||||||
{
|
|
||||||
$hash->{MODEL} = $1;
|
|
||||||
$hash->{SYSTEM_ID} = $2;
|
|
||||||
$hash->{FIRMWARE} = $3;
|
|
||||||
}
|
|
||||||
elsif(defined($response) and $response =~ /<Model_Name>(.+?)<\/Model_Name>.*<System_ID>(.+?)<\/System_ID>.*<Version>.*<Main>(.+?)<\/Main>.*<Sub>(.+?)<\/Sub>.*<\/Version>/)
|
|
||||||
{
|
{
|
||||||
$hash->{MODEL} = $1;
|
$hash->{MODEL} = $1;
|
||||||
$hash->{SYSTEM_ID} = $2;
|
$hash->{SYSTEM_ID} = $2;
|
||||||
$hash->{FIRMWARE} = $3." ".$4;
|
$hash->{FIRMWARE} = $3." ".$4;
|
||||||
}
|
}
|
||||||
|
elsif(defined($response) and $response =~ /<Model_Name>(.+?)<\/Model_Name>.*<System_ID>(.+?)<\/System_ID>.*<Version>(.+?)<\/Version>/)
|
||||||
|
{
|
||||||
|
$hash->{MODEL} = $1;
|
||||||
|
$hash->{SYSTEM_ID} = $2;
|
||||||
|
$hash->{FIRMWARE} = $3;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$attr{$name}{"model"} = $hash->{MODEL};
|
||||||
|
|
||||||
# query the description url which contains all zones
|
# query the description url which contains all zones
|
||||||
$response = GetFileFromURL("http://".$address.$desc_url, AttrVal($name, "request-timeout", 4), undef, 0, ($hash->{helper}{AVAILABLE} ? undef : 5));
|
$response = GetFileFromURL("http://".$address.$desc_url, AttrVal($name, "request-timeout", 4), undef, 0, ($hash->{helper}{AVAILABLE} ? undef : 5));
|
||||||
|
|
||||||
@@ -1020,6 +1070,7 @@ sub YAMAHA_AVR_getInputs($)
|
|||||||
<li><b>mute</b> on|off|toggle - activates volume mute</li>
|
<li><b>mute</b> on|off|toggle - activates volume mute</li>
|
||||||
<li><b>statusRequest</b> - requests the current status of the device</li>
|
<li><b>statusRequest</b> - requests the current status of the device</li>
|
||||||
<li><b>remoteControl</b> up,down,... - sends remote control commands as listed below</li>
|
<li><b>remoteControl</b> up,down,... - sends remote control commands as listed below</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</ul><br><br>
|
</ul><br><br>
|
||||||
<u>Remote control (not in all zones available, depending on your model)</u><br><br>
|
<u>Remote control (not in all zones available, depending on your model)</u><br><br>
|
||||||
@@ -1085,17 +1136,10 @@ sub YAMAHA_AVR_getInputs($)
|
|||||||
<a name="YAMAHA_AVRget"></a>
|
<a name="YAMAHA_AVRget"></a>
|
||||||
<b>Get</b>
|
<b>Get</b>
|
||||||
<ul>
|
<ul>
|
||||||
<code>get <name> <what></code>
|
<code>get <name> <reading></code>
|
||||||
<br><br>
|
<br><br>
|
||||||
Currently, the following commands are defined and return the current state of the receiver.<br><br>
|
Currently, the get command only returns the reading values. For a specific list of possible values, see section "Generated Readings/Events".
|
||||||
<ul><code>power<br>
|
<br><br>
|
||||||
input<br>
|
|
||||||
inputName<br>
|
|
||||||
mute<br>
|
|
||||||
volume<br>
|
|
||||||
volumeStraight<br>
|
|
||||||
presence<br>
|
|
||||||
output # only available in zones other than mainzone</code></ul><br><br>
|
|
||||||
</ul>
|
</ul>
|
||||||
<a name="YAMAHA_AVRattr"></a>
|
<a name="YAMAHA_AVRattr"></a>
|
||||||
<b>Attributes</b>
|
<b>Attributes</b>
|
||||||
@@ -1116,8 +1160,8 @@ output # only available in zones other than mainzone</code></ul><br><br>
|
|||||||
current and the desired volume. Default value is 5 steps<br><br>
|
current and the desired volume. Default value is 5 steps<br><br>
|
||||||
<li><a name="volume-smooth-steps">volumeSteps</a></li>
|
<li><a name="volume-smooth-steps">volumeSteps</a></li>
|
||||||
Optional attribute to define the default increasing and decreasing level for the volumeUp and volumeDown set command. Default value is 5%<br>
|
Optional attribute to define the default increasing and decreasing level for the volumeUp and volumeDown set command. Default value is 5%<br>
|
||||||
</ul>
|
|
||||||
<br>
|
<br>
|
||||||
|
</ul>
|
||||||
<b>Generated Readings/Events:</b><br>
|
<b>Generated Readings/Events:</b><br>
|
||||||
<ul>
|
<ul>
|
||||||
<li><b>input</b> - The selected input source according to the FHEM input commands</li>
|
<li><b>input</b> - The selected input source according to the FHEM input commands</li>
|
||||||
@@ -1128,6 +1172,13 @@ output # only available in zones other than mainzone</code></ul><br><br>
|
|||||||
<li><b>volume</b> - Reports the current volume level of the receiver or zone in percentage values (between 0 and 100 %)</li>
|
<li><b>volume</b> - Reports the current volume level of the receiver or zone in percentage values (between 0 and 100 %)</li>
|
||||||
<li><b>volumeStraight</b> - Reports the current volume level of the receiver or zone in decibel values (between -80.5 and +15.5 dB)</li>
|
<li><b>volumeStraight</b> - Reports the current volume level of the receiver or zone in decibel values (between -80.5 and +15.5 dB)</li>
|
||||||
<li><b>state</b> - Reports the current power state and an absence of the device (can be "on", "off" or "absent")</li>
|
<li><b>state</b> - Reports the current power state and an absence of the device (can be "on", "off" or "absent")</li>
|
||||||
|
<br><br><u>Input dependent Readings/Events:</u><br>
|
||||||
|
<li><b>currentChannel</b> - Number of the input channel (SIRIUS only)</li>
|
||||||
|
<li><b>currentStation</b> - Station name of the current radio station (available on NET RADIO, PANDORA</li>
|
||||||
|
<li><b>currentAlbum</b> - Album name of the current song</li>
|
||||||
|
<li><b>currentArtist</b> - Artist name of the current song</li>
|
||||||
|
<li><b>currentTitle</b> - Title of the current song</li>
|
||||||
|
<li><b>playStatus</b> - indicates if the input plays music or not</li>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
<b>Implementator's note</b><br>
|
<b>Implementator's note</b><br>
|
||||||
@@ -1279,20 +1330,11 @@ output # only available in zones other than mainzone</code></ul><br><br>
|
|||||||
<a name="YAMAHA_AVRget"></a>
|
<a name="YAMAHA_AVRget"></a>
|
||||||
<b>Get-Kommandos</b>
|
<b>Get-Kommandos</b>
|
||||||
<ul>
|
<ul>
|
||||||
<code>get <Name> <Parameter></code>
|
<code>get <Name> <Readingname></code>
|
||||||
<br><br>
|
<br><br>
|
||||||
Aktuell stehen folgende Parameter zur Verfügung welche den aktuellen Status des Receivers zurück geben.<br><br>
|
Aktuell stehen via GET lediglich die Werte der Readings zur Verfügung. Eine genaue Auflistung aller möglichen Readings folgen unter "Generierte Readings/Events".
|
||||||
<ul>
|
|
||||||
<li><code>power</code> - Betriebszustand des Receiveres/Zone (on oder off)</li>
|
|
||||||
<li><code>presence</code> - Empfangsbereitschaft des Receivers (absent oder present)</li>
|
|
||||||
<li><code>input</code> - Gewählter Eingang</li>
|
|
||||||
<li><code>inputName</code> - Bezeichnung des gewählten Einganges wie im Display des Receivers</li>
|
|
||||||
<li><code>mute</code> - Lautlos an oder aus (on oder off)</li>
|
|
||||||
<li><code>volume</code> - Lautstärkepegel in %</li>
|
|
||||||
<li><code>volumeStraight</code> - Lautstärkepegel in dB</li>
|
|
||||||
</ul>
|
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br><br>
|
||||||
<a name="YAMAHA_AVRattr"></a>
|
<a name="YAMAHA_AVRattr"></a>
|
||||||
<b>Attribute</b>
|
<b>Attribute</b>
|
||||||
<ul>
|
<ul>
|
||||||
@@ -1324,6 +1366,13 @@ output # only available in zones other than mainzone</code></ul><br><br>
|
|||||||
<li><b>volume</b> - Der aktuelle Lautstärkepegel in Prozent (zwischen 0 und 100 %)</li>
|
<li><b>volume</b> - Der aktuelle Lautstärkepegel in Prozent (zwischen 0 und 100 %)</li>
|
||||||
<li><b>volumeStraight</b> - Der aktuelle Lautstärkepegel in Dezibel (zwischen -80.0 und +15 dB)</li>
|
<li><b>volumeStraight</b> - Der aktuelle Lautstärkepegel in Dezibel (zwischen -80.0 und +15 dB)</li>
|
||||||
<li><b>state</b> - Der aktuelle Schaltzustand (power-Reading) oder die Abwesenheit des Gerätes (mögliche Werte: "on", "off" oder "absent")</li>
|
<li><b>state</b> - Der aktuelle Schaltzustand (power-Reading) oder die Abwesenheit des Gerätes (mögliche Werte: "on", "off" oder "absent")</li>
|
||||||
|
<br><br><u>Eingangsabhängige Readings/Events:</u><br>
|
||||||
|
<li><b>currentChannel</b> - Nummer des Eingangskanals (nur bei SIRIUS)</li>
|
||||||
|
<li><b>currentStation</b> - Name des Radiosenders (nur bei TUNER, NET RADIO und PANDORA)</li>
|
||||||
|
<li><b>currentAlbum</b> - Album es aktuell gespielten Titel</li>
|
||||||
|
<li><b>currentArtist</b> - Interpret des aktuell gespielten Titel</li>
|
||||||
|
<li><b>cutrentTitle</b> - Name des aktuell gespielten Titel</li>
|
||||||
|
<li><b>playStatus</b> - Wiedergabestatus des Eingangs</li>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
<b>Hinweise des Autors</b>
|
<b>Hinweise des Autors</b>
|
||||||
|
|||||||
Reference in New Issue
Block a user