From 70f52fc44818154572a57357d50ec53efd8deeca Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Sat, 11 Feb 2017 16:09:17 +0100 Subject: [PATCH] fix more Errors in JSON String --- 82_LGTV_WebOS.pm | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/82_LGTV_WebOS.pm b/82_LGTV_WebOS.pm index 147bfa4..b9fa8ef 100644 --- a/82_LGTV_WebOS.pm +++ b/82_LGTV_WebOS.pm @@ -50,7 +50,7 @@ use JSON qw(decode_json encode_json); -my $version = "0.0.49"; +my $version = "0.0.50"; @@ -300,11 +300,11 @@ sub LGTV_WebOS_TimerStatusRequest($) { Log3 $name, 4, "LGTV_WebOS ($name) - run get functions"; - InternalTimer( gettimeofday()+1, 'LGTV_WebOS_GetAudioStatus', $hash, 0 ); - InternalTimer( gettimeofday()+2, 'LGTV_WebOS_GetCurrentChannel', $hash, 0 ) if(ReadingsVal($name,'launchApp', 'none') eq 'com.webos.app.livetv'); - InternalTimer( gettimeofday()+3, 'LGTV_WebOS_GetForgroundAppInfo', $hash, 0 ); - InternalTimer( gettimeofday()+4, 'LGTV_WebOS_Get3DStatus', $hash, 0 ); - ##InternalTimer( gettimeofday()+4, 'LGTV_WebOS_GetExternalInputList', $hash, 0 ); + LGTV_WebOS_GetAudioStatus($hash); + InternalTimer( gettimeofday()+2, 'LGTV_WebOS_GetCurrentChannel', $hash, 0 ) if(ReadingsVal($name,'launchApp', 'none') eq 'com.webos.app.livetv' or ReadingsVal($name,'launchApp', 'none') eq 'none'); + InternalTimer( gettimeofday()+4, 'LGTV_WebOS_GetForgroundAppInfo', $hash, 0 ); + InternalTimer( gettimeofday()+6, 'LGTV_WebOS_Get3DStatus', $hash, 0 ); + ##InternalTimer( gettimeofday()+8, 'LGTV_WebOS_GetExternalInputList', $hash, 0 ); } elsif( IsDisabled($name) ) { readingsSingleUpdate ( $hash, "state", "disabled", 1 ); @@ -611,17 +611,6 @@ sub LGTV_WebOS_ProcessRead($$) { Log3 $name, 5, "LGTV_WebOS ($name) - Decoding JSON message. Length: " . length($json) . " Content: " . $json; - my $obj = decode_json($json); - if(defined($obj->{type})) { - - Log3 $name, 4, "LGTV_WebOS ($name) - no type in object, json error"; - return $json; - - } elsif(defined($obj->{error})) { - - Log3 $name, 4, "LGTV_WebOS ($name) - Received error message: " . $json; - } - ($json,$tail) = LGTV_WebOS_ParseMsg($hash, $tail); }