From 5a12d455e5d5831cfdaa0c84f59cd6c9e7c18614 Mon Sep 17 00:00:00 2001 From: ra666ack Date: Sat, 24 Jan 2015 15:53:43 +0000 Subject: [PATCH] 71_YAMAHA_NP.pm: Make timer setting more convenient. git-svn-id: https://svn.fhem.de/fhem/trunk@7694 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/71_YAMAHA_NP.pm | 35 +++++++++++++++++++---------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 6c549ca57..6ad10e7dc 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: Make timer setting more convenient. - changed: FB_CALLMONITOR: allow chars in phone numbers for reverse search - changed: SYSMON: non-blocking - changed: 71_YAMAHA_NP.pm: Provide entire http link to Player AlbumArt. diff --git a/fhem/FHEM/71_YAMAHA_NP.pm b/fhem/FHEM/71_YAMAHA_NP.pm index 6878195d3..4138f5c79 100644 --- a/fhem/FHEM/71_YAMAHA_NP.pm +++ b/fhem/FHEM/71_YAMAHA_NP.pm @@ -181,6 +181,7 @@ sub YAMAHA_NP_Set "on:noArg ". "off:noArg ". "timerRepeat:once,every ". + "timerSet:noArg ". "sleep:off,30min,60min,90min,120min ". "volumeStraight:slider,".$volumeStraightMin.",1,".$volumeStraightMax." ". "volume:slider,0,1,100 ". @@ -207,6 +208,7 @@ sub YAMAHA_NP_Set "on:noArg ". "off:noArg ". "timerRepeat:once,every ". + "timerSet:noArg ". "sleep:off,30min,60min,90min,120min ". "volumeStraight:slider,".$volumeStraightMin.",1,".$volumeStraightMax." ". "volume:slider,0,1,100 ". @@ -511,17 +513,7 @@ sub YAMAHA_NP_Set { if($a[2] eq "on") { - if(defined($hash->{helper}{timerHour}) and defined($hash->{helper}{timerMinute}) and defined($hash->{helper}{timerRepeat}) and defined($hash->{helper}{timerVolume})) - { - # Configure Timer according to provided parameters - YAMAHA_NP_SendCommand($hash, "".sprintf("%02d", $hash->{helper}{timerHour}).":".sprintf("%02d", $hash->{helper}{timerMinute})."".$hash->{helper}{timerVolume}."".$hash->{helper}{timerRepeat}."", $what, $a[2]); - # Switch on timer - YAMAHA_NP_SendCommand($hash, "".ucfirst($a[2])."", $what, $a[2]); - } - else - { - return "Please, define timerHour, timerMinute, timerRepeat and timerVolume first." - } + YAMAHA_NP_SendCommand($hash, "".ucfirst($a[2])."", $what, $a[2]); } elsif($a[2] eq "off") { @@ -577,6 +569,18 @@ sub YAMAHA_NP_Set return "Please use straight device volume range :".$hash->{helper}{VOLUMESTRAIGHTMIN}."...".$hash->{helper}{VOLUMESTRAIGHTMAX}."."; } } + elsif($what eq "timerSet") + { + if(defined($hash->{helper}{timerHour}) and defined($hash->{helper}{timerMinute}) and defined($hash->{helper}{timerRepeat}) and defined($hash->{helper}{timerVolume})) + { + # Configure Timer according to provided parameters + YAMAHA_NP_SendCommand($hash, "".sprintf("%02d", $hash->{helper}{timerHour}).":".sprintf("%02d", $hash->{helper}{timerMinute})."".$hash->{helper}{timerVolume}."".$hash->{helper}{timerRepeat}."", $what, $a[2]); + } + else + { + return "Please, define timerHour, timerMinute, timerRepeat and timerVolume first."; + } + } elsif($what eq "tunerPresetDAB") { if($a[2] >= 1 and $a[2] <= 30 and $hash->{MODEL} eq "CRX-N560D") @@ -705,15 +709,12 @@ sub YAMAHA_NP_Undefine return; } - ############################################################################################################ # # Begin of helper functions # ############################################################################################################ - - ############################# # sends a command to the receiver via HTTP sub YAMAHA_NP_SendCommand @@ -1469,8 +1470,9 @@ sub YAMAHA_NP_html2txt
  • timerHour [0...23]   -   sets hour of device's internal wake-up timer
  • timerMinute [0...59]   -   sets minutes of device's internal wake-up timer
  • timerRepeat [once|every]   -   sets repetition mode of device's internal wake-up timer
  • +
  • timerSet   -   configures the timer according to timerHour, timerMinute, timerRepeat, timerVolume. (ALL parameters must be set before. This command does not switch on the timer. → 'timer on'.)
  • timerVolume [<VOL_MIN>...<VOL_MAX>]   -   sets volume of device's internal wake-up timer
  • -
  • timer [on|off]   -   sets device's internal wake-up timer. (Note: before timer activation timerHour, timerMinute, timerRepeat and timerVolume must be set.)
  • +
  • timer [on|off]   -   sets device's internal wake-up timer. (Note: The timer will be activated according to the last stored timer parameters in the device. In order to modify please use the 'timerSet' command.)
  • tuner [<parameter>]   -   sets tuner related commands.