This module controls a Yamaha Network Player (such as MCR-N560, MCR-N560D, CRX-N560, CRX-N560D, CD-N500 or NP-S2000) via Ethernet.
Theoretically, any device understanding the communication protocol of the Yamaha Network Player App should work.
Currently implemented features:
Power on/off
Timer on/off
Input selection
Timer on/off
Volume +/-
Mute on/off
System Clock Update
Tuner: tune +/-, preset +/-, Station information (FM/DAB)
Stand-by mode: eco/normal
Player (play, stop, next, prev, shuffle, repeat)
Menu navigation
...
Defining a YAMAHA_NP device will schedule an internal task (interval can be set
with optional parameters <off_status_interval> and <on_status_interval> in seconds.
<off_status_interval> is a parameter used in case the device is powered off or not available.
<on_status_interval> is a parameter used in case the device is powered on.
If both parameters are unset, a default value 30 (seconds) for both is used.
If <off_status_interval> is set only the same value is used for both parameters.
The internal task periodically reads the status of the Network Player (power state, selected
input, volume and mute status etc.) and triggers notify/filelog commands.
Example:
Add the following code into the fhem.cfg configuration file and restart fhem:
# With custom status interval of 60 seconds
define NP_Player YAMAHA_NP 192.168.0.15 60
attr NP_player webCmd input:volume:mute:volumeDown:volumeUp
# With custom "off"-interval of 60 seconds and "on"-interval of 10 seconds
define NP_Player YAMAHA_NP 192.168.0.15 60 10
attr NP_player webCmd input:volume:mute:volumeDown:volumeUp
Set
set <name> <command> [<parameter>]
Currently, the following commands are defined.
The available inputs are depending on the used network player.
The module offers only available inputs.
Note: Commands and parameters are case sensitive.
Available commands:
cdTray - open/close the CD tray.
clockUpdate - updates the system clock with current time. The time information is taken from the FHEM server.
dimmer [1..3] - Sets the display brightnes.
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
on - powers on the device
player [<parameter>] - sets player related commands.
play - play.
stop - stop.
pause - pause.
next - next item.
prev - previous item.
shuffleToggle - Toggles the shuffle mode.
repeatToggle - Toggles the repeat modes.
playerListCursorDown - Command for list navigation in inputs such as Net Radio or Server. Command moves the cursor down. Next line displayed.
playerListCursorReturn - Command for list navigation in inputs such as Net Radio or Server. Command returns from a hierarchical sub-menu. Higher level menu displayed.
playerListCursorUp - Command for list navigation in inputs such as Net Radio or Server. Command moves the cursor up. Previous line displayed.
playerListGetList - Command for list navigation in inputs such as Net Radio or Server. Command returns readings relevant for list/menu navigation.
playerListJumpLine [value] - Command for list navigation in inputs such as Net Radio or Server. Command jumps to a given line.
playerListSelectLine [value] - Command for list navigation in inputs such as Net Radio or Server. Command selects the given line. In case the line is a 'Container' (folder) it's entered. In case of 'Item' the playback starts.
sleep [off|30min|60min|90min|120min] - activates the internal sleep timer
standbyMode [eco|normal] - set the standby mode.
statusRequest [<parameter>] - requests the current status of the device
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.
timerHour [0...23] - sets hour of device's internal wake-up timer
timerMinute [0...59] - sets minutes 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: 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.
bandDAB - sets the tuner band to DAB (if available).
bandFM - sets the tuner band to FM.
tuneUp - tuner tune up.
tuneDown - tuner tune down.
presetUp - tuner preset up.
presetDown - tuner preset down.
tunerFMFrequency [87.50 ... 108.00] - Sets the FM frequency. The value must be 87.50 ... 108.00 including the decimal point ('.') with two digits after. Otherwise the value will be ignored.
tunerPresetDAB [1...30] - Sets the DAB preset.
tunerPresetFM [1...30] - Sets the FM preset.
volume [0...100] - set the volume level in %
volumeStraight [<VOL_MIN>...<VOL_MAX>] - set the volume as used and displayed in the device. <VOL_MIN> and <VOL_MAX> are read and set from the device automatically.
volumeUp [<VOL_MIN>...<VOL_MAX>] - increases the volume by one device's absolute step. <VOL_MIN> and <VOL_MAX> are read and set from the device automatically.
volumeDown [<VOL_MIN>...<VOL_MAX>] - increases the volume by one device's absolute step. <VOL_MIN> and <VOL_MAX> are read and set from the device automatically.
A typical example is powering the device remotely and tuning the favourite radio station:
Add the following code into the fhem.cfg configuration file:
It's a good idea to insert a 'sleep' instruction between each fhem commands due to internal processing time of the network player. During that time the following commands might be ignored...
Now the function can be called by typing the following line in the FHEM command line or by the notify-definitions:
{startMyFavouriteRadioStation()}
Get
get <name> <reading>
Currently, the 'get' command returns reading values only. For a specific list of possible values, see section "Generated Readings".
Optional attribute to disable the internal cyclic status update of the receiver. Manual status updates via statusRequest command is still possible.
Possible values: 0 → perform cyclic status update, 1 → don't perform cyclic status updates.
Optional attribute for smooth volume change (more Ethernet traffic is generated during volume change). Default is 1.
Readings
Basic readings:
input - The selected input source according to the FHEM input commands
mute - Reports the mute status of the receiver (on|off)
power - Reports the power status of the receiver (on|off)
presence - Reports the presence status of the receiver or zone (absent|present). Note: In case of "absent", the device cannot be controlled by FHEM. Check standbyMode.
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:
Note: In order to update the following readings use "statusRequest playerStatus" first.
playerPlaybackInfo - Reports current player state (play|stop|pause).
playerDeviceType - Reports the device type (ipod|msc).
playerIpodMode - Reports the Ipod Mode (normal|off)
playerRepeat - Reports the Repeat Mode (one|off)
playerShuffle - Reports the Shuffle Mode (on|off)
playerPlayTime - Reports the play time of the currently played audio (HH:MM:SS).
playerTrackNumber - Reports the track number of the currently played audio.
playerTotalTracks - Reports the total number of tracks for playing.
playerArtist - Reports the artist (if available) of the currently played audio.
playerAlbum - Reports the album (if available) of the currently played audio.
playerSong - Reports the song name (if available) of the currently played audio.
playerAlbumArtURL - Reports the album art url (if available) of the currently played audio. The URL points to the network player.
playerAlbumArtID - Reports the album art ID (if available) of the currently played audio.
playerAlbumArtFormat - Reports the album art format (if available) of the currently played audio.
Player List (Menu) related readings:
Note: In order to update the following readings use "statusRequest playerStatus" first.
playerListCurrentLine - Reports the current active list line as displayd.
playerListLine_1..._8 - Reports the content of the Line 1...8 as provided by the device.
playerListLine_Attribute_1..._8 - Reports the attribute of the Line 1...8 (Container|Item|Unselectable).
playerListMaxLine - Reports the number of lines in current list/menu.
playerListMenuName - Reports the name of the current list/menu.
playerListStatus - Reports the status of the current list/menu (Busy|Ready).
Tuner related readings:
Note: In order to update the following readings use "statusRequest tunerStatus" first.
tunerAudioModeDAB - Reports current audio mode (Mono|Stereo).
tunerBand - Reports the currently selected tuner band (FM|DAB). DAB if available.
tunerBitRateDAB - Reports current DAB stream bit rate (kbit/s).
tunerPresetFM - Reports the currently selected FM preset. If stored as such (1...30).
tunerFrequencyDAB - Reports the currently tuned DAB frequency. (xxx.xxx MHz)
tunerFrequencyFM - Reports the currently tuned FM frequency. (xxx.xx MHz)
tunerModeDAB - Reports current DAB audio mode (DAB|DAB+).
tunerProgramServiceFM - Reports the FM service name.
tunerRadioTextAFM - Reports the Radio Text A of the selected FM service.
tunerRadioTextBFM - Reports the Radio Text B of the selected FM service.
tunerPresetDAB - Reports the currently selected DAB preset. If stored as such (1...30).
tunerServiceLabelDAB - Reports the service label of the selected DAB service.
tunerChannelLabelDAB - Reports the channel label of the selected DAB service.
tunerDLSDAB - Reports the dynamic label segment of the selected DAB service.
tunerEnsembleLabelDAB - Reports the ensemble label of the selected DAB service.
Timer related readings:
Note: In order to update the following readings use "statusRequest timerStatus" first.
timer - Reports the time mode (on|off).
timerRepeat - Reports the timer repeat mode (once|every).
timerStartTime - Reports the timer start time (HH:MM).
timerVolumeLevel - Reports the timer volume level.
Implementer's note
Trivial: In order to use that module the network player must be connected to the Ethernet.
The device must be in standbyMode "Normal" in order to power on.
However, even if the standbyMode is set to "Eco" the device can be powered off. In that case it has to be switched on manually.
Mit Hilfe dieses Moduls lassen sich Yamaha Network Player (z.B. MCR-N560, MCR-N560D, CRX-N560, CRX-N560D, CD-N500 or NP-S2000) via Ethernet steuern.
Theoretisch sollten alle Geräte, die mit der Yamaha Network Player App kompatibel sind, bedient werden können.
Die aktuelle Implementierung ermöglicht u.a. den folgenden Funktionsumfang:
Eine YAMAHA_NP Definition initiiert einen internen Task, der von FHEM zyklisch abgearbeitet wird.
Das Intervall (in Sekunden) kann für die Zustände <on_status_interval> und <off_status_interval> optional gesetzt werden.
<off_status_interval> steht für das Intervall, wenn das Gerät ausgeschaltet/abwesend ist.
<on_status_interval> steht für das Intervall, wenn das Gerät eingeschaltet/verfügbar ist.
Wenn keine Parametere angegeben wurden, wird ein Default-Wert von 30 Sekunden für beide gesetzt.
Wenn nur <off_status_interval> gesetzt wird, gilt dieser Wert für beide Zustände (eingeschaltet/ausgeschaltet).
Der Task liest zyklisch grundlegende Parameter vom Network Player wie z.B. (Power-Status , gewählter Eingang, Lautstärke etc.) und triggert notify/filelog Befehle.
# 60 Sekunden Intervall für "off" und 10 Sekunden für "on"
define NP_Player YAMAHA_NP 192.168.0.15 60 10
attr NP_player webCmd input:volume:mute:volumeDown:volumeUp
Set
set <name> <command> [<parameter>]
Aktuell sind folgende Befehle implementiert:
Die verfügbaren Eingänge des Network Players werden vom diesem gelesen und dynamisch in FHEM angepasst.
Bemerkung: Bitte bei den Befehlen und Parametern die Groß- und Kleinschreibung beachten.
Verfügbare Befehle:
cdTray - Öffnen und Schließen des CD-Fachs.
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 Anzeigenhelligkeit.
input [<parameter>] - Auswahl des Eingangs des NP. Der aktive Eingang wird vom Gerät gelesen und in FHEM dynamisch dargestellt (z.B. cd, tuner, aux1, aux2, ...).
mute [on|off] - Aktiviert/Deaktiviert die Stummschaltung.
off - Network Player ausschalten.
on - Network Player einschalten.
player [<parameter>] - Setzt Player relevante Befehle.
play - play.
stop - stop.
pause - pause.
next - nächstes Audiostück.
prev - vorheriges Audiostück.
shuffleToggle - Umschaltung des Zufallswiedergabe.
repeatToggle - Umschaltung des Wiederholungsmodes.
playerListCursorDown - Befehl zur Navigation in Eingängen wie Net Radio oder Server. Befehl bewegt den Cursor nach unten. Nächste Zeile wird im Gerät angezeit.
playerListCursorReturn - Befehl zur Navigation in Eingängen wie Net Radio oder Server. Befehl kehrt zurück vom hierarchischen, untergeordneten Menü. Übergeordnetes Menü wird angezeigt.
playerListCursorUp - Befehl zur Navigation in Eingängen wie Net Radio oder Server. Befehl bewegt den Cursor nach oben. Vorherige Zeile wird im Gerät angezeit.
playerListGetList - Befehl zur Navigation in Eingängen wie Net Radio oder Server. Befehl liefert Informationen (Readings) relevant zur Menünavigation.
playerListJumpLine [value] - Befehl zur Navigation in Eingängen wie Net Radio oder Server. Befehl spring zur angegebenen Zeile.
playerListSelectLine [value] - Befehl zur Navigation in Eingängen wie Net Radio oder Server. Befehl aktiviert die angegebenen Zeile. Falls die Zeile das Attribut 'Container' (Ordner) besitzt, wird dieser geöffnet. Falls 'Item' wird die Wiedergabe gestartet.
sleep [off|30min|60min|90min|120min] - Aktiviert/Deaktiviert den internen Sleep-Timer
standbyMode [eco|normal] - Umschaltung des Standby Modus.
statusRequest [<parameter>] - Abfrage des aktuellen Status des Network Players.
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.
timerHour [0...23] - Setzt die Stunde des internen Wake-up Timers
timerMinute [0...59] - Setzt die Minute des internen Wake-up Timers
timerRepeat [once|every] - Setzt den Wiederholungsmodus des internen Wake-up Timers
timerSet - konfiguriert den Timer nach den Vorgaben: timerHour, timerMinute, timerRepeat, timerVolume. (ALLE Paremeter müssen zuvor gesetzt werden. Dieser Befehl schaltet den Timer nicht ein → 'timer on'.)
timerVolume [<VOL_MIN>...<VOL_MAX>] - Setzt die Lautstärke des internen Wake-up Timers
timer [on|off] - Schaltet ein/aus den internen Wake-up Timer. (Bemerkung: Der Timer wird basierend auf den im Gerät gespeicherten Parametern aktiviert. Um diese zu ändern, bitte den 'timerSet' Befehl benutzen.)
tuner [<parameter>] - Tuner-relevante Befehle.
bandDAB - Setzt das Tuner-Band auf DAB (falls verfügbar).
bandFM - Setzt das Tuner-Band auf FM.
tuneUp - Tuner Frequenz +.
tuneDown - Tuner Frquenz -.
presetUp - Tuner Voreinstellung hoch.
presetDown - Tuner Voreinstellung runter.
tunerFMFrequency [87.50 ... 108.00] - Setzt die FM Frequenz. Der Wert muss zwischen 87.50 ... 108.00 liegen und muss den Digitalpunkt beinhalten ('.') mit zwei Nachkommastellen.
tunerPresetDAB [1...30] - Setzt die DAB Voreinstellung.
tunerPresetFM [1...30] - Setzt die FM Voreinstellung.
volume [0...100] - Setzt den Lautstärkepegel in %
volumeStraight [<VOL_MIN>...<VOL_MAX>] - Setzt die absolute Lautstärke wie vom Gerät benutzt und angezeigt. Die Parameter <VOL_MIN> and <VOL_MAX> werden automatisch ermittelt.
volumeUp [<VOL_MIN>...<VOL_MAX>] - Erhöht die Lautstärke um einen absoluten Schritt. Die Parameter <VOL_MIN> and <VOL_MAX> werden automatisch ermittelt.
volumeDown [<VOL_MIN>...<VOL_MAX>] - Reduziert die Lautstärke um einen absoluten Schritt. Die Parameter <VOL_MIN> and <VOL_MAX> werden automatisch ermittelt.
Ein typisches Beispiel ist das Einschalten des Gerätes und das Umschalten auf den Lieblingsradiosender:
Beispieldefinition in der fhem.cfg Konfigurationsdatei:
Bemerkung: Aufgrund der relativ langsamen Befehlsverarbeitung im Network Player im Vergleich zur asynchronen Ethernet-Kommunikation, kann es vorkommen, dass veraltete Statusinformationen zurückgesendet werden.
Aus diesem Grund wird empfohlen, während der Automatisierung zwischen den 'set' und 'get' Befehlen ein Delay einzubauen. Speziell beim Hochfahren des Network Players sollte dies beachtet werden.
Die Funktion kann jetzt in der FHEM Befehlszeile eingegeben oder in die Notify-Definitionen eingebunden werden.
{startMyFavouriteRadioStation()}
Get
get <name> <reading>
Aktuell liefert der Befehl 'get' ausschließlich Reading-Werte (s. Abschnitt "Readings").
Optionales Attribut zum Deaktivieren des internen zyklischen Timers zum Aktualisieren des NP-Status. Manuelles Update ist nach wie vor möglich.
Mögliche Werte: 0 → Zyklisches Update aktiv., 1 → Zyklisches Update inaktiv.
playerListLine_Attribute_1..._8 - Abfrage der Listenzeilenattribute Zeile 1...8 (Container|Item|Unselectable).
playerListMaxLine - Abfrage der Anzahl von Listenzeilen in der aktuellen Liste/Menu.
playerListMenuName - Abfrage der bezeichnung der aktuellen Liste/Menus.
playerListStatus - Abfrage des aktuellen Status der Liste/Menus (Busy|Ready).
Tuner Readings:
Bemerkung: Die folgenden Readings werden mit dem Befehl "statusRequest tunerStatus" aktualisiert.
tunerAudioModeDAB - Abfrage des aktuellen DAB Audio-Modus (Mono|Stereo)..
tunerBand - Abfrage des aktuellen Radio-Bandes (FM|DAB). DAB falls verfügbar.
tunerBitRate - Abfrage der aktuellen DAB Stream Bitrate (kbit/s).
tunerModeDAB - Abfrage des aktuellen DAB Modus (DAB|DAB+).
tunerFrequencyDAB - Abfrage der aktuellen DAB Frequenz. (xxx.xxx MHz)
tunerPresetFM - Abfrage der aktuellen FM Voreinstellung. Falls gespeichtert (1...30).
tunerFrequencyFM - Abfrage der aktuellen FM Frequenz. (xxx.xx MHz)
tunerProgramServiceFM - Abfrage des FM Sendernamen.
tunerRadioTextAFM - Abfrage des Radio Text A des FM Senders.
tunerRadioTextBFM - Abfrage des Radio Text B des FM Senders.
tunerPresetDAB - Abfrage der aktuellen DAB Voreinstellung. Falls gespeichtert (1...30).
tunerServiceLabelDAB - Abfrage des DAB Sendernamen.
tunerChannelLabelDAB - Abfrage des Channel Labels des gewählten DAB Senders.
tunerDLSDAB - Abfrage des 'Dynamic Label Segment' des gewählten DAB Senders.
tunerEnsembleLabelDAB - Abfrage des 'Ensemble Label' des gewählten DAB Senders.
Timer Readings:
Bemerkung: Die folgenden Readings werden mit dem Befehl "statusRequest timerStatus" aktualisiert.
timer - Abfrage des Time Modus (Wecker) (on|off).
timerRepeat - Abfrage des Timer Wiederholungs Modus (once|every).
timerStartTime - Abfrage der Timer Startzeit (HH:MM).
timerVolumeLevel - Abfrage der Timer-Lautstärke.
Bemerkung des Entwicklers
Trivial: Um das Gerät fernbedienen zu können, muss es an das Ethernet-Netzwerk angeschlossen und erreichbar sein.
Das Gerät muss sich im standbyMode "Normal" befinden, um es fergesteuert einzuschalten.
Das Abschalten funktioniert auch standbyMode "Normal" Modus.