From 8959704aa0dcbcf39ae749eb529b6831719a6934 Mon Sep 17 00:00:00 2001 From: ra666ack <> Date: Wed, 10 Jul 2019 10:58:35 +0000 Subject: [PATCH] 71_YAMAHA_NP:New commands 'checkForNewFirmware' and 'friendlyName' git-svn-id: https://svn.fhem.de/fhem/trunk@19813 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/71_YAMAHA_NP.pm | 51 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 50ad34fea..9efa9872a 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: New commands 'checkForNewFirmware' and 'friendlyName' - feature: 95_Astro: v2.1.0: add alternative global functions to replace SUNRISE_EL - feature: 98_WeekdayTimer now supports holiday2we entries diff --git a/fhem/FHEM/71_YAMAHA_NP.pm b/fhem/FHEM/71_YAMAHA_NP.pm index 679932ae7..d460e841a 100644 --- a/fhem/FHEM/71_YAMAHA_NP.pm +++ b/fhem/FHEM/71_YAMAHA_NP.pm @@ -504,11 +504,12 @@ sub YAMAHA_NP_Set my $address = $hash->{helper}{ADDRESS}; # Get model info in case not defined - if(not defined($hash->{MODEL}) or not defined($hash->{FIRMWARE})) + if(not defined($hash->{MODEL}) or not defined($hash->{FIRMWARE}) or not defined($hash->{FIRMWARE_STATUS})) { YAMAHA_NP_SendCmd($hash, "GET:System,Misc,Network,Info:GetParam", "statusRequest", "networkInfo" , 0); YAMAHA_NP_getModel($hash); YAMAHA_NP_SendCmd($hash, "GET:System,Config:GetParam" , "statusRequest", "systemConfig", 0); + YAMAHA_NP_SendCmd($hash, "GET:System,Misc,Update,Yamaha_Network_Site,Status:GetParam" , "checkForNewFirmware", "noArg", 0); } # Setting default values. Update from device during existing communication. @@ -553,8 +554,9 @@ sub YAMAHA_NP_Set # Context-sensitive command availability if (ReadingsVal($name,"power","") !~ m/(off|absent)/) { - $usage .=" input:".$inputs_comma - + $usage .=" friendlyName" + ." checkForNewFirmware:noArg" + ." input:".$inputs_comma ." volumeStraight:slider,".$volumeStraightMin.",1,".$volumeStraightMax ." volume:slider,0,1,100" ." volumeUp:noArg" @@ -1535,6 +1537,23 @@ desiredListNloop: return "Please use straight device volume range :".$hash->{helper}{VOLUMESTRAIGHTMIN}."...".$hash->{helper}{VOLUMESTRAIGHTMAX}."."; } } + elsif($what eq "checkForNewFirmware") + { + YAMAHA_NP_SendCmd($hash, "GET:System,Misc,Update,Yamaha_Network_Site,Status:GetParam" , "checkForNewFirmware", "noArg", 0); + } + elsif($what eq "friendlyName") + { + # Accept 1 to 15 characters + if (length($a[2]) >= 1 and length($a[2]) <= 15) + { + $hash->{helper}{friendlyName} = $a[2]; + YAMAHA_NP_SendCmd($hash, "PUT:System,Misc,Network,Network_Name:".$a[2], $what, $a[2], 0); + } + else + { + return "'friendlyName' must be between 1 and 15 characters." + } + } elsif($what eq "timerSet") { # TimerSet @@ -2369,6 +2388,28 @@ sub YAMAHA_NP_ParseResponse return; } } + elsif($cmd eq "checkForNewFirmware") + { + if($data =~ /RC="0"/ and $data =~ /Unavailable<\/Status>/) + { + $hash->{FIRMWARE_STATUS} = "Most recent version installed"; + $hash->{helper}{dInfo}{FIRMWARE_STATUS} = "Most recent version installed"; + } + else + { + $hash->{FIRMWARE_STATUS} = "New Firmware available"; + $hash->{helper}{dInfo}{FIRMWARE_STATUS} = "New Firmware available"; + } + } + elsif($cmd eq "friendlyName") + { + if($data =~ /RC="0"/) + { + $hash->{FRIENDLY_NAME} = $hash->{helper}{friendlyName}; + $hash->{helper}{dInfo}{FRIENDLY_NAME} = $hash->{helper}{friendlyName}; + delete $hash->{helper}{friendlyName}; + } + } elsif($cmd eq "mute") { if($data =~ /RC="0"/){readingsBulkUpdate($hash, "mute", $arg);} @@ -2680,12 +2721,14 @@ sub YAMAHA_NP_html2txt
Available commands:

  • CDTray – open/close the CD tray.
  • +
  • checkForNewFirmware – Checks for firmware updates. The result is stored in 'Internals' und 'deviceInfo'.
  • clockUpdate – updates the system clock with current time. The local time information is taken from the FHEM server.
  • dimmer < 1..3 > – Sets the display brightness.
  • directPlay < input:Stream Level 1,Stream Level 2,... > – allows direct stream selection e.g. CD:1, DAB:1, netradio:Bookmarks,SWR3 (case–sensitive)
  • favoriteDefine < name:input[,Stream Level 1,Stream Level 2,...] > – defines and stores a favorite stream e.g. CoolSong:CD,1 (predefined favorites are the available inputs)
  • favoriteDelete < name > – deletes a favorite stream
  • favoritePlay < name > – plays a favorite stream
  • +
  • friendlyName < name > – sets network player's friendly name (network name). String must be between 1 and 15 characters.
  • input [<parameter>] – selects the input channel. The inputs are read dynamically from the device. Available inputs can be set (e.g. cd, tuner, aux1, aux2, ...).
  • mute [on|off] – activates/deactivates muting
  • off – shuts down the device
  • @@ -2882,12 +2925,14 @@ sub YAMAHA_NP_html2txt
    Verfügbare Befehle:

  • CDTray – Öffnen und Schließen des CD–Fachs.
  • +
  • checkForNewFirmware – Prüft die Verfügbarkeit neuer Firmware. Das Ergebnis wird in 'Internals' and 'deviceInfo' gespeichert.
  • clockUpdate – Aktualisierung der Systemzeit des Network Players. Die Zeitinformation wird von dem FHEM Server bezogen, auf dem das Modul ausgeführt wird.
  • dimmer [1..3] – Einstellung der Anzeigehelligkeit
  • directPlay < input:Stream Level 1,Stream Level 2,... > – ermöglicht direktes Abspielen eines Audiostreams/einer Audiodatei z.B. CD:1, DAB:1, netradio:Bookmarks,SWR3
  • favoriteDefine < name:input[,Stream Level 1,Stream Level 2,...] > – Speichert einen Favoriten e.g. CoolSong:CD,1 (vordefinierte Favoriten sind die verfügbaren Eingänge)
  • favoriteDelete < name > – Löscht einen Favoriten
  • favoritePlay < name > – Spielt einen Favoriten ab
  • +
  • friendlyName < name> – Setzt den Gerätenamen (friendly name / network name). String muss zwischen einem und 15 Zeichen sein.
  • input [<parameter>] – Auswahl des Eingangs des Network Players. (Nicht verfügbar beim ausgeschaltetem Gerät)
  • mute [on|off] – Aktiviert/Deaktiviert die Stummschaltung
  • off – Network Player ausschalten