diff --git a/fhem/CHANGED b/fhem/CHANGED
index 5c555327f..55d7e3870 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -1,5 +1,6 @@
# 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 attribute volumeMax to limit the maximum volume
- update: 70_WS3600.pm extension for UV and illuminance
- bugfix: 38_CO20.pm: fixed Device::USB init errors
- update: 93_DBLog: new Version 2.13.5, supports primary key now,
diff --git a/fhem/FHEM/71_YAMAHA_AVR.pm b/fhem/FHEM/71_YAMAHA_AVR.pm
index 0ca300635..809b72358 100755
--- a/fhem/FHEM/71_YAMAHA_AVR.pm
+++ b/fhem/FHEM/71_YAMAHA_AVR.pm
@@ -60,6 +60,7 @@ YAMAHA_AVR_Initialize($)
"request-timeout:1,2,3,4,5 ".
"model ".
"volumeSteps:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 ".
+ "volumeMax ".
"volume-smooth-change:0,1 ".
"volume-smooth-steps:1,2,3,4,5,6,7,8,9,10 ".
$readingFnAttributes;
@@ -436,6 +437,11 @@ YAMAHA_AVR_Set($@)
{
return $usage;
}
+
+ if($target_volume > YAMAHA_AVR_volume_rel2abs(AttrVal($name, "volumeMax","100")))
+ {
+ $target_volume = YAMAHA_AVR_volume_rel2abs(AttrVal($name, "volumeMax","100"));
+ }
# if lower than minimum (-80.5) or higher than max (16.5) set target volume to the corresponding boundary
$target_volume = -80.5 if(defined($target_volume) and $target_volume < -80.5);
@@ -919,14 +925,39 @@ YAMAHA_AVR_Set($@)
sub
YAMAHA_AVR_Attr(@)
{
- my @a = @_;
- my $hash = $defs{$a[1]};
+ my ($cmd, $name, $attr, $val) = @_;
+
+ my $hash = $defs{$name};
- if($a[2] eq "disable")
+ return unless($hash);
+
+ if($attr eq "disable")
{
# Start/Stop Timer according to new disabled-Value
YAMAHA_AVR_ResetTimer($hash, 1);
}
+
+ if($cmd eq "set")
+ {
+ if($attr =~ /^(?:volumeMax|volumeSteps)$/)
+ {
+ if($val !~ /^\d+$/)
+ {
+ return "invalid attribute value for attribute $attr: $val";
+ }
+
+ if($attr eq "volumeMax" and ($val < 0 or $val > 100))
+ {
+ return "value is out of range (0-100) for attribute $attr: $val";
+ }
+
+ if($attr eq "volumeSteps" and ($val < 1))
+ {
+ return "value is out of range (1-*) for attribute $attr: $val";
+ }
+ }
+ }
+
return undef;
}
@@ -2395,28 +2426,36 @@ So here are some examples:
Attributes
-
- do_not_notify
- disabledForIntervals
- readingFnAttributes
- request-timeout
Optional attribute change the response timeout in seconds for all queries to the receiver.
- Possible values: 1-5 seconds. Default value is 4 seconds.
+ Possible values: 1-5 seconds. Default value is 4 seconds.
+
- disable
Optional attribute to disable the internal cyclic status update of the receiver. Manual status updates via statusRequest command is still possible.
- Possible values: 0 => perform cyclic status update, 1 => don't perform cyclic status updates.
+ Possible values: 0 => perform cyclic status update, 1 => don't perform cyclic status updates.
+
- volume-smooth-change
Optional attribute to activate a smooth volume change.
- Possible values: 0 => off , 1 => on
+ Possible values: 0 => off , 1 => on
+
- volume-smooth-steps
Optional attribute to define the number of volume changes between the
- current and the desired volume. Default value is 5 steps
+ current and the desired volume. Default value is 5 steps
+
- volumeSteps
- Optional attribute to define the default increasing and decreasing level for the volumeUp and volumeDown set command. Default value is 5%
-
+ Optional attribute to define the default increasing and decreasing level for the volumeUp and volumeDown set command. Default value is 5%
+
+ - volumeMax
+ Optional attribute to set an upper limit in percentage for volume changes.
+ If the user tries to change the volume to a higher level than configured with this attribute, the volume will not exceed this limit.
+
+ Possible values: 0-100%. Default value is 100% (no limitation)
Generated Readings/Events:
@@ -2690,8 +2729,14 @@ Ein paar Beispiele:
Optionales Attribut, welches angibt, wieviele Schritte zur weichen Lautstärkeanpassung
durchgeführt werden sollen. Standardwert ist 5 Anpassungschritte
- volumeSteps
- Optionales Attribut, welches den Standardwert zur Lautstärkenerhöhung (volumeUp) und Lautstärkenveringerung (volumeDown) konfiguriert. Standardwert ist 5%
-
+ Optionales Attribut, welches den Standardwert zur Lautstärkenerhöhung (volumeUp) und Lautstärkenveringerung (volumeDown) konfiguriert. Standardwert ist 5%
+
+ - volumeMax
+ Optionales Attribut, welches eine maximale Obergrenze in Prozent für die Lautstärke festlegt.
+ Wird versucht die Lautstärke auf einen höheren Wert zu setzen, so wird die Lautstärke dennoch die konfigurierte Obergrenze nicht überschreiten.
+
+ Mögliche Werte: 0-100%. Standardwert ist 100% (keine Begrenzung)
+
Generierte Readings/Events: