dev #11

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

View File

@ -1,2 +1,2 @@
UPD 2022-03-13_11:17:13 18968 FHEM/82_LGTV_WebOS.pm UPD 2022-03-13_11:17:13 18968 FHEM/82_LGTV_WebOS.pm
UPD 2022-03-17_08:25:38 54313 lib/FHEM/Devices/LGTV/LGTVWebOS.pm UPD 2022-03-17_08:40:15 54825 lib/FHEM/Devices/LGTV/LGTVWebOS.pm

View File

@ -994,6 +994,8 @@ 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,
@ -1002,6 +1004,8 @@ sub WriteServiceReadings {
); );
} }
::readingsEndUpdate( $hash, 1 );
return; return;
} }
@ -1009,6 +1013,8 @@ 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} } )
@ -1029,6 +1035,8 @@ sub WriteDeviceReadings {
); );
} }
::readingsEndUpdate( $hash, 1 );
return; return;
} }
@ -1038,6 +1046,9 @@ 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 (
@ -1069,6 +1080,8 @@ sub WriteProgramlistReadings {
} }
} }
::readingsEndUpdate( $hash, 1 );
return; return;
} }
@ -1076,6 +1089,8 @@ 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'
@ -1115,6 +1130,8 @@ sub WriteMuteReadings {
::readingsBulkUpdateIfChanged( $hash, 'mute', 'off' ); ::readingsBulkUpdateIfChanged( $hash, 'mute', 'off' );
} }
::readingsEndUpdate( $hash, 1 );
return; return;
} }
@ -1122,6 +1139,8 @@ 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 )
{ {
@ -1139,6 +1158,8 @@ sub Write3dReadings {
::readingsBulkUpdateIfChanged( $hash, '3DMode', ::readingsBulkUpdateIfChanged( $hash, '3DMode',
$decode_json->{payload}{status3D}{pattern} ); $decode_json->{payload}{status3D}{pattern} );
::readingsEndUpdate( $hash, 1 );
return; return;
} }
@ -1146,6 +1167,8 @@ 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
@ -1173,6 +1196,8 @@ sub WriteAppIdReadings {
::readingsBulkUpdateIfChanged( $hash, 'input', '-' ); ::readingsBulkUpdateIfChanged( $hash, 'input', '-' );
} }
::readingsEndUpdate( $hash, 1 );
return; return;
} }
@ -1182,6 +1207,8 @@ 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'} ) )
{ {
@ -1225,6 +1252,8 @@ sub WriteTypeReadings {
if ( $hash->{helper}{device}{runsetcmd} > 0 ); if ( $hash->{helper}{device}{runsetcmd} > 0 );
} }
::readingsEndUpdate( $hash, 1 );
return $response; return $response;
} }
@ -1236,8 +1265,6 @@ 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 )
{ {
@ -1266,6 +1293,8 @@ 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 );
} }