diff --git a/fhem/CHANGED b/fhem/CHANGED index 7089fcd64..eac244adf 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: 70_BRAVIA: add set enable / disable - bugfix: 36_Shelly: bad firmware identification - bugfix: 72_XiaomiDevice: requested fix for crash - change: 76_SolarForecast: attr setupInverterDevXX: new key 'limit', diff --git a/fhem/FHEM/70_BRAVIA.pm b/fhem/FHEM/70_BRAVIA.pm index 728fce456..a26a2195a 100644 --- a/fhem/FHEM/70_BRAVIA.pm +++ b/fhem/FHEM/70_BRAVIA.pm @@ -183,7 +183,7 @@ sub GetStatus { RemoveInternalTimer($hash); InternalTimer( gettimeofday() + $interval, \&GetStatus, $hash, 0 ); - return if ( AttrVal($name, "disable", 0) == 1 ); + return if ( ReadingsVal($name, "mode", "") eq "disabled" or AttrVal($name, "disable", 0) == 1 ); # check device availability if (!$update) { @@ -235,6 +235,7 @@ sub Set { my $inputs = ""; my $apps = ""; my $mutes = "toggle"; + my $mode = ReadingsVal($name, "mode", "enabled"); if ( ReadingsVal($name, "input", "") ne "-" ) { $hash->{helper}{lastInput} = ReadingsVal($name, "input", ""); @@ -308,7 +309,9 @@ sub Set { $usage .= " channel:$channels" if ( $channels ne "" ); $usage .= " openUrl application:" . $apps if ( $apps ne "" ); $usage .= " text" if (ReadingsVal($name, "requestFormat", "") eq "json"); - $usage .= " requestReboot:noArg " if (ReadingsVal($name, "requestFormat", "") eq "json"); + $usage .= " requestReboot:noArg" if (ReadingsVal($name, "requestFormat", "") eq "json"); + $usage .= " enable:noArg " if ( $mode ne "enabled" ); + $usage .= " disable:noArg " if ( $mode eq "enabled" ); my $cmd = ''; @@ -745,9 +748,9 @@ sub Set { # reboot elsif ($a[1] eq "requestReboot") { - Log3($name, 2, "BRAVIA set $name " . $a[1]); + Log3($name, 2, "BRAVIA set $name " . $a[1]); SendCommand( $hash, "requestReboot" ); - } + } # text elsif ( $a[1] eq "text" ) { @@ -760,6 +763,15 @@ sub Set { SendCommand( $hash, "text", $text ); } + # mode: enable / disable + elsif ( $a[1] eq "enable" or $a[1] eq "disable" ) { + Log3($name, 2, "BRAVIA set $name " . $a[1]); + if ( AttrVal($name, "disable", "") ) { + return ("device is deactivated by disable attribute, delete disable attribute first"); + } + readingsSingleUpdate( $hash, 'mode', $a[1] eq "enable" ? "enabled" : "disabled", 1 ); + } + # return usage hint else { return $usage; @@ -2330,6 +2342,10 @@ sub GetNormalizedName { Switches a channel back.
  • channelUp
    Switches a channel forward.
  • +
  • enable
    + Enables the internal task to pull the status and other information from the TV.
  • +
  • disable
    + Disables the internal task to pull the status and other information from the TV.
  • input
    List of input channels. Imputs are available with models from 2013 and newer.
  • @@ -2452,6 +2468,10 @@ sub GetNormalizedName { Einen Kanal zurück schalten.
  • channelUp
    Einen Kanal weiter schalten.
  • +
  • enable
    + Aktiviert den internen Task zum regelmäßigen Abrufen des Status des TV und weiterer Informationen.
  • +
  • disable
    + Unterbricht den internen Task zum regelmäßigen Abrufen des Status des TV und weiterer Informationen.
  • input
    Liste der Eingänge. Eingänge sind ab Modelljahr 2013 verfügbar.