From a86de8b0475a0488424e08fcd0b4244cebc45fa3 Mon Sep 17 00:00:00 2001 From: ra666ack Date: Mon, 28 Dec 2015 18:18:41 +0000 Subject: [PATCH] 71_PHILIPS_AUDIO: Added internet radio favorite selection. Thanks to Peter. git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@10288 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/71_PHILIPS_AUDIO.pm | 39 ++++++++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index da19a26fd..813b91370 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: PHILIPS_AUDIO: Favorite station selection - feature: YAMAHA_AVR: new set commands and readings for tuner control - new set commands tunerFrequency,tunerPreset for controlling tuner frequencies and selecting presets. diff --git a/fhem/FHEM/71_PHILIPS_AUDIO.pm b/fhem/FHEM/71_PHILIPS_AUDIO.pm index 4b08e3467..5fd4c55a0 100755 --- a/fhem/FHEM/71_PHILIPS_AUDIO.pm +++ b/fhem/FHEM/71_PHILIPS_AUDIO.pm @@ -8,9 +8,10 @@ # such as MCi, Streamium and Fidelio devices. # The module provides basic functionality accessible through the port 8889 of the device: # (http://:8889/index). +# It seems the 3000 family e.g. NP3500, NP3700, NP3900 use that port. # # Copyright by Radoslaw Watroba -# (e-mail: ra666ack@googlemail.com) +# (e-mail: ra666ack at googlemail dot com) # # This file is part of fhem. # @@ -151,6 +152,7 @@ sub PHILIPS_AUDIO_Set "aux:noArg ". #"input:aux,internetRadio,mediaLibrary,onlineServices ". "inetRadioPreset:1,2,3,4,5,6,7,8,9,10 ". + "inetRadioFavorite:1,2,3,4,5,6,7,8,9,10 ". "statusRequest:noArg ". #"addToFavourites:noArg ". #"removeFromFavourites:noArg ". @@ -261,6 +263,13 @@ sub PHILIPS_AUDIO_Set $hash->{helper}{inetRadioPreset} = $a[2]; PHILIPS_AUDIO_SendCommand($hash, "/index", "", $what, $a[2]); } + elsif($what eq "inetRadioFavorite") + { + # Hierarchichal navigation through the contents mandatory + $hash->{helper}{cmdStep} = 1; + $hash->{helper}{inetRadioFavorite} = $a[2]; + PHILIPS_AUDIO_SendCommand($hash, "/index", "", $what, $a[2]); + } elsif($what eq "volumeStraight") { if($a[2] >= 0 and $a[2] <= 64) @@ -536,6 +545,28 @@ sub PHILIPS_AUDIO_ParseResponse PHILIPS_AUDIO_SendCommand($hash, "/nav\$03\$03\$".sprintf("%03d", $hash->{helper}{inetRadioPreset})."\$1", "","inetRadioPreset", $hash->{helper}{inetRadioPreset}); } } + elsif($cmd eq "inetRadioFavorite") + { + # This command must be processed hierarchicaly through the navigation path + if($hash->{helper}{cmdStep} == 1) + { + $hash->{helper}{cmdStep} = 2; + # Internet radio favorite + PHILIPS_AUDIO_SendCommand($hash, "/nav\$03\$01\$001\$0", "", "inetRadioFavorite", $hash->{helper}{inetRadioFavorite}); + } + elsif($hash->{helper}{cmdStep} == 2) + { + $hash->{helper}{cmdStep} = 3; + # Favorite Presets + PHILIPS_AUDIO_SendCommand($hash, "/nav\$03\$02\$002\$0", "","inetRadioFavorite", $hash->{helper}{inetRadioFavorite}); + } + elsif($hash->{helper}{cmdStep} == 3) + { + $hash->{helper}{cmdStep} = 4; + # Favorite Preset select + PHILIPS_AUDIO_SendCommand($hash, "/nav\$03\$03\$".sprintf("%03d", $hash->{helper}{inetRadioFavorite})."\$1", "","inetRadioFavorite", $hash->{helper}{inetRadioFavorite}); + } + } elsif($cmd eq "play_pause") { if($data =~ /SUCCESS/) @@ -852,7 +883,8 @@ sub PHILIPS_AUDIO_STREAMIUMNP2txt