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