From ade45510ac4ee91df053d91116d892468d7e0317 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 8 Aug 2022 20:59:57 +0200 Subject: [PATCH] [fix] - checkmethode delete reading if ist = soll --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 8 +++++--- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGED b/CHANGED index 5b8f37a..3e6c01a 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - cast all propertie as string - fixed bulkupdateifchanged + [fix] - removed "valveid" from reading diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 5f209bf..ce17c8b 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -859,8 +859,8 @@ sub WriteReadings { use Data::Dumper; foreach my $dev_schedules ( sort keys %{ $hash->{READINGS} } ) { my $dev_reading = ReadingsVal( $name, $dev_schedules, "error" ); - push @ist, $dev_reading if $dev_schedules =~ /.*_id/; # push reading _id - push @ist, $1 if $dev_schedules =~ /.*_(\d)_id/; # push readigs d from x_id + push @ist, $dev_reading if $dev_schedules =~ /schedule.*_id/; # push reading _id + push @ist, $1 if $dev_schedules =~ /schedule.*_(\d)_id/; # push readigs d from x_id Log3 $name, 5, "[DEBUG] $name - Key ist : $dev_schedules "; Log3 $name, 5, "[DDDDD] $name - ID FOUND $dev_reading" if $dev_schedules =~ /.*_id/; # cloud hat SOLL @@ -892,7 +892,9 @@ use Data::Dumper; } } Log3 $name, 5, "[REST] ". Dumper(@ist); - if (scalar(@ist) > 0){ + # delete only if count soll != count ist. cos the will be overwritten + if (scalar(@ist) > 0 + && scalar(@soll) != scalar(@ist/2) ){ while (my $old_schedule_id = shift(@ist)) { if (length($old_schedule_id) == 1) { foreach (keys %{$hash->{READINGS}}) { diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 9b94dbc..a015f49 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-08_20:47:00 107717 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-08_20:59:37 107858 FHEM/74_GardenaSmartDevice.pm