From ae1567ef5c6ff811004c258f4608a4a50699def1 Mon Sep 17 00:00:00 2001
From: markusbloch <>
Date: Tue, 20 Jun 2017 19:02:27 +0000
Subject: [PATCH] YAMAHA_AVR: new set commands / readings for controlling HDMI
outputs (Forum: #41924) / fixing currentTitle reading for newer model series
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@14547 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
CHANGED | 2 +
FHEM/71_YAMAHA_AVR.pm | 133 +++++++++++++++++++++++++++++++++---------
2 files changed, 108 insertions(+), 27 deletions(-)
diff --git a/CHANGED b/CHANGED
index 4425a2970..f1e173859 100644
--- a/CHANGED
+++ b/CHANGED
@@ -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.
+ - feature: YAMAHA_AVR: new set commands / readings to control HDMI outputs
+ (only for models with two HDMI outputs)
- featere: exclude_from_update can check the source too (Forum #73275)
- change: 93_DbRep: V5.2.0, preparation for UTF-8 support by DbLog
- bugfix: 36_Vallox: Changed read. Added attributes. Changed DeviceID.
diff --git a/FHEM/71_YAMAHA_AVR.pm b/FHEM/71_YAMAHA_AVR.pm
index 5607ab30b..26f74818d 100755
--- a/FHEM/71_YAMAHA_AVR.pm
+++ b/FHEM/71_YAMAHA_AVR.pm
@@ -241,6 +241,12 @@ YAMAHA_AVR_GetStatus($;$)
}
}
+ # check hdmi output state, if supported
+ if($hash->{ACTIVE_ZONE} eq "mainzone" and $hash->{helper}{SUPPORT_HDMI_OUT})
+ {
+ YAMAHA_AVR_SendCommand($hash, "", "statusRequest", "hdmiOut1", {options => {can_fail => 1}});
+ YAMAHA_AVR_SendCommand($hash, "", "statusRequest", "hdmiOut2", {options => {can_fail => 1}});
+ }
YAMAHA_AVR_ResetTimer($hash) unless($local == 1);
@@ -324,7 +330,8 @@ YAMAHA_AVR_Set($@)
(exists($hash->{helper}{SURROUND_DECODERS}) ? "surroundDecoder:".$decoders_comma." " : "").
($hash->{helper}{SUPPORT_DISPLAY_BRIGHTNESS} ? "displayBrightness:slider,-4,1,0 " : "").
(exists($hash->{helper}{DSP_MODES}) ? "dsp:".$dsp_modes_comma." " : "").
- "enhancer:on,off "
+ "enhancer:on,off ".
+ ($hash->{helper}{SUPPORT_HDMI_OUT} ? "hdmiOut1:on,off hdmiOut2:on,off " : "")
:"").
(exists($hash->{helper}{CURRENT_INPUT_TAG}) ?
"navigateListMenu play:noArg pause:noArg stop:noArg skip:reverse,forward ".
@@ -339,6 +346,7 @@ YAMAHA_AVR_Set($@)
($hash->{helper}{SUPPORT_PARTY_MODE} ? "partyMode:on,off " : "").
($hash->{helper}{SUPPORT_EXTRA_BASS} ? "extraBass:off,auto " : "").
($hash->{helper}{SUPPORT_YPAO_VOLUME} ? "ypaoVolume:off,auto " : "").
+
"tunerFrequency ".
"displayBrightness:slider,-4,1,0 ".
"statusRequest:noArg";
@@ -996,35 +1004,64 @@ YAMAHA_AVR_Set($@)
}
elsif($what eq "ypaoVolume" and defined($a[2]))
{
- if($a[2] eq "auto")
- {
- YAMAHA_AVR_SendCommand($hash, "<$zone>Auto$zone>", $what, $a[2]);
- }
- elsif($a[2] eq "off")
- {
- YAMAHA_AVR_SendCommand($hash, "<$zone>Off$zone>", $what, $a[2]);
- }
- else
- {
- return $usage;
- }
+ if($a[2] eq "auto")
+ {
+ YAMAHA_AVR_SendCommand($hash, "<$zone>Auto$zone>", $what, $a[2]);
+ }
+ elsif($a[2] eq "off")
+ {
+ YAMAHA_AVR_SendCommand($hash, "<$zone>Off$zone>", $what, $a[2]);
+ }
+ else
+ {
+ return $usage;
+ }
}
elsif($what eq "extraBass" and defined($a[2]))
{
- if($a[2] eq "auto")
- {
- YAMAHA_AVR_SendCommand($hash, "<$zone>Auto$zone>", $what, $a[2]);
- }
- elsif($a[2] eq "off")
- {
- YAMAHA_AVR_SendCommand($hash, "<$zone>Off$zone>", $what, $a[2]);
- }
- else
- {
- return $usage;
- }
+ if($a[2] eq "auto")
+ {
+ YAMAHA_AVR_SendCommand($hash, "<$zone>Auto$zone>", $what, $a[2]);
+ }
+ elsif($a[2] eq "off")
+ {
+ YAMAHA_AVR_SendCommand($hash, "<$zone>Off$zone>", $what, $a[2]);
+ }
+ else
+ {
+ return $usage;
+ }
+ }
+ elsif($what eq "hdmiOut1" and defined($a[2]))
+ {
+ if($a[2] eq "on")
+ {
+ YAMAHA_AVR_SendCommand($hash, "", $what, $a[2]);
+ }
+ elsif($a[2] eq "off")
+ {
+ YAMAHA_AVR_SendCommand($hash, "", $what, $a[2]);
+ }
+ else
+ {
+ return $usage;
+ }
+ }
+ elsif($what eq "hdmiOut2" and defined($a[2]))
+ {
+ if($a[2] eq "on")
+ {
+ YAMAHA_AVR_SendCommand($hash, "", $what, $a[2]);
+ }
+ elsif($a[2] eq "off")
+ {
+ YAMAHA_AVR_SendCommand($hash, "", $what, $a[2]);
+ }
+ else
+ {
+ return $usage;
+ }
}
-
elsif($what eq "statusRequest")
{
YAMAHA_AVR_GetStatus($hash, 1);
@@ -1388,6 +1425,10 @@ YAMAHA_AVR_ParseResponse($$$)
{
$hash->{helper}{SUPPORT_DISPLAY_BRIGHTNESS} = 0;
}
+ elsif($arg eq "hdmiOut1" or $arg eq "hdmiOut2")
+ {
+ $hash->{helper}{SUPPORT_HDMI_OUT} = 0;
+ }
}
}
@@ -1802,6 +1843,10 @@ YAMAHA_AVR_ParseResponse($$$)
{
readingsBulkUpdate($hash, "currentTitle", YAMAHA_AVR_html2txt($1));
}
+ elsif($data =~ /.*?