Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
vuffiraa72 committed Nov 2, 2024
2 parents 5bda35b + 0f3d4c9 commit 1876b26
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGED
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
2024-08-04 - add set enable / disable
2022-05-17 - check state before renewing registration
2021-04-11 - fix registration renewal
2021-01-14 - fix volume info from headphone
Expand Down
28 changes: 24 additions & 4 deletions FHEM/70_BRAVIA.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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", "");
Expand Down Expand Up @@ -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 = '';

Expand Down Expand Up @@ -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" ) {
Expand All @@ -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;
Expand Down Expand Up @@ -2330,6 +2342,10 @@ sub GetNormalizedName {
Switches a channel back.</li>
<li><a name="channelUp"></a><i>channelUp</i><br>
Switches a channel forward.</li>
<li><a name="enable"></a><i>enable</i><br>
Enables the internal task to pull the status and other information from the TV.</li>
<li><a name="disable"></a><i>disable</i><br>
Disables the internal task to pull the status and other information from the TV.</li>
<li><a name="input"></a><i>input</i><br>
List of input channels.
Imputs are available with models from 2013 and newer.</li>
Expand Down Expand Up @@ -2452,6 +2468,10 @@ sub GetNormalizedName {
Einen Kanal zurück schalten.</li>
<li><a name="channelUp"></a><i>channelUp</i><br>
Einen Kanal weiter schalten.</li>
<li><a name="enable"></a><i>enable</i><br>
Aktiviert den internen Task zum regelmäßigen Abrufen des Status des TV und weiterer Informationen.</li>
<li><a name="disable"></a><i>disable</i><br>
Unterbricht den internen Task zum regelmäßigen Abrufen des Status des TV und weiterer Informationen.</li>
<li><a name="input"></a><i>input</i><br>
Liste der Eingänge.
Eingänge sind ab Modelljahr 2013 verfügbar.</li>
Expand Down
2 changes: 1 addition & 1 deletion controls_BRAVIA.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
UPD 2023-07-16_18:10:54 94193 FHEM/70_BRAVIA.pm
UPD 2024-08-04_13:17:04 95414 FHEM/70_BRAVIA.pm

0 comments on commit 1876b26

Please sign in to comment.