fix pairing Reading problem
This commit is contained in:
		| @@ -67,7 +67,7 @@ use Blocking; | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| my $version = "1.2.0"; | my $version = "2.0.0"; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -292,6 +292,7 @@ sub LGTV_WebOS_Attr(@) { | |||||||
|      |      | ||||||
|     if( $attrName eq "disable" ) { |     if( $attrName eq "disable" ) { | ||||||
|         if( $cmd eq "set" and $attrVal eq "1" ) { |         if( $cmd eq "set" and $attrVal eq "1" ) { | ||||||
|  |             RemoveInternalTimer($hash); | ||||||
|             readingsSingleUpdate ( $hash, "state", "disabled", 1 ); |             readingsSingleUpdate ( $hash, "state", "disabled", 1 ); | ||||||
|             $hash->{PARTIAL} = ''; |             $hash->{PARTIAL} = ''; | ||||||
|             Log3 $name, 3, "LGTV_WebOS ($name) - disabled"; |             Log3 $name, 3, "LGTV_WebOS ($name) - disabled"; | ||||||
| @@ -300,6 +301,7 @@ sub LGTV_WebOS_Attr(@) { | |||||||
|         elsif( $cmd eq "del" ) { |         elsif( $cmd eq "del" ) { | ||||||
|             readingsSingleUpdate ( $hash, "state", "active", 1 ); |             readingsSingleUpdate ( $hash, "state", "active", 1 ); | ||||||
|             Log3 $name, 3, "LGTV_WebOS ($name) - enabled"; |             Log3 $name, 3, "LGTV_WebOS ($name) - enabled"; | ||||||
|  |             LGTV_WebOS_TimerStatusRequest($hash); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|      |      | ||||||
| @@ -892,33 +894,33 @@ sub LGTV_WebOS_WriteReadings($$) { | |||||||
|      |      | ||||||
|     elsif( defined($decode_json->{payload}{'mute'}) or defined($decode_json->{payload}{'muted'})) { |     elsif( defined($decode_json->{payload}{'mute'}) or defined($decode_json->{payload}{'muted'})) { | ||||||
|      |      | ||||||
|         if( defined($decode_json->{payload}{'mute'}) and $decode_json->{payload}{'mute'} eq 'true' ) { |         if( defined($decode_json->{payload}{'mute'}) and ($decode_json->{payload}{'mute'} eq 'true' or $decode_json->{payload}{'mute'} == 1 ) ) { | ||||||
|      |      | ||||||
|             readingsBulkUpdate($hash,'mute','on'); |             readingsBulkUpdate($hash,'mute','on'); | ||||||
|              |              | ||||||
|         } elsif( defined($decode_json->{payload}{'mute'}) ) { |         } elsif( defined($decode_json->{payload}{'mute'}) ) { | ||||||
|             if( $decode_json->{payload}{'mute'} eq 'false' ) { |             if( $decode_json->{payload}{'mute'} eq 'false' or $decode_json->{payload}{'mute'} == 0 ) { | ||||||
|          |          | ||||||
|                 readingsBulkUpdate($hash,'mute','off'); |                 readingsBulkUpdate($hash,'mute','off'); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         if( defined($decode_json->{payload}{'muted'}) and $decode_json->{payload}{'muted'} eq 'true' ) { |         if( defined($decode_json->{payload}{'muted'}) and ($decode_json->{payload}{'muted'} eq 'true' or $decode_json->{payload}{'muted'} == 1) ) { | ||||||
|          |          | ||||||
|                 readingsBulkUpdate($hash,'mute','on'); |                 readingsBulkUpdate($hash,'mute','on'); | ||||||
|              |              | ||||||
|         } elsif( defined($decode_json->{payload}{'muted'}) and $decode_json->{payload}{'muted'} eq 'false' ) { |         } elsif( defined($decode_json->{payload}{'muted'}) and ($decode_json->{payload}{'muted'} eq 'false' or $decode_json->{payload}{'muted'} == 0) ) { | ||||||
|          |          | ||||||
|             readingsBulkUpdate($hash,'mute','off'); |             readingsBulkUpdate($hash,'mute','off'); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     elsif( defined($decode_json->{payload}{status3D}{status}) ) { |     elsif( defined($decode_json->{payload}{status3D}{status}) ) { | ||||||
|         if( $decode_json->{payload}{status3D}{status} eq 'false' ) { |         if( $decode_json->{payload}{status3D}{status} eq 'false' or $decode_json->{payload}{status3D}{status} == 0 ) { | ||||||
|          |          | ||||||
|             readingsBulkUpdate($hash,'3D','off'); |             readingsBulkUpdate($hash,'3D','off'); | ||||||
|          |          | ||||||
|         } elsif( $decode_json->{payload}{status3D}{status} eq 'true' ) { |         } elsif( $decode_json->{payload}{status3D}{status} eq 'true' or $decode_json->{payload}{status3D}{status} == 1 ) { | ||||||
|          |          | ||||||
|             readingsBulkUpdate($hash,'3D','on'); |             readingsBulkUpdate($hash,'3D','on'); | ||||||
|         } |         } | ||||||
| @@ -946,7 +948,7 @@ sub LGTV_WebOS_WriteReadings($$) { | |||||||
|          |          | ||||||
|             $hash->{helper}{device}{registered}     = 1; |             $hash->{helper}{device}{registered}     = 1; | ||||||
|          |          | ||||||
|         } elsif( ($decode_json->{type} eq 'response' and $decode_json->{payload}{returnValue} eq 'true') or ($decode_json->{type} eq 'registered') and defined($decode_json->{payload}{'client-key'}) ) { |         } elsif( ($decode_json->{type} eq 'response' and ($decode_json->{payload}{returnValue} eq 'true' or $decode_json->{payload}{returnValue} == 1 )) or ($decode_json->{type} eq 'registered') and defined($decode_json->{payload}{'client-key'}) ) { | ||||||
|          |          | ||||||
|             $response = 'ok'; |             $response = 'ok'; | ||||||
|             readingsBulkUpdate($hash,'pairing','paired'); |             readingsBulkUpdate($hash,'pairing','paired'); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user