dev #11

Merged
marko merged 8 commits from dev into main 2022-03-31 04:47:00 +00:00
3 changed files with 19 additions and 36 deletions
Showing only changes of commit 4c92240cc5 - Show all commits

View File

@ -368,7 +368,7 @@ __END__
], ],
"release_status": "stable", "release_status": "stable",
"license": "GPL_2", "license": "GPL_2",
"version": "v3.6.2", "version": "v3.6.3",
"author": [ "author": [
"Marko Oldenburg <fhemdevelopment@cooltux.net>" "Marko Oldenburg <fhemdevelopment@cooltux.net>"
], ],

View File

@ -1,2 +1,2 @@
UPD 2022-03-13_11:17:13 18968 FHEM/82_LGTV_WebOS.pm UPD 2022-03-17_11:00:18 18968 FHEM/82_LGTV_WebOS.pm
UPD 2022-03-17_08:40:15 54825 lib/FHEM/Devices/LGTV/LGTVWebOS.pm UPD 2022-03-17_10:59:44 54628 lib/FHEM/Devices/LGTV/LGTVWebOS.pm

View File

@ -736,8 +736,20 @@ sub Read {
$hash->{helper}->{lastResponse} = $hash->{helper}->{lastResponse} =
int( ::gettimeofday() ); # Check Socket KeepAlive int( ::gettimeofday() ); # Check Socket KeepAlive
$len = sysread( $hash->{CD}, $buf, 10240 )
if exists( $hash->{CD} ); try {
$len = sysread( $hash->{CD}, $buf, 10240 );
}
catch {
if ( $_->isa('autodie::exception') && $_->matches(':io') ) {
Log3( $name, 2, "LGTV_WebOS ($name) - can't read from socket: $_" );
return;
}
else {
Log3( $name, 2, "LGTV_WebOS ($name) - can't read from socket: $_" );
return;
}
};
if ( !defined($len) || !$len ) { if ( !defined($len) || !$len ) {
@ -994,8 +1006,6 @@ sub WriteServiceReadings {
my $hash = shift; my $hash = shift;
my $decode_json = shift; my $decode_json = shift;
::readingsBeginUpdate($hash);
for my $services ( @{ $decode_json->{payload}{services} } ) { for my $services ( @{ $decode_json->{payload}{services} } ) {
::readingsBulkUpdateIfChanged( ::readingsBulkUpdateIfChanged(
$hash, $hash,
@ -1004,8 +1014,6 @@ sub WriteServiceReadings {
); );
} }
::readingsEndUpdate( $hash, 1 );
return; return;
} }
@ -1013,8 +1021,6 @@ sub WriteDeviceReadings {
my $hash = shift; my $hash = shift;
my $decode_json = shift; my $decode_json = shift;
::readingsBeginUpdate($hash);
for my $devices ( @{ $decode_json->{payload}{devices} } ) { for my $devices ( @{ $decode_json->{payload}{devices} } ) {
if ( !exists( $hash->{helper}{device}{inputs}{ $devices->{label} } ) if ( !exists( $hash->{helper}{device}{inputs}{ $devices->{label} } )
@ -1035,8 +1041,6 @@ sub WriteDeviceReadings {
); );
} }
::readingsEndUpdate( $hash, 1 );
return; return;
} }
@ -1046,9 +1050,6 @@ sub WriteProgramlistReadings {
require Date::Parse; require Date::Parse;
my $count = 0; my $count = 0;
::readingsBeginUpdate($hash);
for my $programList ( @{ $decode_json->{payload}{programList} } ) { for my $programList ( @{ $decode_json->{payload}{programList} } ) {
if ( if (
@ -1080,8 +1081,6 @@ sub WriteProgramlistReadings {
} }
} }
::readingsEndUpdate( $hash, 1 );
return; return;
} }
@ -1089,8 +1088,6 @@ sub WriteMuteReadings {
my $hash = shift; my $hash = shift;
my $decode_json = shift; my $decode_json = shift;
::readingsBeginUpdate($hash);
if ( if (
exists( $decode_json->{payload}{'mute'} ) exists( $decode_json->{payload}{'mute'} )
&& ( $decode_json->{payload}{'mute'} eq 'true' && ( $decode_json->{payload}{'mute'} eq 'true'
@ -1130,8 +1127,6 @@ sub WriteMuteReadings {
::readingsBulkUpdateIfChanged( $hash, 'mute', 'off' ); ::readingsBulkUpdateIfChanged( $hash, 'mute', 'off' );
} }
::readingsEndUpdate( $hash, 1 );
return; return;
} }
@ -1139,8 +1134,6 @@ sub Write3dReadings {
my $hash = shift; my $hash = shift;
my $decode_json = shift; my $decode_json = shift;
::readingsBeginUpdate($hash);
if ( $decode_json->{payload}{status3D}{status} eq 'false' if ( $decode_json->{payload}{status3D}{status} eq 'false'
|| $decode_json->{payload}{status3D}{status} == 0 ) || $decode_json->{payload}{status3D}{status} == 0 )
{ {
@ -1158,8 +1151,6 @@ sub Write3dReadings {
::readingsBulkUpdateIfChanged( $hash, '3DMode', ::readingsBulkUpdateIfChanged( $hash, '3DMode',
$decode_json->{payload}{status3D}{pattern} ); $decode_json->{payload}{status3D}{pattern} );
::readingsEndUpdate( $hash, 1 );
return; return;
} }
@ -1167,8 +1158,6 @@ sub WriteAppIdReadings {
my $hash = shift; my $hash = shift;
my $decode_json = shift; my $decode_json = shift;
::readingsBeginUpdate($hash);
if ( if (
( (
$decode_json->{payload}{appId} =~ /com.webos.app.externalinput/x $decode_json->{payload}{appId} =~ /com.webos.app.externalinput/x
@ -1196,8 +1185,6 @@ sub WriteAppIdReadings {
::readingsBulkUpdateIfChanged( $hash, 'input', '-' ); ::readingsBulkUpdateIfChanged( $hash, 'input', '-' );
} }
::readingsEndUpdate( $hash, 1 );
return; return;
} }
@ -1207,8 +1194,6 @@ sub WriteTypeReadings {
my $response; my $response;
::readingsBeginUpdate($hash);
if ( $decode_json->{type} eq 'registered' if ( $decode_json->{type} eq 'registered'
&& exists( $decode_json->{payload}{'client-key'} ) ) && exists( $decode_json->{payload}{'client-key'} ) )
{ {
@ -1252,8 +1237,6 @@ sub WriteTypeReadings {
if ( $hash->{helper}{device}{runsetcmd} > 0 ); if ( $hash->{helper}{device}{runsetcmd} > 0 );
} }
::readingsEndUpdate( $hash, 1 );
return $response; return $response;
} }
@ -1265,6 +1248,8 @@ sub WriteReadings {
::Log3( $name, 4, "LGTV_WebOS ($name) - Beginn Readings writing" ); ::Log3( $name, 4, "LGTV_WebOS ($name) - Beginn Readings writing" );
::readingsBeginUpdate($hash);
if ( ref( $decode_json->{payload}{services} ) eq "ARRAY" if ( ref( $decode_json->{payload}{services} ) eq "ARRAY"
&& scalar( @{ $decode_json->{payload}{services} } ) > 0 ) && scalar( @{ $decode_json->{payload}{services} } ) > 0 )
{ {
@ -1293,8 +1278,6 @@ sub WriteReadings {
WriteAppIdReadings( $hash, $decode_json ); WriteAppIdReadings( $hash, $decode_json );
} }
::readingsBeginUpdate($hash);
if ( exists( $decode_json->{type} ) ) { if ( exists( $decode_json->{type} ) ) {
$response = WriteTypeReadings( $hash, $decode_json ); $response = WriteTypeReadings( $hash, $decode_json );
} }