diff --git a/fhem/CHANGED b/fhem/CHANGED index 665327bf0..b57be1269 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: Added auto reading update for tuner and player - feature 49_SSCAM: The port in DEF-String is optional now, if not given, default port 5000 is used - bugfix: 98_weekprofile: transfer day settings to other days diff --git a/fhem/FHEM/71_YAMAHA_NP.pm b/fhem/FHEM/71_YAMAHA_NP.pm index 292d7f899..5ddc737cf 100644 --- a/fhem/FHEM/71_YAMAHA_NP.pm +++ b/fhem/FHEM/71_YAMAHA_NP.pm @@ -11,7 +11,7 @@ # NP-S2000, CD-N500, CD-N301, R-N500, R-N301 controlled by the # Yamaha Network Player App. # -# *OS: +# i*S: # https://itunes.apple.com/us/app/network-player-controller-us/id467502483?mt=8 # # Andr*id: @@ -59,7 +59,7 @@ sub YAMAHA_NP_Initialize $hash->{AttrFn} = "YAMAHA_NP_Attr"; $hash->{UndefFn} = "YAMAHA_NP_Undefine"; - $hash->{AttrList} = "do_not_notify:0,1 disable:0,1 request-timeout:1,2,3,4,5 ".$readingFnAttributes; + $hash->{AttrList} = "do_not_notify:0,1 disable:0,1 request-timeout:1,2,3,4,5 auto_update_player_readings:1,0 auto_update_tuner_readings:1,0 ".$readingFnAttributes; return; } @@ -96,7 +96,20 @@ sub YAMAHA_NP_GetStatus return; } - YAMAHA_NP_SendCommand($hash, "GetParam", "statusRequest", "basicStatus"); + YAMAHA_NP_SendCommand($hash, "GetParam", "statusRequest", "basicStatus"); + + if(defined($hash->{READINGS}{input})) + { + if((AttrVal($name, "auto_update_tuner_readings","1") eq "1") and ($hash->{READINGS}{input}{VAL} eq "tuner") and ($hash->{READINGS}{power}{VAL} eq "on")) + { + YAMAHA_NP_SendCommand($hash, "GetParam<\/Play_Info><\/Tuner><\/YAMAHA_AV>", "statusRequest", "tunerStatus"); + } + elsif(AttrVal($name, "auto_update_player_readings", "1") eq "1" and ($hash->{READINGS}{input}{VAL} ne "tuner") and ($hash->{READINGS}{power}{VAL} eq "on")) + { + YAMAHA_NP_SendCommand($hash, "GetParam<\/Play_Info><\/Player><\/YAMAHA_AV>", "statusRequest", "playerStatus"); + } + } + YAMAHA_NP_ResetTimer($hash) unless($local == 1); return; } @@ -884,7 +897,7 @@ sub YAMAHA_NP_SendCommand if($blocking == 1) { Log3 $name, 5, "YAMAHA_NP ($name) - execute blocking \"$cmd".(defined($arg) ? " ".(split("\\|", $arg))[0] : "")."\" on $name: $data"; - + my $param = { url => "http://".$address."/YamahaRemoteControl/ctrl", @@ -1757,7 +1770,12 @@ sub YAMAHA_NP_html2txt
Possible values: 1...5 seconds. Default value is 4 seconds.

  • disable

  • 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.


    +
    Possible values: 0 → perform cyclic status update, 1 → don't perform cyclic status updates.

    +
  • auto_update_player_readings
  • +
    Optional attribute for auto refresh of player related readings. Default is 1.

    +
  • auto_update_tuner_readings
  • +
    Optional attribute for auto refresh of tuner related readings. Default is 1.

    +

    Readings
    @@ -2006,7 +2024,13 @@ sub YAMAHA_NP_html2txt Mögliche Werte: 1...5 Sekunden. Default Wert ist 4 Sekunden.

  • disable

  • 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.


    + Mögliche Werte: 0 → Zyklisches Update aktiv., 1 → Zyklisches Update inaktiv.

    +
  • auto_update_player_readings
  • +
    Optionales Attribut zum automtischen aktualisieren der Player-Readings. Default-Wert ist 1.

    +
  • auto_update_tuner_readings
  • +
    Optionales Attribut zum automtischen aktualisieren der Tuner-Readings. Default-Wert ist 1.
    +

    +
    Readings