From 2e481dc0909a4c62c2589857bc494bea6dd9b437 Mon Sep 17 00:00:00 2001 From: viegener <> Date: Mon, 3 Aug 2020 13:21:58 +0000 Subject: [PATCH] 48_BlinkCamera: Correction for JSON values on enabled - true/false 1/0 git-svn-id: https://svn.fhem.de/fhem/trunk@22530 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/48_BlinkCamera.pm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/fhem/FHEM/48_BlinkCamera.pm b/fhem/FHEM/48_BlinkCamera.pm index 7eac355dd..2d6f2ba3c 100644 --- a/fhem/FHEM/48_BlinkCamera.pm +++ b/fhem/FHEM/48_BlinkCamera.pm @@ -58,11 +58,10 @@ # New default 1 for homescreenv3 - old apis deactivated # Disclaimer for API changes # Corrected handling of prefered network attribute - # Adapt active handling to new format # Add new reading Enabled per camera with doc - showing enabled value -# +# Correction for JSON values - true/false 1/0 # # # @@ -1459,8 +1458,11 @@ sub BlinkCamera_ParseHomescreen($$$) foreach my $device ( @$camList ) { if ( $device->{network_id} eq $network ) { my $active = "disabled"; - $active = "armed" if ( $device->{enabled} eq "true" ); + if ( defined( $device->{enabled} ) ) { + $active = "armed" if ( $device->{enabled} == 1 ); + $active = "armed" if ( $device->{enabled} eq "true" ); # $active = "armed" if ( $device->{enabled} ); + } $readUpdates->{"networkCamera".$device->{id}} = $device->{name}.":".$active; $readUpdates->{"networkCamera".$device->{id}."Name"} = $device->{name}; @@ -1507,8 +1509,11 @@ sub BlinkCamera_ParseHomescreen($$$) foreach my $device ( @$owlList ) { if ( $device->{network_id} eq $network ) { my $active = "disabled"; - $active = "armed" if ( $device->{enabled} eq "true" ); -# $active = "armed" if ( $device->{enabled} ); + if ( defined( $device->{enabled} ) ) { + $active = "armed" if ( $device->{enabled} == 1 ); + $active = "armed" if ( $device->{enabled} eq "true" ); +# $active = "armed" if ( $device->{enabled} ); + } $readUpdates->{"networkCamera".$device->{id}} = $device->{name}.":".$active; $readUpdates->{"networkCamera".$device->{id}."Name"} = $device->{name};