diff --git a/fhem/CHANGED b/fhem/CHANGED
index 8d6c01ce1..70b99ac87 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: 71_YAMAHA_NP.pm Improved timer setting
- feature: 98_logProxy.pm added postFn and scale2reading options
- feature: 70_Pushbullet.pm: new module 70_Pushbullet.pm
- changed: 31_MilightDevice (Thanks to MarkusM):
diff --git a/fhem/FHEM/71_YAMAHA_NP.pm b/fhem/FHEM/71_YAMAHA_NP.pm
index 4138f5c79..417038986 100644
--- a/fhem/FHEM/71_YAMAHA_NP.pm
+++ b/fhem/FHEM/71_YAMAHA_NP.pm
@@ -190,7 +190,7 @@ sub YAMAHA_NP_Set
"timerVolume:slider,".$volumeStraightMin.",1,".$volumeStraightMax." ".
"mute:on,off ".
(exists($hash->{helper}{INPUTS})?"input:".$inputs_comma." ":"").
- "statusRequest:basicStatus,mediaRendererDesc,playerStatus,systemConfig,timerStatus,tunerPresetDAB,tunerPresetFM,tunerStatus ".
+ "statusRequest:basicStatus,mediaRendererDesc,playerStatus,standbyMode,systemConfig,timerStatus,tunerPresetDAB,tunerPresetFM,tunerStatus ".
"standbyMode:eco,normal ".
"cdTray:noArg ".
"timer:on,off ".
@@ -217,7 +217,7 @@ sub YAMAHA_NP_Set
"timerVolume:slider,".$volumeStraightMin.",1,".$volumeStraightMax." ".
"mute:on,off ".
(exists($hash->{helper}{INPUTS})?"input:".$inputs_comma." ":"").
- "statusRequest:basicStatus,mediaRendererDesc,networkInfo,playerStatus,systemConfig,timerStatus,tunerPresetFM,tunerStatus ".
+ "statusRequest:basicStatus,mediaRendererDesc,networkInfo,playerStatus,standbyMode,systemConfig,timerStatus,tunerPresetFM,tunerStatus ".
"standbyMode:eco,normal ".
"cdTray:noArg ".
"timer:on,off ".
@@ -235,11 +235,11 @@ sub YAMAHA_NP_Set
if($what eq "on")
{
- YAMAHA_NP_SendCommand($hash, "On" ,$what, undef);
+ YAMAHA_NP_SendCommand($hash, "On" ,$what, "On");
}
elsif($what eq "off")
{
- YAMAHA_NP_SendCommand($hash, "Standby", $what, undef);
+ YAMAHA_NP_SendCommand($hash, "Standby", $what, "Standby");
}
elsif($what eq "input")
{
@@ -340,7 +340,7 @@ sub YAMAHA_NP_Set
if($hash->{READINGS}{power}{VAL} eq "on")
{
$hash->{helper}{targetVolume} = $target_volume;
- YAMAHA_NP_SendCommand($hash, "".($target_volume)."<\/System>", "volume", undef);
+ YAMAHA_NP_SendCommand($hash, "".($target_volume)."<\/System>", "volume", $a[2]);
}
else
{
@@ -458,12 +458,12 @@ sub YAMAHA_NP_Set
}
elsif($what eq "cdTray")
{
- YAMAHA_NP_SendCommand($hash, "Open/Close", $what, undef);
+ YAMAHA_NP_SendCommand($hash, "Open/Close", $what, "Open/Close");
}
elsif($what eq "clockUpdate")
{
my $clockUpdateCurrentTime = Time::Piece->new();
- YAMAHA_NP_SendCommand($hash, "".($clockUpdateCurrentTime->strftime('%Y:%m:%d:%H:%M:%S'))."", $what, undef);
+ YAMAHA_NP_SendCommand($hash, "".($clockUpdateCurrentTime->strftime('%Y:%m:%d:%H:%M:%S'))."", $what, ($clockUpdateCurrentTime->strftime('%Y:%m:%d:%H:%M:%S')));
}
elsif($what eq "statusRequest")
{
@@ -500,6 +500,10 @@ sub YAMAHA_NP_Set
{
YAMAHA_NP_SendCommand($hash, "GetParam", $what, $a[2]);
}
+ elsif($a[2] eq "standbyMode")
+ {
+ YAMAHA_NP_SendCommand($hash, "GetParam", $what, $a[2]);
+ }
elsif($a[2] eq "mediaRendererDesc")
{
YAMAHA_NP_getMediaRendererDesc($hash);
@@ -513,7 +517,15 @@ sub YAMAHA_NP_Set
{
if($a[2] eq "on")
{
- YAMAHA_NP_SendCommand($hash, "".ucfirst($a[2])."", $what, $a[2]);
+ # Check if standbyMode == 'Normal'
+ if($hash->{READINGS}{standbyMode}{VAL} eq "normal")
+ {
+ YAMAHA_NP_SendCommand($hash, "".ucfirst($a[2])."", $what, $a[2]);
+ }
+ else
+ {
+ return "Set 'standbyMode normal' first.";
+ }
}
elsif($a[2] eq "off")
{
@@ -786,7 +798,7 @@ sub YAMAHA_NP_SendCommand
# parses the receiver response
sub YAMAHA_NP_ParseResponse
{
- my ( $param, $err, $data ) = @_;
+ my ($param, $err, $data ) = @_;
my $hash = $param->{hash};
my $name = $hash->{NAME};
@@ -823,7 +835,7 @@ sub YAMAHA_NP_ParseResponse
$hash->{helper}{AVAILABLE} = 1;
- if ($cmd ne "statusRequest" and $arg ne "systemConfig") # RC="0" is not delivered by that status Request
+ if (($cmd ne "statusRequest") and ($arg ne "systemConfig")) # RC="0" is not delivered by that status Request
{
if(not $data =~ /RC="0"/)
{
@@ -1113,6 +1125,13 @@ sub YAMAHA_NP_ParseResponse
}
}
}
+ elsif ($arg eq "standbyMode")
+ {
+ if($data =~ /(.+)<\/Saving>/)
+ {
+ readingsBulkUpdate($hash, "standbyMode", lc($1));
+ }
+ }
elsif ($arg eq "mediaRendererDesc")
{
if($data =~ /(.+)<\/friendlyName>/)
@@ -1185,6 +1204,13 @@ sub YAMAHA_NP_ParseResponse
readingsBulkUpdate($hash, "mute", $arg);
}
}
+ elsif($cmd eq "standbyMode")
+ {
+ if($data =~ /RC="0"/)
+ {
+ readingsBulkUpdate($hash, "standbyMode", lc($arg));
+ }
+ }
elsif($cmd eq "volume" or $cmd eq "volumeStraight" or $cmd eq "volumeUp" or $cmd eq "volumeDown")
{
if($data =~ /RC="0"/)
@@ -1460,9 +1486,10 @@ sub YAMAHA_NP_html2txt
standbyMode [eco|normal] - set the standby mode.
statusRequest [<parameter>] - requests the current status of the device
- - systemConfig
- requests the system configuration
- basicStatus - requests the basic status such as volume input etc.
- playerStatus - requests the player status such as play status, song info, artist info etc.
+ - standbyMode - requests the standby mode information
+ - systemConfig - requests the system configuration
- tunerStatus - requests the tuner status such as FM frequency, preset number, DAB information etc.
- timerStatus - requests device's internal wake-up timer status
- networkInfo - requests device's network related information such as IP, Gateway, MAC address etc.
@@ -1557,6 +1584,7 @@ sub YAMAHA_NP_html2txt
- volume - Reports the current volume level of the receiver in % (0...100%)
- volumeStraight - Reports the current volume level of the receiver as used and displayed in the device (values device specific)
- sleep - Reports the current sleep timer status (30min|60min|90min|120min|off).
+ - standbyMode - Reports the standby mode (eco|normal).
- state - Reports the current power state and an absence of the device (on|off|absent)
Player related readings:
- playerPlaybackInfo - Reports current player state (play|stop|pause).
@@ -1688,9 +1716,10 @@ sub YAMAHA_NP_html2txt
- standbyMode [eco|normal] - Umschaltung des Standby Modus.
- statusRequest [<parameter>] - Abfrage des aktuellen Status des Network Players.
- - systemConfig
- Abfrage der Systemkonfiguration.
- basicStatus - Abfrage der Elementarparameter (z.B. Lautstärke, Eingang, etc.)
- playerStatus - Abfrage des Player-Status.
+ - standbyMode - Abfrage des standby Modus.
+ - systemConfig - Abfrage der Systemkonfiguration.
- tunerStatus - Abfrage des Tuner-Status (z.B. FM Frequenz, Preset-Nummer, DAB Information etc.)
- timerStatus - Abfrage des internen Wake-up timers.
- networkInfo - Abfrage von Netzwerk-relevanten Informationen (z.B: IP-Adresse, Gateway-Adresse, MAC-address etc.)
@@ -1782,6 +1811,7 @@ sub YAMAHA_NP_html2txt
- volume - Abfrage der aktuell eingestellten Lautstärke in % (0...100%)
- volumeStraight - Abfrage der aktuellen absoluten Gerätelautstärke im Gerät (gerätespezifisch)
- sleep - Abfrage des Sleep-Timer Status (30min|60min|90min|120min|off).
+ - standbyMode - Abfrage des standby Modus (eco|normal).
- state - Abfrage des aktuellen Power Zustands und Anwesenheit (on|off|absent).
Player Readings:
- playerPlaybackInfo - Abfrage des aktuellen Player Status (play|stop|pause).