From 6b87b19f0db67d67b6bc79c257d0634ea4823a60 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 14 Apr 2022 16:42:18 +0200 Subject: [PATCH 01/88] add valve_name and paused_untel for schedule --- FHEM/74_GardenaSmartDevice.pm | 41 +++++++++++++++++++++++---------- controls_GardenaSmartDevice.txt | 2 +- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index fac69b5..f7206d4 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -777,9 +777,25 @@ sub WriteReadings { readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_paused_until', $decode_json->{settings}[$settings]{value} ); } + ##### + #ic24 schedules pause until + if ($decode_json->{settings}[$settings]{name} =~ /schedules_paused_until_?\d?$/) { + #my $ventil = substr($decode_json->{settings}[$settings]{name}, -1); # => 1 - 6 + readingsBulkUpdateIfChanged( $hash, 'scheduling-'.$decode_json->{settings}[$settings]{name}, + $decode_json->{settings}[$settings]{value} ); + } + if ($decode_json->{settings}[$settings]{name} eq 'valve_names' + && ref( $decode_json->{settings}[$settings]{value} ) eq "ARRAY" ) { + #_name_1 = + my @valves = @{$decode_json->{settings}[$settings]{value}}; + foreach my $valve( @valves ) { + readingsBulkUpdateIfChanged( $hash, 'valve-valve_name_'.$valve->{"id"}, + $valve->{"name"} ); + } + } + ###### # save winter mode as reading - if ( $decode_json->{settings}[$settings]{name} eq 'winter_mode' ) { readingsBulkUpdateIfChanged( $hash, 'winter_mode', $decode_json->{settings}[$settings]{value} ); @@ -848,6 +864,18 @@ sub setState { : 'offline' ) if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' ); + # ic24 + readingsBulkUpdate( + $hash, 'state', + 'scheduled watering next start: ' + . ( + ReadingsVal( + $name, 'scheduling-scheduled_watering_next_start', + 'no timer' + ) + ) + ) if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ); + #online state water control # zeitplan -> dauert pausiert wenn 2038-01-18T00:00:00.000Z @@ -926,17 +954,6 @@ sub setState { $online_state eq 'online' ? RigReadingsValue( $hash, $state_string) : RigReadingsValue( $hash, 'offline') ); } - readingsBulkUpdate( - $hash, 'state', - 'scheduled watering next start: ' - . ( - ReadingsVal( - $name, 'scheduling-scheduled_watering_next_start', - 'no timer' - ) - ) - ) if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ); - readingsBulkUpdate( $hash, 'state', ReadingsVal( $name, 'power-power_timer', 'no info from power-timer' ) ) if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' ); diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 3810d2c..1b22647 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-03-29_13:42:09 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-04-12_08:40:29 61278 FHEM/74_GardenaSmartDevice.pm +UPD 2022-04-14_16:41:41 62247 FHEM/74_GardenaSmartDevice.pm From d61e06e0e9ec47dcd6db4a7d668b36280cdf1e42 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 17 Apr 2022 15:44:05 +0200 Subject: [PATCH 02/88] debug lines --- FHEM/74_GardenaSmartDevice.pm | 10 ++++++++-- controls_GardenaSmartDevice.txt | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index f7206d4..3ebf59b 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -784,11 +784,17 @@ sub WriteReadings { readingsBulkUpdateIfChanged( $hash, 'scheduling-'.$decode_json->{settings}[$settings]{name}, $decode_json->{settings}[$settings]{value} ); } + if ($decode_json->{settings}[$settings]{name} eq 'valve_names') + Log3, $name, 3, "[DEBUG] - GardenaSmartDevice ($name) - ".ref( $decode_json->{settings}[$settings]{value} ) ; + if ($decode_json->{settings}[$settings]{name} eq 'valve_names' - && ref( $decode_json->{settings}[$settings]{value} ) eq "ARRAY" ) { + && ref( $decode_json->{settings}[$settings]{value} ) eq "ARRAY" ) { # or HASH ? #_name_1 = + Log3, $name, 3, "GardenaSmartDevice ($name) valve_names "; my @valves = @{$decode_json->{settings}[$settings]{value}}; foreach my $valve( @valves ) { + Log3, $name, 3, "GardenaSmartDevice ($name) valve_name $valve->{'name'}"; + readingsBulkUpdateIfChanged( $hash, 'valve-valve_name_'.$valve->{"id"}, $valve->{"name"} ); } @@ -1552,7 +1558,7 @@ sub SetPredefinedStartPoints { ], "release_status": "stable", "license": "GPL_2", - "version": "v2.4.3", + "version": "v2.4.4", "author": [ "Marko Oldenburg " ], diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 1b22647..992a017 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-03-29_13:42:09 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-04-14_16:41:41 62247 FHEM/74_GardenaSmartDevice.pm +UPD 2022-04-17_15:43:51 62628 FHEM/74_GardenaSmartDevice.pm From 29869e9b08146b619a3aecab14623c67f7eb9dee Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 18 Apr 2022 18:52:58 +0200 Subject: [PATCH 03/88] simple quick try --- FHEM/74_GardenaSmartDevice.pm | 46 +++++++++++++++++++++++++++++++++ controls_GardenaSmartDevice.txt | 2 +- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 3ebf59b..a373e18 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -882,6 +882,52 @@ sub setState { ) ) if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ); + +# . Bewässerung aktiv. Zeitpläne aktiv (oder hier immerhin: Nächster Zeitplan: ...) +# ... Bewässerung aktiv. Zeitpläne dauerhaft pausiert. +# ... geschlossen. Zeitpläne aktiv (bzw. s.o.) +# ... geschlossen. Zeitpläne dauerhaft pausiert. +# ... offline + my $activ_watering = 0; + if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ){ + $activ_watering = 1 if ( ReadingsVal( $name, 'watering-watering_timer_1_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) + $activ_watering = 2 if ( ReadingsVal( $name, 'watering-watering_timer_2_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) + $activ_watering = 3 if ( ReadingsVal( $name, 'watering-watering_timer_3_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) + $activ_watering = 4 if ( ReadingsVal( $name, 'watering-watering_timer_4_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) + $activ_watering = 5 if ( ReadingsVal( $name, 'watering-watering_timer_5_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) + $activ_watering = 6 if ( ReadingsVal( $name, 'watering-watering_timer_6_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) + + my $state_string = $activ_watering > 0 + # offen + ? + ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering, '' ) eq '' ) + # leer ( zeitplan aktiv ... ) + ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash, 'next watering: %s')), (ReadingsVal( $name, 'watering-watering_timer_'.$activ_watering.'_duration', 0 )/60), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '')) ) + # zeitplan pausiert + : + ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '') eq '2038-01-18T00:00:00.000Z') + # pause bis dauerhaft + ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash , 'schedule permanently paused')), (ReadingsVal( $name, 'watering-watering_timer_'.$activ_watering.'_duration', 0 )/60) ) + # naechter termin + : sprintf( RigReadingsValue($hash , 'paused until %s'), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '')) ) + # zu + : + ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '' ) eq '' ) + # zeitplan aktiv + ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash, 'next watering: %s')), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '') ) ) + # zeitplan pausiert + : RigReadingsValue($hash, 'closed') + ; + + + # if ($activ_watering > 0) + # { + # # ein ventil offen + # my $state_string = "ein ventil offen" + + # } + + } #online state water control # zeitplan -> dauert pausiert wenn 2038-01-18T00:00:00.000Z diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 992a017..a2c72ac 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-03-29_13:42:09 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-04-17_15:43:51 62628 FHEM/74_GardenaSmartDevice.pm +UPD 2022-04-18_18:50:37 65576 FHEM/74_GardenaSmartDevice.pm From b197fbd0829f90da463af1c51443b44b41515826 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 18 Apr 2022 19:01:33 +0200 Subject: [PATCH 04/88] simple quick code --- CHANGED | 1 + FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 CHANGED diff --git a/CHANGED b/CHANGED new file mode 100644 index 0000000..8a79ae6 --- /dev/null +++ b/CHANGED @@ -0,0 +1 @@ + simple quick try diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index a373e18..c98f9fb 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -883,7 +883,7 @@ sub setState { ) if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ); -# . Bewässerung aktiv. Zeitpläne aktiv (oder hier immerhin: Nächster Zeitplan: ...) +# ... Bewässerung aktiv. Zeitpläne aktiv (oder hier immerhin: Nächster Zeitplan: ...) # ... Bewässerung aktiv. Zeitpläne dauerhaft pausiert. # ... geschlossen. Zeitpläne aktiv (bzw. s.o.) # ... geschlossen. Zeitpläne dauerhaft pausiert. diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index a2c72ac..6ed64cf 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-03-29_13:42:09 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-04-18_18:50:37 65576 FHEM/74_GardenaSmartDevice.pm +UPD 2022-04-18_19:01:22 65578 FHEM/74_GardenaSmartDevice.pm From 83b9a4347c08701eb7a011202e9840ef8e40cc52 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 18 Apr 2022 19:08:28 +0200 Subject: [PATCH 05/88] fix code --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 6 +++--- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGED b/CHANGED index 8a79ae6..bb1dd7e 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - simple quick try + simple quick code diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index c98f9fb..429b42f 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -785,15 +785,15 @@ sub WriteReadings { $decode_json->{settings}[$settings]{value} ); } if ($decode_json->{settings}[$settings]{name} eq 'valve_names') - Log3, $name, 3, "[DEBUG] - GardenaSmartDevice ($name) - ".ref( $decode_json->{settings}[$settings]{value} ) ; + Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) - ".ref( $decode_json->{settings}[$settings]{value} ) ; if ($decode_json->{settings}[$settings]{name} eq 'valve_names' && ref( $decode_json->{settings}[$settings]{value} ) eq "ARRAY" ) { # or HASH ? #_name_1 = - Log3, $name, 3, "GardenaSmartDevice ($name) valve_names "; + Log3 $name, 3, "GardenaSmartDevice ($name) valve_names "; my @valves = @{$decode_json->{settings}[$settings]{value}}; foreach my $valve( @valves ) { - Log3, $name, 3, "GardenaSmartDevice ($name) valve_name $valve->{'name'}"; + Log3 $name, 3, "GardenaSmartDevice ($name) valve_name $valve->{'name'}"; readingsBulkUpdateIfChanged( $hash, 'valve-valve_name_'.$valve->{"id"}, $valve->{"name"} ); diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 6ed64cf..b7f59df 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-03-29_13:42:09 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-04-18_19:01:22 65578 FHEM/74_GardenaSmartDevice.pm +UPD 2022-04-18_19:08:20 65575 FHEM/74_GardenaSmartDevice.pm From 8d03f20b576abaed82a2a1cc5932a5bb3ac5ba30 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 18 Apr 2022 19:16:20 +0200 Subject: [PATCH 06/88] fix --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 17 +++++++++-------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGED b/CHANGED index bb1dd7e..abedab2 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - simple quick code + fix code diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 429b42f..87fa29f 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -784,8 +784,9 @@ sub WriteReadings { readingsBulkUpdateIfChanged( $hash, 'scheduling-'.$decode_json->{settings}[$settings]{name}, $decode_json->{settings}[$settings]{value} ); } - if ($decode_json->{settings}[$settings]{name} eq 'valve_names') - Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) - ".ref( $decode_json->{settings}[$settings]{value} ) ; + if ($decode_json->{settings}[$settings]{name} eq 'valve_names') { + Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) - ".ref( $decode_json->{settings}[$settings]{value} ); + } if ($decode_json->{settings}[$settings]{name} eq 'valve_names' && ref( $decode_json->{settings}[$settings]{value} ) eq "ARRAY" ) { # or HASH ? @@ -890,12 +891,12 @@ sub setState { # ... offline my $activ_watering = 0; if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ){ - $activ_watering = 1 if ( ReadingsVal( $name, 'watering-watering_timer_1_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) - $activ_watering = 2 if ( ReadingsVal( $name, 'watering-watering_timer_2_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) - $activ_watering = 3 if ( ReadingsVal( $name, 'watering-watering_timer_3_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) - $activ_watering = 4 if ( ReadingsVal( $name, 'watering-watering_timer_4_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) - $activ_watering = 5 if ( ReadingsVal( $name, 'watering-watering_timer_5_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) - $activ_watering = 6 if ( ReadingsVal( $name, 'watering-watering_timer_6_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) + $activ_watering = 1 if ( ReadingsVal( $name, 'watering-watering_timer_1_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); + $activ_watering = 2 if ( ReadingsVal( $name, 'watering-watering_timer_2_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); + $activ_watering = 3 if ( ReadingsVal( $name, 'watering-watering_timer_3_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); + $activ_watering = 4 if ( ReadingsVal( $name, 'watering-watering_timer_4_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); + $activ_watering = 5 if ( ReadingsVal( $name, 'watering-watering_timer_5_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); + $activ_watering = 6 if ( ReadingsVal( $name, 'watering-watering_timer_6_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); my $state_string = $activ_watering > 0 # offen diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index b7f59df..db26b43 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-03-29_13:42:09 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-04-18_19:08:20 65575 FHEM/74_GardenaSmartDevice.pm +UPD 2022-04-18_19:16:13 65595 FHEM/74_GardenaSmartDevice.pm From 78e9906e6b2f42694c0c4484a87032572320df1a Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 28 Apr 2022 20:17:22 +0200 Subject: [PATCH 07/88] fix debug --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 32 ++++++++++++++++---------------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/CHANGED b/CHANGED index abedab2..e4fe25a 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - fix code + fix diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 87fa29f..aa7d131 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -784,22 +784,6 @@ sub WriteReadings { readingsBulkUpdateIfChanged( $hash, 'scheduling-'.$decode_json->{settings}[$settings]{name}, $decode_json->{settings}[$settings]{value} ); } - if ($decode_json->{settings}[$settings]{name} eq 'valve_names') { - Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) - ".ref( $decode_json->{settings}[$settings]{value} ); - } - - if ($decode_json->{settings}[$settings]{name} eq 'valve_names' - && ref( $decode_json->{settings}[$settings]{value} ) eq "ARRAY" ) { # or HASH ? - #_name_1 = - Log3 $name, 3, "GardenaSmartDevice ($name) valve_names "; - my @valves = @{$decode_json->{settings}[$settings]{value}}; - foreach my $valve( @valves ) { - Log3 $name, 3, "GardenaSmartDevice ($name) valve_name $valve->{'name'}"; - - readingsBulkUpdateIfChanged( $hash, 'valve-valve_name_'.$valve->{"id"}, - $valve->{"name"} ); - } - } ###### # save winter mode as reading @@ -811,6 +795,22 @@ sub WriteReadings { } } + if ($decode_json->{settings}[$settings]{name} eq 'valve_names') { + Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) - ".ref( $decode_json->{settings}[$settings]{value} ); + } + + if ($decode_json->{settings}[$settings]{name} eq 'valve_names' + && ref( $decode_json->{settings}[$settings]{value} ) eq "ARRAY" ) { # or HASH ? + #_name_1 = + Log3 $name, 3, "GardenaSmartDevice ($name) valve_names "; + my @valves = @{$decode_json->{settings}[$settings]{value}}; + foreach my $valve( @valves ) { + Log3 $name, 3, "GardenaSmartDevice ($name) valve_name $valve->{'name'}"; + readingsBulkUpdateIfChanged( $hash, 'valve-valve_name_'.$valve->{"id"}, + $valve->{"name"} ); + } + } + if ( ref( $decode_json->{settings}[$settings]{value} ) eq "ARRAY" && $decode_json->{settings}[$settings]{name} eq 'starting_points' ) { diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index db26b43..d666fd7 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-03-29_13:42:09 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-04-18_19:16:13 65595 FHEM/74_GardenaSmartDevice.pm +UPD 2022-04-28_20:17:10 65550 FHEM/74_GardenaSmartDevice.pm From bfbf2cced419ddd88fd674acf1526b1b410565a5 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 28 Apr 2022 20:21:44 +0200 Subject: [PATCH 08/88] add second debug line for state --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 ++ controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGED b/CHANGED index e4fe25a..d5dde96 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - fix + fix debug diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index aa7d131..43dde5c 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -897,6 +897,8 @@ sub setState { $activ_watering = 4 if ( ReadingsVal( $name, 'watering-watering_timer_4_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); $activ_watering = 5 if ( ReadingsVal( $name, 'watering-watering_timer_5_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); $activ_watering = 6 if ( ReadingsVal( $name, 'watering-watering_timer_6_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); + Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) - wasser timer: $activ_watering"; + ### eventuell auf binare bits und shiften my $state_string = $activ_watering > 0 # offen diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index d666fd7..817f95c 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-03-29_13:42:09 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-04-28_20:17:10 65550 FHEM/74_GardenaSmartDevice.pm +UPD 2022-04-28_20:21:31 65693 FHEM/74_GardenaSmartDevice.pm From a1fad78c3bd67a82f238beca66c01a214e008045 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 1 May 2022 09:37:52 +0200 Subject: [PATCH 09/88] change debug stuff --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 8 +------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/CHANGED b/CHANGED index d5dde96..727060d 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - fix debug + add second debug line for state diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 43dde5c..572deb9 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -795,17 +795,11 @@ sub WriteReadings { } } - if ($decode_json->{settings}[$settings]{name} eq 'valve_names') { - Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) - ".ref( $decode_json->{settings}[$settings]{value} ); - } - if ($decode_json->{settings}[$settings]{name} eq 'valve_names' && ref( $decode_json->{settings}[$settings]{value} ) eq "ARRAY" ) { # or HASH ? - #_name_1 = - Log3 $name, 3, "GardenaSmartDevice ($name) valve_names "; my @valves = @{$decode_json->{settings}[$settings]{value}}; foreach my $valve( @valves ) { - Log3 $name, 3, "GardenaSmartDevice ($name) valve_name $valve->{'name'}"; + Log3 $name, 4 "GardenaSmartDevice ($name) valve_name $valve->{'name'}"; readingsBulkUpdateIfChanged( $hash, 'valve-valve_name_'.$valve->{"id"}, $valve->{"name"} ); } diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 817f95c..f6d8db4 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-03-29_13:42:09 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-04-28_20:21:31 65693 FHEM/74_GardenaSmartDevice.pm +UPD 2022-05-01_09:36:37 65391 FHEM/74_GardenaSmartDevice.pm From 4860b7e0ee259991019490f3a2c8ff623bd446e5 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 3 May 2022 21:37:41 +0200 Subject: [PATCH 10/88] fix log line --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGED b/CHANGED index 727060d..bbc5983 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - add second debug line for state + change debug stuff diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 572deb9..6258f31 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -799,7 +799,7 @@ sub WriteReadings { && ref( $decode_json->{settings}[$settings]{value} ) eq "ARRAY" ) { # or HASH ? my @valves = @{$decode_json->{settings}[$settings]{value}}; foreach my $valve( @valves ) { - Log3 $name, 4 "GardenaSmartDevice ($name) valve_name $valve->{'name'}"; + Log3 $name, 4, "GardenaSmartDevice ($name) valve_name $valve->{'name'}"; readingsBulkUpdateIfChanged( $hash, 'valve-valve_name_'.$valve->{"id"}, $valve->{"name"} ); } diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index f6d8db4..fc026a8 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-03-29_13:42:09 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-05-01_09:36:37 65391 FHEM/74_GardenaSmartDevice.pm +UPD 2022-05-03_21:36:59 49520 FHEM/73_GardenaSmartBridge.pm +UPD 2022-05-03_21:37:30 65392 FHEM/74_GardenaSmartDevice.pm From b4f5cef0614c225344cb462feebc7a70b6ed2aa7 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 5 May 2022 09:20:56 +0200 Subject: [PATCH 11/88] debug ausgabe --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 24 ++++++++++++++++-------- controls_GardenaSmartDevice.txt | 4 ++-- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/CHANGED b/CHANGED index bbc5983..25c2fd6 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - change debug stuff + fix log line diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 6258f31..8a6e096 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -885,14 +885,22 @@ sub setState { # ... offline my $activ_watering = 0; if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ){ - $activ_watering = 1 if ( ReadingsVal( $name, 'watering-watering_timer_1_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); - $activ_watering = 2 if ( ReadingsVal( $name, 'watering-watering_timer_2_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); - $activ_watering = 3 if ( ReadingsVal( $name, 'watering-watering_timer_3_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); - $activ_watering = 4 if ( ReadingsVal( $name, 'watering-watering_timer_4_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); - $activ_watering = 5 if ( ReadingsVal( $name, 'watering-watering_timer_5_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); - $activ_watering = 6 if ( ReadingsVal( $name, 'watering-watering_timer_6_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); - Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) - wasser timer: $activ_watering"; - ### eventuell auf binare bits und shiften + my $opened_ventils = 0; + ## clac bit wise 1 - 6 dec => 1 - 63 dec ( 0011 1111 ) + for (my $i = 1; $i < 7; $i++){ + my $zahl = ( ReadingsVal( $name, "watering-watering_timer_'.$i.'_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? ($i -1) : 0; + $opened_ventils=$opened_ventils+(2**$zahl) if ( $zahl > 0 ); + Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) - wasser timer($i) =-1 ( $zahl ) : $opened_ventils"; + } + + # $activ_watering = 1 if ( ReadingsVal( $name, 'watering-watering_timer_1_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); + # $activ_watering = 2 if ( ReadingsVal( $name, 'watering-watering_timer_2_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); + # $activ_watering = 3 if ( ReadingsVal( $name, 'watering-watering_timer_3_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); + # $activ_watering = 4 if ( ReadingsVal( $name, 'watering-watering_timer_4_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); + # $activ_watering = 5 if ( ReadingsVal( $name, 'watering-watering_timer_5_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); + # $activ_watering = 6 if ( ReadingsVal( $name, 'watering-watering_timer_6_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); + # Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) - wasser timer: $activ_watering"; + # ### eventuell auf binare bits und shiften my $state_string = $activ_watering > 0 # offen diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index fc026a8..f752ac5 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-05-03_21:36:59 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-05-03_21:37:30 65392 FHEM/74_GardenaSmartDevice.pm +UPD 2022-05-05_08:36:31 49520 FHEM/73_GardenaSmartBridge.pm +UPD 2022-05-05_09:20:45 65861 FHEM/74_GardenaSmartDevice.pm From c3620aa017e8107a8c7870013b5b8ac54a20a321 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 6 May 2022 12:10:46 +0200 Subject: [PATCH 12/88] add log --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 4 ++-- controls_GardenaSmartDevice.txt | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGED b/CHANGED index 25c2fd6..7bc4636 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - fix log line + debug ausgabe diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 8a6e096..3ad1966 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -888,9 +888,9 @@ sub setState { my $opened_ventils = 0; ## clac bit wise 1 - 6 dec => 1 - 63 dec ( 0011 1111 ) for (my $i = 1; $i < 7; $i++){ - my $zahl = ( ReadingsVal( $name, "watering-watering_timer_'.$i.'_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? ($i -1) : 0; + my $zahl = ( ReadingsVal( $name, "watering-watering_timer_".$i."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? ($i -1) : 0; $opened_ventils=$opened_ventils+(2**$zahl) if ( $zahl > 0 ); - Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) - wasser timer($i) =-1 ( $zahl ) : $opened_ventils"; + Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) / watering-watering_timer_".$i."_duration - wasser timer($i) =-1 ( $zahl ) : $opened_ventils"; } # $activ_watering = 1 if ( ReadingsVal( $name, 'watering-watering_timer_1_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index f752ac5..4d6b491 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-05-05_08:36:31 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-05-05_09:20:45 65861 FHEM/74_GardenaSmartDevice.pm +UPD 2022-05-06_12:01:55 49520 FHEM/73_GardenaSmartBridge.pm +UPD 2022-05-06_12:10:31 65903 FHEM/74_GardenaSmartDevice.pm From 480946f9be24c050f3b70e4e080f5bc3209b7f36 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 6 May 2022 12:19:15 +0200 Subject: [PATCH 13/88] Log Debug --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 4 +++- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 7bc4636..7ead5e2 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - debug ausgabe + add log diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 3ad1966..c185f07 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -741,6 +741,8 @@ sub WriteReadings { . $r, RigReadingsValue( $hash, $v ) ); + Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) Ventil $propertie->{name} Duration: $v"; + } } } @@ -882,7 +884,7 @@ sub setState { # ... Bewässerung aktiv. Zeitpläne dauerhaft pausiert. # ... geschlossen. Zeitpläne aktiv (bzw. s.o.) # ... geschlossen. Zeitpläne dauerhaft pausiert. -# ... offline +# ... offlinen my $activ_watering = 0; if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ){ my $opened_ventils = 0; diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 4d6b491..c2d9332 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-06_12:01:55 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-05-06_12:10:31 65903 FHEM/74_GardenaSmartDevice.pm +UPD 2022-05-06_12:19:10 66027 FHEM/74_GardenaSmartDevice.pm From 948f68515c7a4248a4587d1854b5ac869df25506 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 7 May 2022 17:58:48 +0200 Subject: [PATCH 14/88] change debug --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGED b/CHANGED index 7ead5e2..824b2f8 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - add log + Log Debug diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index c185f07..548dc13 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -741,7 +741,7 @@ sub WriteReadings { . $r, RigReadingsValue( $hash, $v ) ); - Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) Ventil $propertie->{name} Duration: $v"; + Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) Ventil $propertie->{name} $r: $v"; } } diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index c2d9332..80913df 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-05-06_12:01:55 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-05-06_12:19:10 66027 FHEM/74_GardenaSmartDevice.pm +UPD 2022-05-07_13:41:51 49520 FHEM/73_GardenaSmartBridge.pm +UPD 2022-05-07_17:58:31 66021 FHEM/74_GardenaSmartDevice.pm From 91fd5708962ef6807bb37d1bd13853cc282d473e Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 7 May 2022 20:29:16 +0200 Subject: [PATCH 15/88] long state --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 49 +++++++++++++++++---------------- controls_GardenaSmartDevice.txt | 4 +-- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/CHANGED b/CHANGED index 824b2f8..27ba3dd 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - Log Debug + change debug diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 548dc13..320824d 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -888,12 +888,15 @@ sub setState { my $activ_watering = 0; if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ){ my $opened_ventils = 0; + my $state_string = ''; ## clac bit wise 1 - 6 dec => 1 - 63 dec ( 0011 1111 ) for (my $i = 1; $i < 7; $i++){ + $activ_watering = 0; my $zahl = ( ReadingsVal( $name, "watering-watering_timer_".$i."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? ($i -1) : 0; + $activ_watering = $i if ( $zahl > 0 ); $opened_ventils=$opened_ventils+(2**$zahl) if ( $zahl > 0 ); Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) / watering-watering_timer_".$i."_duration - wasser timer($i) =-1 ( $zahl ) : $opened_ventils"; - } + # $activ_watering = 1 if ( ReadingsVal( $name, 'watering-watering_timer_1_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); # $activ_watering = 2 if ( ReadingsVal( $name, 'watering-watering_timer_2_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); @@ -904,29 +907,29 @@ sub setState { # Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) - wasser timer: $activ_watering"; # ### eventuell auf binare bits und shiften - my $state_string = $activ_watering > 0 - # offen - ? - ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering, '' ) eq '' ) - # leer ( zeitplan aktiv ... ) - ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash, 'next watering: %s')), (ReadingsVal( $name, 'watering-watering_timer_'.$activ_watering.'_duration', 0 )/60), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '')) ) - # zeitplan pausiert - : - ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '') eq '2038-01-18T00:00:00.000Z') - # pause bis dauerhaft - ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash , 'schedule permanently paused')), (ReadingsVal( $name, 'watering-watering_timer_'.$activ_watering.'_duration', 0 )/60) ) - # naechter termin - : sprintf( RigReadingsValue($hash , 'paused until %s'), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '')) ) - # zu - : - ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '' ) eq '' ) - # zeitplan aktiv - ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash, 'next watering: %s')), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '') ) ) - # zeitplan pausiert - : RigReadingsValue($hash, 'closed') - ; - + $state_string .= $activ_watering > 0 + # offen + ? + ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering, '' ) eq '' ) + # leer ( zeitplan aktiv ... ) + ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash, 'next watering: %s')), (ReadingsVal( $name, 'watering-watering_timer_'.$activ_watering.'_duration', 0 )/60), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '')) ) + # zeitplan pausiert + : + ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '') eq '2038-01-18T00:00:00.000Z') + # pause bis dauerhaft + ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash , 'schedule permanently paused')), (ReadingsVal( $name, 'watering-watering_timer_'.$activ_watering.'_duration', 0 )/60) ) + # naechter termin + : sprintf( RigReadingsValue($hash , 'paused until %s'), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '')) ) + # zu + : + ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '' ) eq '' ) + # zeitplan aktiv + ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash, 'next watering: %s')), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '') ) ) + # zeitplan pausiert + : RigReadingsValue($hash, 'closed') + ; + } # if ($activ_watering > 0) # { # # ein ventil offen diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 80913df..87ee3f2 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-05-07_13:41:51 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-05-07_17:58:31 66021 FHEM/74_GardenaSmartDevice.pm +UPD 2022-05-07_20:23:00 49520 FHEM/73_GardenaSmartBridge.pm +UPD 2022-05-07_20:28:37 66165 FHEM/74_GardenaSmartDevice.pm From c551f4855fc13bedc41a34785d4d131c85b9a528 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 14 May 2022 22:59:41 +0200 Subject: [PATCH 16/88] state format --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 12 ++++++------ controls_GardenaSmartDevice.txt | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGED b/CHANGED index 27ba3dd..c0f550d 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - change debug + long state diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 320824d..f4d7867 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -889,7 +889,7 @@ sub setState { if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ){ my $opened_ventils = 0; my $state_string = ''; - ## clac bit wise 1 - 6 dec => 1 - 63 dec ( 0011 1111 ) + ## calc bit wise 1 - 6 dec => 1 - 63 dec ( 11 1111 ) for (my $i = 1; $i < 7; $i++){ $activ_watering = 0; my $zahl = ( ReadingsVal( $name, "watering-watering_timer_".$i."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? ($i -1) : 0; @@ -907,24 +907,24 @@ sub setState { # Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) - wasser timer: $activ_watering"; # ### eventuell auf binare bits und shiften - $state_string .= $activ_watering > 0 + $state_string .= # offen ? ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering, '' ) eq '' ) # leer ( zeitplan aktiv ... ) - ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash, 'next watering: %s')), (ReadingsVal( $name, 'watering-watering_timer_'.$activ_watering.'_duration', 0 )/60), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '')) ) + ? sprintf('V'.$activ_watering.' '.(RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash, 'next watering: %s')), (ReadingsVal( $name, 'watering-watering_timer_'.$activ_watering.'_duration', 0 )/60), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$activ_watering, '')) ) # zeitplan pausiert : ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '') eq '2038-01-18T00:00:00.000Z') # pause bis dauerhaft - ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash , 'schedule permanently paused')), (ReadingsVal( $name, 'watering-watering_timer_'.$activ_watering.'_duration', 0 )/60) ) + ? sprintf('V'.$activ_watering.' '. (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash , 'schedule permanently paused')), (ReadingsVal( $name, 'watering-watering_timer_'.$activ_watering.'_duration', 0 )/60) ) # naechter termin - : sprintf( RigReadingsValue($hash , 'paused until %s'), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '')) ) + : sprintf('V'.$activ_watering.' '. RigReadingsValue($hash , 'paused until %s'), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '')) ) # zu : ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '' ) eq '' ) # zeitplan aktiv - ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash, 'next watering: %s')), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '') ) ) + ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash, 'next watering: %s')), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$activ_watering, '') ) ) # zeitplan pausiert : RigReadingsValue($hash, 'closed') ; diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 87ee3f2..9b1b600 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-05-07_20:23:00 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-05-07_20:28:37 66165 FHEM/74_GardenaSmartDevice.pm +UPD 2022-05-08_12:44:36 49520 FHEM/73_GardenaSmartBridge.pm +UPD 2022-05-14_22:59:23 66249 FHEM/74_GardenaSmartDevice.pm From d6e68479554878cee56e1609c54646b816a1c952 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 14 May 2022 23:02:12 +0200 Subject: [PATCH 17/88] strgin format error --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index c0f550d..33ff22e 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - long state + state format diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index f4d7867..80465a1 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -907,7 +907,7 @@ sub setState { # Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) - wasser timer: $activ_watering"; # ### eventuell auf binare bits und shiften - $state_string .= + $state_string .= $activ_watering > 0 # offen ? ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering, '' ) eq '' ) diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 9b1b600..7b581a5 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-08_12:44:36 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-05-14_22:59:23 66249 FHEM/74_GardenaSmartDevice.pm +UPD 2022-05-14_23:01:58 66268 FHEM/74_GardenaSmartDevice.pm From 8002d2a1d3b8df18e64e4607cc58bae300299f77 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 31 May 2022 15:40:18 +0200 Subject: [PATCH 18/88] add state --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 3 ++- controls_GardenaSmartDevice.txt | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGED b/CHANGED index 33ff22e..7876793 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - state format + strgin format error diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 80465a1..22785c9 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -936,7 +936,8 @@ sub setState { # my $state_string = "ein ventil offen" # } - + readingsBulkUpdate( + $hash, 'state', RigReadingsValue( $hash, $state_string ) ); } #online state water control # zeitplan -> dauert pausiert wenn 2038-01-18T00:00:00.000Z diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 7b581a5..5fab00e 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-05-08_12:44:36 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-05-14_23:01:58 66268 FHEM/74_GardenaSmartDevice.pm +UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm +UPD 2022-05-31_15:40:11 66362 FHEM/74_GardenaSmartDevice.pm From 3b28a20b337358efb9dd8445005ffb376fcec580 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 31 May 2022 19:47:49 +0200 Subject: [PATCH 19/88] add ventil check --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 28 +++++++++++----------------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/CHANGED b/CHANGED index 7876793..59994c1 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - strgin format error + add state diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 22785c9..d58cb91 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -889,25 +889,19 @@ sub setState { if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ){ my $opened_ventils = 0; my $state_string = ''; - ## calc bit wise 1 - 6 dec => 1 - 63 dec ( 11 1111 ) - for (my $i = 1; $i < 7; $i++){ - $activ_watering = 0; - my $zahl = ( ReadingsVal( $name, "watering-watering_timer_".$i."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? ($i -1) : 0; - $activ_watering = $i if ( $zahl > 0 ); - $opened_ventils=$opened_ventils+(2**$zahl) if ( $zahl > 0 ); - Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) / watering-watering_timer_".$i."_duration - wasser timer($i) =-1 ( $zahl ) : $opened_ventils"; - + ## calc bit wise 1 - 6 dec => 1 - 63 dec ( 11 1111 ) + my @valves_connected = split(',', ReadingsVal( $name, 'ic24-valves_connected', '')); + + + for (@valves_connected){ + $activ_watering = 0; + my $zahl = ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0; + $activ_watering = $_ if ( $zahl > 0 ); + $opened_ventils=$opened_ventils+(2**$zahl) if ( $zahl > 0 ); + Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) / watering-watering_timer_".$_."_duration - wasser timer($_) =-1 ( $zahl ) : $opened_ventils"; - # $activ_watering = 1 if ( ReadingsVal( $name, 'watering-watering_timer_1_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); - # $activ_watering = 2 if ( ReadingsVal( $name, 'watering-watering_timer_2_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); - # $activ_watering = 3 if ( ReadingsVal( $name, 'watering-watering_timer_3_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); - # $activ_watering = 4 if ( ReadingsVal( $name, 'watering-watering_timer_4_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); - # $activ_watering = 5 if ( ReadingsVal( $name, 'watering-watering_timer_5_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); - # $activ_watering = 6 if ( ReadingsVal( $name, 'watering-watering_timer_6_duration', 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ); - # Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) - wasser timer: $activ_watering"; # ### eventuell auf binare bits und shiften - - $state_string .= $activ_watering > 0 + $state_string .= $activ_watering > 0 # offen ? ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering, '' ) eq '' ) diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 5fab00e..8da772b 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-05-31_15:40:11 66362 FHEM/74_GardenaSmartDevice.pm +UPD 2022-05-31_19:47:33 65578 FHEM/74_GardenaSmartDevice.pm From c76fd125ecb29503745d7c59c13de9f3d4d4c6ea Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 10 Jun 2022 20:21:29 +0200 Subject: [PATCH 20/88] first step state --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 119 +++++++++++++++++++------------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 73 insertions(+), 50 deletions(-) diff --git a/CHANGED b/CHANGED index 59994c1..3d8c619 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - add state + add ventil check diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index d58cb91..34c9c2d 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -166,6 +166,7 @@ sub Initialize { $hash->{AttrList} = "readingValueLanguage:de,en " . "model:watering_computer,sensor,sensor2,mower,ic24,power,electronic_pressure_pump " + . "extendedState " . "IODev " . $readingFnAttributes; $hash->{parseParams} = 1; @@ -879,59 +880,81 @@ sub setState { ) ) if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ); + # override state 4 extendedstates + if ( AttrVal( $name, "extendedState", 0 ) == 1) { + ### ic24 + if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ){ + my @ic24opened_ventils; + my $opened_ventils = 0; # bit maker + my $state_string = ''; my $nearst_irrigation = '2999-12-12 24:00'; + my $has_scheduling = false; + my @valves_connected = split(',', ReadingsVal( $name, 'ic24-valves_connected', '')); + for (@valves_connected){ + ## calc bit wise 1 - 6 dec => 1 - 63 dec ( 11 1111 ) + $opened_ventils=$opened_ventils+(2**$zahl) if ( $zahl > 0 ); + ## add to opened ventils, if watering active + push @ic24opened_ventils, $_ if ( ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0 ) > 0 ); + ## find nearst timestamp + $has_scheduling = true if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z'); -# ... Bewässerung aktiv. Zeitpläne aktiv (oder hier immerhin: Nächster Zeitplan: ...) -# ... Bewässerung aktiv. Zeitpläne dauerhaft pausiert. -# ... geschlossen. Zeitpläne aktiv (bzw. s.o.) -# ... geschlossen. Zeitpläne dauerhaft pausiert. -# ... offlinen - my $activ_watering = 0; - if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ){ - my $opened_ventils = 0; - my $state_string = ''; - ## calc bit wise 1 - 6 dec => 1 - 63 dec ( 11 1111 ) - my @valves_connected = split(',', ReadingsVal( $name, 'ic24-valves_connected', '')); + if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') ne '') { + $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') if ( Time::Piece->strptime( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, ''), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M")) + } # fi + } + if (scalar(@ic24opened_ventils) > 0){ + $state_string .= sprintf(RigReadingsValue($hash,'valve').' '.$_.' '.(RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.')), (ReadingsVal( $name, 'watering-watering_timer_'.$_.'_duration', 0 )/60)); + } else { + $state_string .= RigReadingsValue($hash, 'closed'); + } + $state_string .= ($has_scheduling) ? sprintf( RigReadingsValue($hash, 'next watering: %s'), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''))) : sprintf( RigReadingsValue($hash, 'paused until %s') , $nearst_irrigation); - for (@valves_connected){ - $activ_watering = 0; - my $zahl = ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0; - $activ_watering = $_ if ( $zahl > 0 ); - $opened_ventils=$opened_ventils+(2**$zahl) if ( $zahl > 0 ); - Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) / watering-watering_timer_".$_."_duration - wasser timer($_) =-1 ( $zahl ) : $opened_ventils"; + #TODO: Write state format for ventil 1-@valces_connected -> map ? - # ### eventuell auf binare bits und shiften - $state_string .= $activ_watering > 0 - # offen - ? - ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering, '' ) eq '' ) - # leer ( zeitplan aktiv ... ) - ? sprintf('V'.$activ_watering.' '.(RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash, 'next watering: %s')), (ReadingsVal( $name, 'watering-watering_timer_'.$activ_watering.'_duration', 0 )/60), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$activ_watering, '')) ) - # zeitplan pausiert - : - ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '') eq '2038-01-18T00:00:00.000Z') - # pause bis dauerhaft - ? sprintf('V'.$activ_watering.' '. (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash , 'schedule permanently paused')), (ReadingsVal( $name, 'watering-watering_timer_'.$activ_watering.'_duration', 0 )/60) ) - # naechter termin - : sprintf('V'.$activ_watering.' '. RigReadingsValue($hash , 'paused until %s'), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '')) ) - # zu - : - ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '' ) eq '' ) - # zeitplan aktiv - ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash, 'next watering: %s')), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$activ_watering, '') ) ) - # zeitplan pausiert - : RigReadingsValue($hash, 'closed') - ; - + + ## check ob ws offen ist + # ja -> dann zeig alle offene an ( durch api max. 2 ) + ## + # nein -> dann nur closed + # + ## check ob ein zeitplan aktiv + # ja -> zeig nur den nächsten an + ## + # nein -> permanent geschlosen + #### + # ### eventuell auf binare bits und shiften + # $state_string .= $activ_watering > 0 + # # offen + # ? + # ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering, '' ) eq '' ) + # # leer ( zeitplan aktiv ... ) + # ? sprintf('V'.$activ_watering.' '.(RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash, 'next watering: %s')), (ReadingsVal( $name, 'watering-watering_timer_'.$activ_watering.'_duration', 0 )/60), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$activ_watering, '')) ) + # # zeitplan pausiert + # : + # ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '') eq '2038-01-18T00:00:00.000Z') + # # pause bis dauerhaft + # ? sprintf('V'.$activ_watering.' '. (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash , 'schedule permanently paused')), (ReadingsVal( $name, 'watering-watering_timer_'.$activ_watering.'_duration', 0 )/60) ) + # # naechter termin + # : sprintf('V'.$activ_watering.' '. RigReadingsValue($hash , 'paused until %s'), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '')) ) + # # zu + # : + # ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '' ) eq '' ) + # # zeitplan aktiv + # ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash, 'next watering: %s')), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$activ_watering, '') ) ) + # # zeitplan pausiert + # : RigReadingsValue($hash, 'closed') + # ; + + #} FOR valvces_connected + # if ($activ_watering > 0) + # { + # # ein ventil offen + # my $state_string = "ein ventil offen" + + # } + readingsBulkUpdate( + $hash, 'state', RigReadingsValue( $hash, $state_string ) ); } - # if ($activ_watering > 0) - # { - # # ein ventil offen - # my $state_string = "ein ventil offen" - - # } - readingsBulkUpdate( - $hash, 'state', RigReadingsValue( $hash, $state_string ) ); } #online state water control # zeitplan -> dauert pausiert wenn 2038-01-18T00:00:00.000Z diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 8da772b..7953d61 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-05-31_19:47:33 65578 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-10_20:21:02 67143 FHEM/74_GardenaSmartDevice.pm From 9505316291b0886af6d35d13609332d591cc0884 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 10 Jun 2022 20:24:42 +0200 Subject: [PATCH 21/88] cleanup code --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 7 ++----- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/CHANGED b/CHANGED index 3d8c619..9ccedc0 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - add ventil check + first step state diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 34c9c2d..51444fa 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -884,14 +884,11 @@ sub setState { if ( AttrVal( $name, "extendedState", 0 ) == 1) { ### ic24 if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ){ - my @ic24opened_ventils; - my $opened_ventils = 0; # bit maker + my @ic24opened_ventils; my $state_string = ''; my $nearst_irrigation = '2999-12-12 24:00'; my $has_scheduling = false; my @valves_connected = split(',', ReadingsVal( $name, 'ic24-valves_connected', '')); - for (@valves_connected){ - ## calc bit wise 1 - 6 dec => 1 - 63 dec ( 11 1111 ) - $opened_ventils=$opened_ventils+(2**$zahl) if ( $zahl > 0 ); + for (@valves_connected){ ## add to opened ventils, if watering active push @ic24opened_ventils, $_ if ( ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0 ) > 0 ); ## find nearst timestamp diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 7953d61..18a0616 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-10_20:21:02 67143 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-10_20:24:37 66965 FHEM/74_GardenaSmartDevice.pm From 6faccfe56453ac4e56b6ada5b8359a89c0086731 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 10 Jun 2022 20:27:09 +0200 Subject: [PATCH 22/88] fix boolean --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 4 ++-- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGED b/CHANGED index 9ccedc0..1977e18 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - first step state + cleanup code diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 51444fa..0b080f5 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -886,13 +886,13 @@ sub setState { if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ){ my @ic24opened_ventils; my $state_string = ''; my $nearst_irrigation = '2999-12-12 24:00'; - my $has_scheduling = false; + my $has_scheduling = 0; my @valves_connected = split(',', ReadingsVal( $name, 'ic24-valves_connected', '')); for (@valves_connected){ ## add to opened ventils, if watering active push @ic24opened_ventils, $_ if ( ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0 ) > 0 ); ## find nearst timestamp - $has_scheduling = true if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z'); + $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z'); if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') ne '') { $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') if ( Time::Piece->strptime( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, ''), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M")) diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 18a0616..10e6c25 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-10_20:24:37 66965 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-10_20:26:59 66958 FHEM/74_GardenaSmartDevice.pm From c07f757c4a3c0dc5fee0b1f022cffe08503ad3ab Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 11 Jun 2022 14:07:16 +0200 Subject: [PATCH 23/88] [alpha] - implementation extend state with one more thing... --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 155 +++++++++++++++++--------------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 83 insertions(+), 76 deletions(-) diff --git a/CHANGED b/CHANGED index 1977e18..5abc55f 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - cleanup code + fix boolean diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 0b080f5..3afc6cb 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -166,7 +166,7 @@ sub Initialize { $hash->{AttrList} = "readingValueLanguage:de,en " . "model:watering_computer,sensor,sensor2,mower,ic24,power,electronic_pressure_pump " - . "extendedState " + . "extendedState:0,1 " . "IODev " . $readingFnAttributes; $hash->{parseParams} = 1; @@ -869,89 +869,96 @@ sub setState { if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' ); # ic24 - readingsBulkUpdate( - $hash, 'state', - 'scheduled watering next start: ' - . ( - ReadingsVal( - $name, 'scheduling-scheduled_watering_next_start', - 'no timer' - ) - ) - ) if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ); + if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ){ + my @ic24opened_ventils; + my $state_string = ''; my $nearst_irrigation = '2999-12-12 24:00'; + my $has_scheduling = 0; my $lowest_duration = 9999; + my @valves_connected = split(',', ReadingsVal( $name, 'ic24-valves_connected', '')); + for (@valves_connected){ + ## add to opened ventils, if watering active + push @ic24opened_ventils, $_ if ( ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0 ) > 0 ); + ## find nearst timestamp + $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z'); + $lowest_duration = ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) if ( + ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms + && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > 0 + && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) < $lowest_duration ) ); - # override state 4 extendedstates - if ( AttrVal( $name, "extendedState", 0 ) == 1) { - ### ic24 - if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ){ - my @ic24opened_ventils; - my $state_string = ''; my $nearst_irrigation = '2999-12-12 24:00'; - my $has_scheduling = 0; - my @valves_connected = split(',', ReadingsVal( $name, 'ic24-valves_connected', '')); - for (@valves_connected){ - ## add to opened ventils, if watering active - push @ic24opened_ventils, $_ if ( ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0 ) > 0 ); - ## find nearst timestamp - $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z'); - - if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') ne '') { - $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') if ( Time::Piece->strptime( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, ''), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M")) - } # fi - } + if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') ne '') { + $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') if ( Time::Piece->strptime( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, ''), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M")) + } # fi + } + # override state 4 extendedstates + if ( AttrVal( $name, "extendedState", 0 ) == 1) { if (scalar(@ic24opened_ventils) > 0){ - $state_string .= sprintf(RigReadingsValue($hash,'valve').' '.$_.' '.(RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.')), (ReadingsVal( $name, 'watering-watering_timer_'.$_.'_duration', 0 )/60)); + ## valve 1 will be ir.. 23 minutes remaining + for (@valves_connected){ + $state_string .= sprintf(RigReadingsValue($hash,'valve').' '.$_.' '.(RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.') .'
'), (ReadingsVal( $name, 'watering-watering_timer_'.$_.'_duration', 0 )/60)); + } # /for } else { $state_string .= RigReadingsValue($hash, 'closed'); } $state_string .= ($has_scheduling) ? sprintf( RigReadingsValue($hash, 'next watering: %s'), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''))) : sprintf( RigReadingsValue($hash, 'paused until %s') , $nearst_irrigation); - - #TODO: Write state format for ventil 1-@valces_connected -> map ? + } else { + $state_string = scalar(@ic24opened_ventils) > 0 ? + # offen + ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.')), $lowest_duration/60); + # zu + : + ( $has_scheduling ) + # zeitplan aktiv + ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash, 'next watering: %s')), $nearst_irrigation ) + # zeitplan pausiert + : RigReadingsValue($hash, 'closed') + ; + # state offline | override + $state_string = 'offline' if ($online_state eq 'offline'); - ## check ob ws offen ist - # ja -> dann zeig alle offene an ( durch api max. 2 ) - ## - # nein -> dann nur closed - # - ## check ob ein zeitplan aktiv - # ja -> zeig nur den nächsten an - ## - # nein -> permanent geschlosen - #### - # ### eventuell auf binare bits und shiften - # $state_string .= $activ_watering > 0 - # # offen - # ? - # ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering, '' ) eq '' ) - # # leer ( zeitplan aktiv ... ) - # ? sprintf('V'.$activ_watering.' '.(RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash, 'next watering: %s')), (ReadingsVal( $name, 'watering-watering_timer_'.$activ_watering.'_duration', 0 )/60), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$activ_watering, '')) ) - # # zeitplan pausiert - # : - # ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '') eq '2038-01-18T00:00:00.000Z') - # # pause bis dauerhaft - # ? sprintf('V'.$activ_watering.' '. (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash , 'schedule permanently paused')), (ReadingsVal( $name, 'watering-watering_timer_'.$activ_watering.'_duration', 0 )/60) ) - # # naechter termin - # : sprintf('V'.$activ_watering.' '. RigReadingsValue($hash , 'paused until %s'), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '')) ) - # # zu - # : - # ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '' ) eq '' ) - # # zeitplan aktiv - # ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash, 'next watering: %s')), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$activ_watering, '') ) ) - # # zeitplan pausiert - # : RigReadingsValue($hash, 'closed') - # ; - - #} FOR valvces_connected - # if ($activ_watering > 0) - # { - # # ein ventil offen - # my $state_string = "ein ventil offen" - - # } - readingsBulkUpdate( - $hash, 'state', RigReadingsValue( $hash, $state_string ) ); } + + ## check ob ws offen ist + # ja -> dann zeig alle offene an ( durch api max. 2 ) + ## + # nein -> dann nur closed + # + ## check ob ein zeitplan aktiv + # ja -> zeig nur den nächsten an + ## + # nein -> permanent geschlosen + #### + # ### eventuell auf binare bits und shiften + # $state_string .= $activ_watering > 0 + # # offen + # ? + # ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering, '' ) eq '' ) + # # leer ( zeitplan aktiv ... ) + # ? sprintf('V'.$activ_watering.' '.(RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash, 'next watering: %s')), (ReadingsVal( $name, 'watering-watering_timer_'.$activ_watering.'_duration', 0 )/60), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$activ_watering, '')) ) + # # zeitplan pausiert + # : + # ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '') eq '2038-01-18T00:00:00.000Z') + # # pause bis dauerhaft + # ? sprintf('V'.$activ_watering.' '. (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash , 'schedule permanently paused')), (ReadingsVal( $name, 'watering-watering_timer_'.$activ_watering.'_duration', 0 )/60) ) + # # naechter termin + # : sprintf('V'.$activ_watering.' '. RigReadingsValue($hash , 'paused until %s'), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '')) ) + # # zu + # : + # ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$activ_watering , '' ) eq '' ) + # # zeitplan aktiv + # ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash, 'next watering: %s')), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$activ_watering, '') ) ) + # # zeitplan pausiert + # : RigReadingsValue($hash, 'closed') + # ; + + #} FOR valvces_connected + # if ($activ_watering > 0) + # { + # # ein ventil offen + # my $state_string = "ein ventil offen" + # } + readingsBulkUpdate( + $hash, 'state', RigReadingsValue( $hash, $state_string ) ); } #online state water control # zeitplan -> dauert pausiert wenn 2038-01-18T00:00:00.000Z diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 10e6c25..990e2c4 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-10_20:26:59 66958 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-11_14:06:34 67705 FHEM/74_GardenaSmartDevice.pm From ae4e1b9990d68c47c96a248cc68666fa182bdf39 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 11 Jun 2022 14:09:42 +0200 Subject: [PATCH 24/88] fix --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 5abc55f..8c85194 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - fix boolean + [alpha] - implementation extend state with one more thing... diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 3afc6cb..28f37f5 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -902,7 +902,7 @@ sub setState { #TODO: Write state format for ventil 1-@valces_connected -> map ? } else { - $state_string = scalar(@ic24opened_ventils) > 0 ? + $state_string = scalar(@ic24opened_ventils) > 0 # offen ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.')), $lowest_duration/60); # zu diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 990e2c4..b9cc3e8 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-11_14:06:34 67705 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-11_14:09:31 67703 FHEM/74_GardenaSmartDevice.pm From 576569ea2d80a7a8369f8b26dbf576ae37de5602 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 11 Jun 2022 14:12:02 +0200 Subject: [PATCH 25/88] fixing symikolon --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 8c85194..f87c031 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [alpha] - implementation extend state with one more thing... + fix diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 28f37f5..aaadda3 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -904,7 +904,7 @@ sub setState { } else { $state_string = scalar(@ic24opened_ventils) > 0 # offen - ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.')), $lowest_duration/60); + ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.')), $lowest_duration/60) # zu : ( $has_scheduling ) diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index b9cc3e8..0a84bb8 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-11_14:09:31 67703 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-11_14:11:55 67702 FHEM/74_GardenaSmartDevice.pm From 4666020263b75a5a7eac0ad705d914b380696437 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 11 Jun 2022 15:23:15 +0200 Subject: [PATCH 26/88] [alpha] - extendedState --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index f87c031..6c9dd02 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - fix + fixing symikolon diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index aaadda3..0b634e0 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -166,9 +166,9 @@ sub Initialize { $hash->{AttrList} = "readingValueLanguage:de,en " . "model:watering_computer,sensor,sensor2,mower,ic24,power,electronic_pressure_pump " - . "extendedState:0,1 " . "IODev " . $readingFnAttributes; + $hash->{AttrList} .= "extendedState:0,1 " if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ); $hash->{parseParams} = 1; return FHEM::Meta::InitMod( __FILE__, $hash ); diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 0a84bb8..0f2c941 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-11_14:11:55 67702 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-11_15:23:03 67774 FHEM/74_GardenaSmartDevice.pm From b6a179a0ea0103e3a30e61bd87b4cee1b0c83c05 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 11 Jun 2022 15:24:44 +0200 Subject: [PATCH 27/88] [alpha] - extendedState --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 6c9dd02..2f9c549 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - fixing symikolon + [alpha] - extendedState diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 0b634e0..9e7c713 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -168,7 +168,7 @@ sub Initialize { . "model:watering_computer,sensor,sensor2,mower,ic24,power,electronic_pressure_pump " . "IODev " . $readingFnAttributes; - $hash->{AttrList} .= "extendedState:0,1 " if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ); + $hash->{AttrList} .= "extendedState:0,1 " if ( AttrVal( $hash[1], 'model', 'unknown' ) eq 'ic24' ); $hash->{parseParams} = 1; return FHEM::Meta::InitMod( __FILE__, $hash ); diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 0f2c941..f8e2366 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-11_15:23:03 67774 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-11_15:24:32 67777 FHEM/74_GardenaSmartDevice.pm From a4865cae4776a18c816dd20be8bef64543329842 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 11 Jun 2022 15:35:29 +0200 Subject: [PATCH 28/88] [alpha] - extendetState --- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 9e7c713..312e490 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -166,9 +166,9 @@ sub Initialize { $hash->{AttrList} = "readingValueLanguage:de,en " . "model:watering_computer,sensor,sensor2,mower,ic24,power,electronic_pressure_pump " + . "extendedState:0,1 "/7 . "IODev " . $readingFnAttributes; - $hash->{AttrList} .= "extendedState:0,1 " if ( AttrVal( $hash[1], 'model', 'unknown' ) eq 'ic24' ); $hash->{parseParams} = 1; return FHEM::Meta::InitMod( __FILE__, $hash ); diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index f8e2366..8287f05 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-11_15:24:32 67777 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-11_15:35:09 67704 FHEM/74_GardenaSmartDevice.pm From 86b679ba9703f6f7391657346e48a6dfca2a3873 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 12 Jun 2022 11:13:57 +0200 Subject: [PATCH 29/88] [alpha] - extendetState, legacy enabled --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 2f9c549..9d81975 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [alpha] - extendedState + [alpha] - extendetState diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 312e490..18e159e 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -871,7 +871,7 @@ sub setState { # ic24 if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ){ my @ic24opened_ventils; - my $state_string = ''; my $nearst_irrigation = '2999-12-12 24:00'; + my $state_string = ''; my $nearst_irrigation = '2999-12-12 23:59'; my $has_scheduling = 0; my $lowest_duration = 9999; my @valves_connected = split(',', ReadingsVal( $name, 'ic24-valves_connected', '')); for (@valves_connected){ diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 8287f05..192c8c2 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-11_15:35:09 67704 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-12_11:13:05 67704 FHEM/74_GardenaSmartDevice.pm From 9a85c9c20d1afd299adda8e90e8456fddf4c70e3 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 12 Jun 2022 20:08:11 +0200 Subject: [PATCH 30/88] [alpha] - extendetSate ic24 --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 9d81975..90035e0 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [alpha] - extendetState + [alpha] - extendetState, legacy enabled diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 18e159e..f939e8a 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -166,7 +166,7 @@ sub Initialize { $hash->{AttrList} = "readingValueLanguage:de,en " . "model:watering_computer,sensor,sensor2,mower,ic24,power,electronic_pressure_pump " - . "extendedState:0,1 "/7 + . "extendedState:0,1 " . "IODev " . $readingFnAttributes; $hash->{parseParams} = 1; diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 192c8c2..d318fbd 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-12_11:13:05 67704 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-12_20:07:37 67702 FHEM/74_GardenaSmartDevice.pm From 5bf618a9d2fc3bb13ea28b77f3e4b7cb8cf4529f Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 13 Jun 2022 20:44:02 +0200 Subject: [PATCH 31/88] [alpha] - extendetState | legacy: will be irrigeated by longest_duration, has scheduling check --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 14 +++++++++----- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGED b/CHANGED index 90035e0..7c3cf46 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [alpha] - extendetState, legacy enabled + [alpha] - extendetSate ic24 diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index f939e8a..dc17bb3 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -872,20 +872,24 @@ sub setState { if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ){ my @ic24opened_ventils; my $state_string = ''; my $nearst_irrigation = '2999-12-12 23:59'; - my $has_scheduling = 0; my $lowest_duration = 9999; + my $has_scheduling = 0; my $longest_duration = 0; my @valves_connected = split(',', ReadingsVal( $name, 'ic24-valves_connected', '')); for (@valves_connected){ ## add to opened ventils, if watering active push @ic24opened_ventils, $_ if ( ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0 ) > 0 ); ## find nearst timestamp $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z'); - $lowest_duration = ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) if ( + $longest_duration = ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) if ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > 0 - && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) < $lowest_duration ) ); + && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > $longest_duration ) ); if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') ne '') { - $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') if ( Time::Piece->strptime( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, ''), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M")) + $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') + if ( + Time::Piece->strptime( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, ''), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") + && has_scheduling + ) } # fi } # override state 4 extendedstates @@ -904,7 +908,7 @@ sub setState { } else { $state_string = scalar(@ic24opened_ventils) > 0 # offen - ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.')), $lowest_duration/60) + ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.')), $longest_duration/60) # zu : ( $has_scheduling ) diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index d318fbd..ddfe9b6 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-12_20:07:37 67702 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-13_20:42:35 67780 FHEM/74_GardenaSmartDevice.pm From f8b4df8f4f2dbf2ae9c0af3bcfc57a4fa30c4196 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 13 Jun 2022 20:46:41 +0200 Subject: [PATCH 32/88] blank --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 7c3cf46..aac6fb3 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [alpha] - extendetSate ic24 + [alpha] - extendetState | legacy: will be irrigeated by longest_duration, has scheduling check diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index dc17bb3..ce36737 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -888,7 +888,7 @@ sub setState { $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') if ( Time::Piece->strptime( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, ''), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") - && has_scheduling + && $has_scheduling ) } # fi } diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index ddfe9b6..a32c707 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-13_20:42:35 67780 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-13_20:46:27 67781 FHEM/74_GardenaSmartDevice.pm From 3326b134a865606b09e9bb04c94aeca6534088b6 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 13 Jun 2022 21:01:39 +0200 Subject: [PATCH 33/88] [alpha] - extendedState --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index aac6fb3..bf816f4 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [alpha] - extendetState | legacy: will be irrigeated by longest_duration, has scheduling check + blank diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index ce36737..0b138a0 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -871,7 +871,7 @@ sub setState { # ic24 if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ){ my @ic24opened_ventils; - my $state_string = ''; my $nearst_irrigation = '2999-12-12 23:59'; + my $state_string = ''; my $nearst_irrigation = '2038-01-18 00:00'; my $has_scheduling = 0; my $longest_duration = 0; my @valves_connected = split(',', ReadingsVal( $name, 'ic24-valves_connected', '')); for (@valves_connected){ diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index a32c707..69a0e35 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-13_20:46:27 67781 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-13_21:01:03 67781 FHEM/74_GardenaSmartDevice.pm From 9ffde3bd2c3d15a6ca832b4ea4c5a0fbd2a9b9d9 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 14 Jun 2022 10:18:16 +0200 Subject: [PATCH 34/88] [alpha] - ExtendetState: debugzeilen added --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 8 +++++++- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index bf816f4..2f9c549 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - blank + [alpha] - extendedState diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 0b138a0..a8e4fd4 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -878,7 +878,7 @@ sub setState { ## add to opened ventils, if watering active push @ic24opened_ventils, $_ if ( ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0 ) > 0 ); ## find nearst timestamp - $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z'); + $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '' ); $longest_duration = ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) if ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > 0 @@ -904,8 +904,14 @@ sub setState { } $state_string .= ($has_scheduling) ? sprintf( RigReadingsValue($hash, 'next watering: %s'), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''))) : sprintf( RigReadingsValue($hash, 'paused until %s') , $nearst_irrigation); #TODO: Write state format for ventil 1-@valces_connected -> map ? + CommandAttr( undef, $name . ' stateFormat + { + } + ' ) + if ( AttrVal( $name, 'stateFormat', 'none' ) eq 'none' ); } else { + Log3 $name, 3, "[DEBUG] - Offene Ventile :".scalar(@ic24opened_ventils)." laengste bewaesserung: $longest_duration . hat Zeitplan: ". ($has_scheduling) = "ja":"nein" . "Naechster Zeitplan: $nearst_irrigation"; $state_string = scalar(@ic24opened_ventils) > 0 # offen ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.')), $longest_duration/60) diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 69a0e35..5dc1582 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-13_21:01:03 67781 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-14_10:17:58 68243 FHEM/74_GardenaSmartDevice.pm From 0c3db5e4453b61339ce631f8717f8691c6bcd2d2 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 14 Jun 2022 10:22:14 +0200 Subject: [PATCH 35/88] - --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 2f9c549..54222d9 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [alpha] - extendedState + [alpha] - ExtendetState: debugzeilen added diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index a8e4fd4..6c0817a 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -911,7 +911,7 @@ sub setState { ' ) if ( AttrVal( $name, 'stateFormat', 'none' ) eq 'none' ); } else { - Log3 $name, 3, "[DEBUG] - Offene Ventile :".scalar(@ic24opened_ventils)." laengste bewaesserung: $longest_duration . hat Zeitplan: ". ($has_scheduling) = "ja":"nein" . "Naechster Zeitplan: $nearst_irrigation"; + Log3 $name, 3, "[DEBUG] - Offene Ventile :".scalar(@ic24opened_ventils)." laengste bewaesserung: $longest_duration . hat Zeitplan: ". ($has_scheduling) ? "ja":"nein" . "Naechster Zeitplan: $nearst_irrigation"; $state_string = scalar(@ic24opened_ventils) > 0 # offen ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.')), $longest_duration/60) diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 5dc1582..8b6c568 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-14_10:17:58 68243 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-14_10:21:06 68243 FHEM/74_GardenaSmartDevice.pm From 91ff06ea794a65e26a10061a12da69bb7045b4a6 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 16 Jun 2022 16:04:05 +0200 Subject: [PATCH 36/88] [extendetState] - fix up schedule --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 4 ++-- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGED b/CHANGED index 54222d9..e3d49c4 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [alpha] - ExtendetState: debugzeilen added + - diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 6c0817a..a313943 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -878,7 +878,7 @@ sub setState { ## add to opened ventils, if watering active push @ic24opened_ventils, $_ if ( ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0 ) > 0 ); ## find nearst timestamp - $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '' ); + $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); $longest_duration = ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) if ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > 0 @@ -911,7 +911,7 @@ sub setState { ' ) if ( AttrVal( $name, 'stateFormat', 'none' ) eq 'none' ); } else { - Log3 $name, 3, "[DEBUG] - Offene Ventile :".scalar(@ic24opened_ventils)." laengste bewaesserung: $longest_duration . hat Zeitplan: ". ($has_scheduling) ? "ja":"nein" . "Naechster Zeitplan: $nearst_irrigation"; + Log3 $name, 3, "[DEBUG] - Offene Ventile :".scalar(@ic24opened_ventils)." laengste bewaesserung: $longest_duration . hat Zeitplan: $has_scheduling Naechster Zeitplan: $nearst_irrigation"; $state_string = scalar(@ic24opened_ventils) > 0 # offen ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.')), $longest_duration/60) diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 8b6c568..e7d3c66 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-14_10:21:06 68243 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-16_15:46:05 68221 FHEM/74_GardenaSmartDevice.pm From df99f04e6e0334b755a7af7c34aa054f5f073cc9 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 16 Jun 2022 20:15:29 +0200 Subject: [PATCH 37/88] scheduling if event != '' --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 3 ++- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index e3d49c4..8f5ec26 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - - + [extendetState] - fix up schedule diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index a313943..db58885 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -878,7 +878,8 @@ sub setState { ## add to opened ventils, if watering active push @ic24opened_ventils, $_ if ( ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0 ) > 0 ); ## find nearst timestamp - $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); + #$has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); + $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); $longest_duration = ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) if ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > 0 diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index e7d3c66..d7c59a3 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-16_15:46:05 68221 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-16_20:08:37 68329 FHEM/74_GardenaSmartDevice.pm From ab2e990ffb2a673ededb92b8e4628459cfa352e3 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 23 Jun 2022 11:31:22 +0200 Subject: [PATCH 38/88] [alpha] - extendedState - fix next irrigation and irregation left time --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 50 +++++++++++++++++++++++++++++++-- controls_GardenaSmartDevice.txt | 4 +-- 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/CHANGED b/CHANGED index 8f5ec26..8430654 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [extendetState] - fix up schedule + scheduling if event != '' diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index db58885..77fba9e 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -734,6 +734,7 @@ sub WriteReadings { . $propertie->{name} eq 'ic24-valves_master_config' ); if ( ref( $propertie->{value} ) eq "HASH" ) { + my $sub_state = 0; my $sub_value = 0; while ( my ( $r, $v ) = each %{ $propertie->{value} } ) { readingsBulkUpdate( $hash, @@ -742,10 +743,54 @@ sub WriteReadings { . $r, RigReadingsValue( $hash, $v ) ); - Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) Ventil $propertie->{name} $r: $v"; + Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) Ventil $propertie->{name} $r: $v"; } } + + + + # ic24 and more watering duration ? + readingsBulkUpdateIfChanged( + $hash, + $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} + . '_irrigation_left', + sprintf("%.f" ,(RigReadingsValue( + $hash, + $decode_json->{abilities}[$abilities]{timestamp} + "%Y-%m-%d %H:%M:%S")+($propertie->{value}{duration} + 3 )) - Time::Piece::localtime->new ) + ) + if ( defined( $propertie->{value} ) + && $decode_json->{abilities}[$abilities]{name} eq 'watering' + && $propertie->{value}{duration} > 0 ); + +#2022-06-21T08:56:42.488Z -> 2022-06-21 08:56:48 + + + # $propertie->{value}{duration} + # $propertie->{value}{valve_id} + + + # Time::Piece->strptime( + # RigReadingsValue( $hash, $propertie->{timestamp} ), + # "%Y-%m-%d %H:%M:%S" )->add(seconds => ($propertie->{value}{duration} +3))) + + + + # "%Y-%m-%d %H:%M:%S" )->strftime('%s') + + + # "name": "watering_timer_4", + # "timestamp": "2022-06-21T08:56:42.488Z", + durati^n + 3 + # "unit": "complex", + # "value": { + # "state": "manual", + # "duration": 1497, + # "valve_id": 4 + + + } } @@ -885,7 +930,8 @@ sub setState { && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > 0 && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > $longest_duration ) ); - if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') ne '') { + if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') ne '' + && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' ) { $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') if ( Time::Piece->strptime( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, ''), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index d7c59a3..7210d20 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-05-28_13:13:38 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-16_20:08:37 68329 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-21_08:17:57 49520 FHEM/73_GardenaSmartBridge.pm +UPD 2022-06-23_11:30:43 70219 FHEM/74_GardenaSmartDevice.pm From bbf9919ad3f73e921289b6e5d6086774dd5f2df2 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 23 Jun 2022 11:37:04 +0200 Subject: [PATCH 39/88] [alpa] extendetState: fix irrigatiopn time stuff --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 11 +++++++---- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGED b/CHANGED index 8430654..7bd11d7 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - scheduling if event != '' + [alpha] - extendedState - fix next irrigation and irregation left time diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 77fba9e..fea6284 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -756,10 +756,13 @@ sub WriteReadings { $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name} . '_irrigation_left', - sprintf("%.f" ,(RigReadingsValue( - $hash, - $decode_json->{abilities}[$abilities]{timestamp} - "%Y-%m-%d %H:%M:%S")+($propertie->{value}{duration} + 3 )) - Time::Piece::localtime->new ) + sprintf("%.f" , + + Time::Piece::localtime->strptime( + RigReadingsValue( + $hash, + $decode_json->{abilities}[$abilities]{timestamp}), + "%Y-%m-%d %H:%M:%S") +($propertie->{value}{duration} + 3 ) - Time::Piece::localtime->new ) ) if ( defined( $propertie->{value} ) && $decode_json->{abilities}[$abilities]{name} eq 'watering' diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 7210d20..b12b556 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-21_08:17:57 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-23_11:30:43 70219 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-23_11:36:38 70324 FHEM/74_GardenaSmartDevice.pm From 830e5426d65e27c9a629c81720367abac7c37a96 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 23 Jun 2022 11:45:59 +0200 Subject: [PATCH 40/88] [alpha] extemdedState - fix state --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 7bd11d7..925aa5b 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [alpha] - extendedState - fix next irrigation and irregation left time + [alpa] extendetState: fix irrigatiopn time stuff diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index fea6284..30d5216 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -928,7 +928,7 @@ sub setState { ## find nearst timestamp #$has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); - $longest_duration = ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) if ( + $longest_duration = ReadingsVal( $name, "watering-watering_timer_".$_."_irrigation_left", 0 ) if ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > 0 && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > $longest_duration ) ); diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index b12b556..eb9cc7f 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-21_08:17:57 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-23_11:36:38 70324 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-23_11:45:43 70331 FHEM/74_GardenaSmartDevice.pm From c68f35c2e3b4777f32f7378f452a3cd3781fb710 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 23 Jun 2022 12:08:26 +0200 Subject: [PATCH 41/88] [alpha] - extendetState. fix state --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 9 +++------ controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/CHANGED b/CHANGED index 925aa5b..806a9d2 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [alpa] extendetState: fix irrigatiopn time stuff + [alpha] extemdedState - fix state diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 30d5216..5b70daa 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -757,12 +757,9 @@ sub WriteReadings { . $propertie->{name} . '_irrigation_left', sprintf("%.f" , - - Time::Piece::localtime->strptime( - RigReadingsValue( - $hash, - $decode_json->{abilities}[$abilities]{timestamp}), - "%Y-%m-%d %H:%M:%S") +($propertie->{value}{duration} + 3 ) - Time::Piece::localtime->new ) + Time::Piece::localtime->strptime( + $decode_json->{abilities}[$abilities]{timestamp}, "%Y-%m-%d %H:%M:%S") + + ($propertie->{value}{duration} + 3 ) - Time::Piece::localtime->new ) ) if ( defined( $propertie->{value} ) && $decode_json->{abilities}[$abilities]{name} eq 'watering' diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index eb9cc7f..f102af9 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-21_08:17:57 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-23_11:45:43 70331 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-23_12:08:11 70232 FHEM/74_GardenaSmartDevice.pm From 3780befa7a55bceb58a65cfa9a7f302a20a5fd17 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 23 Jun 2022 12:11:00 +0200 Subject: [PATCH 42/88] dry run --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 13 +++++++++++++ controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGED b/CHANGED index 806a9d2..015ce8a 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [alpha] extemdedState - fix state + [alpha] - extendetState. fix state diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 5b70daa..712832b 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -765,6 +765,19 @@ sub WriteReadings { && $decode_json->{abilities}[$abilities]{name} eq 'watering' && $propertie->{value}{duration} > 0 ); + if ( defined( $propertie->{value} ) + && $decode_json->{abilities}[$abilities]{name} eq 'watering' + && $propertie->{value}{duration} > 0 ){ + my $dt = Time::Piece::localtime->strptime( $decode_json->{abilities}[$abilities]{timestamp}, "%Y-%m-%d %H:%M:%S"); + Log3 $name, 2, "[DEBUG] $dt"; + my $ndt = Time::Piece::localtime->new; + Log3 $name, 2, "[DEBUG] $ndt"; + Log3 $name, 2, "[DEBUG] " . $dt + ($propertie->{value}{duration} + 3 ); + Log3 $name, 2, "[DEBUG] " . sprintf("%.f" , + Time::Piece::localtime->strptime( + $decode_json->{abilities}[$abilities]{timestamp}, "%Y-%m-%d %H:%M:%S") + + ($propertie->{value}{duration} + 3 ) - Time::Piece::localtime->new ); + } #2022-06-21T08:56:42.488Z -> 2022-06-21 08:56:48 diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index f102af9..5564072 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-21_08:17:57 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-23_12:08:11 70232 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-23_12:10:53 71160 FHEM/74_GardenaSmartDevice.pm From b3d39a6e580eb132178f90864c9b1fd16b4909ed Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 23 Jun 2022 12:14:29 +0200 Subject: [PATCH 43/88] debug stuff --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 3 ++- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 015ce8a..282cd28 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [alpha] - extendetState. fix state + dry run diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 712832b..2f52899 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -768,7 +768,8 @@ sub WriteReadings { if ( defined( $propertie->{value} ) && $decode_json->{abilities}[$abilities]{name} eq 'watering' && $propertie->{value}{duration} > 0 ){ - my $dt = Time::Piece::localtime->strptime( $decode_json->{abilities}[$abilities]{timestamp}, "%Y-%m-%d %H:%M:%S"); + Log3 $name, 2, "[DDebug] " . RigReadingsValue($hash, Time::Piece::localtime->strptime( $decode_json->{abilities}[$abilities]{timestamp}); + my $dt = RigReadingsValue($hash, Time::Piece::localtime->strptime( $decode_json->{abilities}[$abilities]{timestamp}), "%Y-%m-%d %H:%M:%S"); Log3 $name, 2, "[DEBUG] $dt"; my $ndt = Time::Piece::localtime->new; Log3 $name, 2, "[DEBUG] $ndt"; diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 5564072..6c079ef 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-21_08:17:57 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-23_12:10:53 71160 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-23_12:14:22 71345 FHEM/74_GardenaSmartDevice.pm From 6ce4b352b4ab060836f31a715931e50d7151a0fd Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 23 Jun 2022 12:15:10 +0200 Subject: [PATCH 44/88] fix --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 282cd28..1c79d32 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - dry run + debug stuff diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 2f52899..ede4f44 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -768,7 +768,7 @@ sub WriteReadings { if ( defined( $propertie->{value} ) && $decode_json->{abilities}[$abilities]{name} eq 'watering' && $propertie->{value}{duration} > 0 ){ - Log3 $name, 2, "[DDebug] " . RigReadingsValue($hash, Time::Piece::localtime->strptime( $decode_json->{abilities}[$abilities]{timestamp}); + Log3 $name, 2, "[DDebug] " . RigReadingsValue($hash, Time::Piece::localtime->strptime( $decode_json->{abilities}[$abilities]{timestamp})); my $dt = RigReadingsValue($hash, Time::Piece::localtime->strptime( $decode_json->{abilities}[$abilities]{timestamp}), "%Y-%m-%d %H:%M:%S"); Log3 $name, 2, "[DEBUG] $dt"; my $ndt = Time::Piece::localtime->new; diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 6c079ef..07bac3b 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-21_08:17:57 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-23_12:14:22 71345 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-23_12:15:06 71346 FHEM/74_GardenaSmartDevice.pm From 9f9722ce9c2946c32b18ce2dc72daddeb75da158 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 23 Jun 2022 12:36:17 +0200 Subject: [PATCH 45/88] fix --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 11 ++++++----- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGED b/CHANGED index 1c79d32..e4fe25a 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - debug stuff + fix diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index ede4f44..1193fa1 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -758,7 +758,7 @@ sub WriteReadings { . '_irrigation_left', sprintf("%.f" , Time::Piece::localtime->strptime( - $decode_json->{abilities}[$abilities]{timestamp}, "%Y-%m-%d %H:%M:%S") + RigReadingsValue($hash, $propertie->{timestamp}), "%Y-%m-%d %H:%M:%S") + ($propertie->{value}{duration} + 3 ) - Time::Piece::localtime->new ) ) if ( defined( $propertie->{value} ) @@ -768,15 +768,16 @@ sub WriteReadings { if ( defined( $propertie->{value} ) && $decode_json->{abilities}[$abilities]{name} eq 'watering' && $propertie->{value}{duration} > 0 ){ - Log3 $name, 2, "[DDebug] " . RigReadingsValue($hash, Time::Piece::localtime->strptime( $decode_json->{abilities}[$abilities]{timestamp})); - my $dt = RigReadingsValue($hash, Time::Piece::localtime->strptime( $decode_json->{abilities}[$abilities]{timestamp}), "%Y-%m-%d %H:%M:%S"); + Log3 $name, 2, "[DDebug] " . Time::Piece::localtime->strptime( + RigReadingsValue($hash, $propertie->{timestamp}), "%Y-%m-%d %H:%M:%S"); + my $dt = Time::Piece::localtime->strptime( RigReadingsValue($hash, $propertie->{timestamp}), "%Y-%m-%d %H:%M:%S"); Log3 $name, 2, "[DEBUG] $dt"; my $ndt = Time::Piece::localtime->new; Log3 $name, 2, "[DEBUG] $ndt"; Log3 $name, 2, "[DEBUG] " . $dt + ($propertie->{value}{duration} + 3 ); Log3 $name, 2, "[DEBUG] " . sprintf("%.f" , - Time::Piece::localtime->strptime( - $decode_json->{abilities}[$abilities]{timestamp}, "%Y-%m-%d %H:%M:%S") + Time::Piece::localtime->strptime( + RigReadingsValue($hash, $propertie->{timestamp}), "%Y-%m-%d %H:%M:%S") + ($propertie->{value}{duration} + 3 ) - Time::Piece::localtime->new ); } #2022-06-21T08:56:42.488Z -> 2022-06-21 08:56:48 diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 07bac3b..d4b531c 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-21_08:17:57 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-23_12:15:06 71346 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-23_12:36:14 71385 FHEM/74_GardenaSmartDevice.pm From 97f55e61220c94652ce30895871995647f65cd19 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 23 Jun 2022 12:41:18 +0200 Subject: [PATCH 46/88] debugg --- FHEM/74_GardenaSmartDevice.pm | 10 +++++----- controls_GardenaSmartDevice.txt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 1193fa1..d3fc8a5 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -759,7 +759,7 @@ sub WriteReadings { sprintf("%.f" , Time::Piece::localtime->strptime( RigReadingsValue($hash, $propertie->{timestamp}), "%Y-%m-%d %H:%M:%S") - + ($propertie->{value}{duration} + 3 ) - Time::Piece::localtime->new ) + + ($propertie->{value}{duration} - 3 ) - Time::Piece::localtime->new ) ) if ( defined( $propertie->{value} ) && $decode_json->{abilities}[$abilities]{name} eq 'watering' @@ -773,12 +773,12 @@ sub WriteReadings { my $dt = Time::Piece::localtime->strptime( RigReadingsValue($hash, $propertie->{timestamp}), "%Y-%m-%d %H:%M:%S"); Log3 $name, 2, "[DEBUG] $dt"; my $ndt = Time::Piece::localtime->new; - Log3 $name, 2, "[DEBUG] $ndt"; - Log3 $name, 2, "[DEBUG] " . $dt + ($propertie->{value}{duration} + 3 ); - Log3 $name, 2, "[DEBUG] " . sprintf("%.f" , + Log3 $name, 2, "[cDEBUG] $ndt"; + Log3 $name, 2, "[aDEBUG] " . ($propertie->{value}{duration} + 3 ); + Log3 $name, 2, "[sDEBUG] " . sprintf("%.f" , Time::Piece::localtime->strptime( RigReadingsValue($hash, $propertie->{timestamp}), "%Y-%m-%d %H:%M:%S") - + ($propertie->{value}{duration} + 3 ) - Time::Piece::localtime->new ); + + ($propertie->{value}{duration} - 6 ) - Time::Piece::localtime->new ); } #2022-06-21T08:56:42.488Z -> 2022-06-21 08:56:48 diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index d4b531c..60cfaeb 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-21_08:17:57 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-23_12:36:14 71385 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-23_12:41:15 71382 FHEM/74_GardenaSmartDevice.pm From d3020ded2c194b5d21ea5150a1b56c67dbba2d0c Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 23 Jun 2022 12:45:31 +0200 Subject: [PATCH 47/88] [alpha] - extendetState - irrigation stuff --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 34 ++++++++++++++++----------------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/CHANGED b/CHANGED index e4fe25a..6b83971 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - fix + debugg diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index d3fc8a5..7ae31ab 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -757,29 +757,29 @@ sub WriteReadings { . $propertie->{name} . '_irrigation_left', sprintf("%.f" , - Time::Piece::localtime->strptime( + (Time::Piece::localtime->strptime( RigReadingsValue($hash, $propertie->{timestamp}), "%Y-%m-%d %H:%M:%S") - + ($propertie->{value}{duration} - 3 ) - Time::Piece::localtime->new ) + + ($propertie->{value}{duration} + 3 ) - Time::Piece::localtime->new) / 60 ) ) if ( defined( $propertie->{value} ) && $decode_json->{abilities}[$abilities]{name} eq 'watering' && $propertie->{value}{duration} > 0 ); - if ( defined( $propertie->{value} ) - && $decode_json->{abilities}[$abilities]{name} eq 'watering' - && $propertie->{value}{duration} > 0 ){ - Log3 $name, 2, "[DDebug] " . Time::Piece::localtime->strptime( - RigReadingsValue($hash, $propertie->{timestamp}), "%Y-%m-%d %H:%M:%S"); - my $dt = Time::Piece::localtime->strptime( RigReadingsValue($hash, $propertie->{timestamp}), "%Y-%m-%d %H:%M:%S"); - Log3 $name, 2, "[DEBUG] $dt"; - my $ndt = Time::Piece::localtime->new; - Log3 $name, 2, "[cDEBUG] $ndt"; - Log3 $name, 2, "[aDEBUG] " . ($propertie->{value}{duration} + 3 ); - Log3 $name, 2, "[sDEBUG] " . sprintf("%.f" , - Time::Piece::localtime->strptime( - RigReadingsValue($hash, $propertie->{timestamp}), "%Y-%m-%d %H:%M:%S") - + ($propertie->{value}{duration} - 6 ) - Time::Piece::localtime->new ); - } + # if ( defined( $propertie->{value} ) + # && $decode_json->{abilities}[$abilities]{name} eq 'watering' + # && $propertie->{value}{duration} > 0 ){ + # Log3 $name, 2, "[DDebug] " . Time::Piece::localtime->strptime( + # RigReadingsValue($hash, $propertie->{timestamp}), "%Y-%m-%d %H:%M:%S"); + # my $dt = Time::Piece::localtime->strptime( RigReadingsValue($hash, $propertie->{timestamp}), "%Y-%m-%d %H:%M:%S"); + # Log3 $name, 2, "[DEBUG] $dt"; + # my $ndt = Time::Piece::localtime->new; + # Log3 $name, 2, "[cDEBUG] $ndt"; + # Log3 $name, 2, "[aDEBUG] " . ($propertie->{value}{duration} + 3 ); + # Log3 $name, 2, "[sDEBUG] " . sprintf("%.f" , + # Time::Piece::localtime->strptime( + # RigReadingsValue($hash, $propertie->{timestamp}), "%Y-%m-%d %H:%M:%S") + # + ($propertie->{value}{duration} + 3 ) - Time::Piece::localtime->new ); + # } #2022-06-21T08:56:42.488Z -> 2022-06-21 08:56:48 diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 60cfaeb..75ef282 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-21_08:17:57 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-23_12:41:15 71382 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-23_12:44:35 71419 FHEM/74_GardenaSmartDevice.pm From 930e42835b47a0e3c1a8da3c41b771f1daba1b8b Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 23 Jun 2022 12:55:03 +0200 Subject: [PATCH 48/88] [alpha] excentedState - fix wc state, add irrigation duration --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 54 +++------------------------------ controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 6 insertions(+), 52 deletions(-) diff --git a/CHANGED b/CHANGED index 6b83971..a2d7c19 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - debugg + [alpha] - extendetState - irrigation stuff diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 7ae31ab..7aa4854 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -747,65 +747,19 @@ sub WriteReadings { Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) Ventil $propertie->{name} $r: $v"; } } - - - - # ic24 and more watering duration ? + # ic24 and other watering devices calc irrigation left in sec readingsBulkUpdateIfChanged( $hash, $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name} . '_irrigation_left', - sprintf("%.f" , (Time::Piece::localtime->strptime( RigReadingsValue($hash, $propertie->{timestamp}), "%Y-%m-%d %H:%M:%S") - + ($propertie->{value}{duration} + 3 ) - Time::Piece::localtime->new) / 60 ) + + ($propertie->{value}{duration} + 3 ) - Time::Piece::localtime->new) ) if ( defined( $propertie->{value} ) && $decode_json->{abilities}[$abilities]{name} eq 'watering' && $propertie->{value}{duration} > 0 ); - - # if ( defined( $propertie->{value} ) - # && $decode_json->{abilities}[$abilities]{name} eq 'watering' - # && $propertie->{value}{duration} > 0 ){ - # Log3 $name, 2, "[DDebug] " . Time::Piece::localtime->strptime( - # RigReadingsValue($hash, $propertie->{timestamp}), "%Y-%m-%d %H:%M:%S"); - # my $dt = Time::Piece::localtime->strptime( RigReadingsValue($hash, $propertie->{timestamp}), "%Y-%m-%d %H:%M:%S"); - # Log3 $name, 2, "[DEBUG] $dt"; - # my $ndt = Time::Piece::localtime->new; - # Log3 $name, 2, "[cDEBUG] $ndt"; - # Log3 $name, 2, "[aDEBUG] " . ($propertie->{value}{duration} + 3 ); - # Log3 $name, 2, "[sDEBUG] " . sprintf("%.f" , - # Time::Piece::localtime->strptime( - # RigReadingsValue($hash, $propertie->{timestamp}), "%Y-%m-%d %H:%M:%S") - # + ($propertie->{value}{duration} + 3 ) - Time::Piece::localtime->new ); - # } -#2022-06-21T08:56:42.488Z -> 2022-06-21 08:56:48 - - - # $propertie->{value}{duration} - # $propertie->{value}{valve_id} - - - # Time::Piece->strptime( - # RigReadingsValue( $hash, $propertie->{timestamp} ), - # "%Y-%m-%d %H:%M:%S" )->add(seconds => ($propertie->{value}{duration} +3))) - - - - # "%Y-%m-%d %H:%M:%S" )->strftime('%s') - - - # "name": "watering_timer_4", - # "timestamp": "2022-06-21T08:56:42.488Z", + durati^n + 3 - # "unit": "complex", - # "value": { - # "state": "manual", - # "duration": 1497, - # "valve_id": 4 - - - } } @@ -1058,12 +1012,12 @@ sub setState { ? ( ReadingsVal($name, 'scheduling-schedules_paused_until', '' ) eq '' ) # leer ( zeitplan aktiv ... ) - ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash, 'next watering: %s')), (ReadingsVal( $name, 'watering-watering_timer_1_duration', 0 )/60), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '')) ) + ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash, 'next watering: %s')), (ReadingsVal( $name, 'watering-watering_timer_1_irrigation_left', 0 )/60), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '')) ) # zeitplan pausiert : ( ReadingsVal($name, 'scheduling-schedules_paused_until', '') eq '2038-01-18T00:00:00.000Z') # pause bis dauerhaft - ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash , 'schedule permanently paused')), (ReadingsVal( $name, 'watering-watering_timer_1_duration', 0 )/60) ) + ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash , 'schedule permanently paused')), (ReadingsVal( $name, 'watering-watering_timer_1_irrigation_left', 0 )/60) ) # naechter termin : sprintf( RigReadingsValue($hash , 'paused until %s'), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until', '')) ) # zu diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 75ef282..7f280c2 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-21_08:17:57 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-23_12:44:35 71419 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-23_12:54:46 69289 FHEM/74_GardenaSmartDevice.pm From 458edffa85fe15faa7e9f875cb177fe1497da09e Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 23 Jun 2022 13:33:27 +0200 Subject: [PATCH 49/88] [alpha] extendetState : fix irrigation left zero value --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 8 ++++---- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGED b/CHANGED index a2d7c19..ab55269 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [alpha] - extendetState - irrigation stuff + [alpha] excentedState - fix wc state, add irrigation duration diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 7aa4854..5378774 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -753,13 +753,13 @@ sub WriteReadings { $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name} . '_irrigation_left', - (Time::Piece::localtime->strptime( + ( $propertie->{value}{duration} > 0 ) ? (Time::Piece::localtime->strptime( RigReadingsValue($hash, $propertie->{timestamp}), "%Y-%m-%d %H:%M:%S") - + ($propertie->{value}{duration} + 3 ) - Time::Piece::localtime->new) + + ($propertie->{value}{duration} + 3 ) - Time::Piece::localtime->new) : 0 ) if ( defined( $propertie->{value} ) && $decode_json->{abilities}[$abilities]{name} eq 'watering' - && $propertie->{value}{duration} > 0 ); + ); } } @@ -1662,7 +1662,7 @@ sub SetPredefinedStartPoints { ], "release_status": "stable", "license": "GPL_2", - "version": "v2.4.4", + "version": "v2.5.3", "author": [ "Marko Oldenburg " ], diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 7f280c2..3696069 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-21_08:17:57 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-23_12:54:46 69289 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-23_13:33:10 69293 FHEM/74_GardenaSmartDevice.pm From c9b1e470cbd7830acfec93550c0ef708c0bc2b37 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 24 Jun 2022 13:20:54 +0200 Subject: [PATCH 50/88] [ALPHA] extendetState - permanentyl paused --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 8 ++++++-- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGED b/CHANGED index ab55269..0dc298d 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [alpha] excentedState - fix wc state, add irrigation duration + [alpha] extendetState : fix irrigation left zero value diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 5378774..cc36ea3 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -934,8 +934,12 @@ sub setState { # zu : ( $has_scheduling ) - # zeitplan aktiv - ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash, 'next watering: %s')), $nearst_irrigation ) + # zeitplan aktiv + ? ( $nearst_irrigation eq '2038-01-18T00:00:00.000Z') + # dauerhaft pausiert + ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash , 'schedule permanently paused')) ) + # naechster zeutplan + : sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash, 'next watering: %s')), $nearst_irrigation ) # zeitplan pausiert : RigReadingsValue($hash, 'closed') ; diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 3696069..7e1c9ac 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-21_08:17:57 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-23_13:33:10 69293 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-24_13:20:28 69569 FHEM/74_GardenaSmartDevice.pm From af3dee00a290d3ff4e0de441e131ccab037ab9d2 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 24 Jun 2022 13:57:07 +0200 Subject: [PATCH 51/88] [fix] - ix state --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGED b/CHANGED index 0dc298d..4b333b6 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [alpha] extendetState : fix irrigation left zero value + [ALPHA] extendetState - permanentyl paused diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index cc36ea3..2c4dd16 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -935,7 +935,7 @@ sub setState { : ( $has_scheduling ) # zeitplan aktiv - ? ( $nearst_irrigation eq '2038-01-18T00:00:00.000Z') + ? ( $nearst_irrigation eq '2038-01-18 00:00') # dauerhaft pausiert ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash , 'schedule permanently paused')) ) # naechster zeutplan diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 7e1c9ac..38c234a 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-06-21_08:17:57 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-24_13:20:28 69569 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-24_13:45:33 49520 FHEM/73_GardenaSmartBridge.pm +UPD 2022-06-24_13:56:39 69561 FHEM/74_GardenaSmartDevice.pm From 2cbe907db49838ad35914befd7eb3154975eb545 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 24 Jun 2022 18:40:46 +0200 Subject: [PATCH 52/88] [alpha] - extendedstate: state fix if empty or not exists --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 4b333b6..d6a2914 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [ALPHA] extendetState - permanentyl paused + [fix] - ix state diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 2c4dd16..cd677d1 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -893,7 +893,7 @@ sub setState { push @ic24opened_ventils, $_ if ( ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0 ) > 0 ); ## find nearst timestamp #$has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); - $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); + $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , 'N/A') eq '' ); $longest_duration = ReadingsVal( $name, "watering-watering_timer_".$_."_irrigation_left", 0 ) if ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > 0 diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 38c234a..631e12e 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-24_13:45:33 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-24_13:56:39 69561 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-24_18:40:19 69564 FHEM/74_GardenaSmartDevice.pm From 8dd9771033c16f6e8983debfa0f48cf10dbe2812 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 25 Jun 2022 16:17:28 +0200 Subject: [PATCH 53/88] [fix] - watering_next_start --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 6 +++++- controls_GardenaSmartDevice.txt | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGED b/CHANGED index d6a2914..413a9dc 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - ix state + [alpha] - extendedstate: state fix if empty or not exists diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index cd677d1..34b7eb7 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -798,8 +798,12 @@ sub WriteReadings { #ic24 schedules pause until if ($decode_json->{settings}[$settings]{name} =~ /schedules_paused_until_?\d?$/) { #my $ventil = substr($decode_json->{settings}[$settings]{name}, -1); # => 1 - 6 + # check if empty, clear scheduling-scheduled_watering_next_start_x readingsBulkUpdateIfChanged( $hash, 'scheduling-'.$decode_json->{settings}[$settings]{name}, $decode_json->{settings}[$settings]{value} ); + readingsBulkUpdateIfChanged( $hash, "scheduling-scheduled_watering_next_start_$1", $decode_json->{settings}[$settings]{value}) if ($decode_json->{settings}[$settings]{value} eq ''); + + # CommandAttr( undef, $name . " scheduling-scheduled_watering_next_start_") if ($decode_json->{settings}[$settings]{value} eq '' ) } ###### @@ -904,7 +908,7 @@ sub setState { $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') if ( Time::Piece->strptime( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, ''), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") - && $has_scheduling + && $has_scheduling && Time::Piece->strptime( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, ''), "%Y-%m-%d %H:%M") > Time::Pice->new ) } # fi } diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 631e12e..6d23b0a 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-06-24_13:45:33 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-24_18:40:19 69564 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-25_13:02:19 49520 FHEM/73_GardenaSmartBridge.pm +UPD 2022-06-25_16:17:07 70122 FHEM/74_GardenaSmartDevice.pm From 197dba15f1186298cf4490d17ace72a340ba079e Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 26 Jun 2022 19:22:06 +0200 Subject: [PATCH 54/88] fix - clear next_start --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 413a9dc..b37aa01 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [alpha] - extendedstate: state fix if empty or not exists + [fix] - watering_next_start diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 34b7eb7..7514123 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -796,7 +796,7 @@ sub WriteReadings { } ##### #ic24 schedules pause until - if ($decode_json->{settings}[$settings]{name} =~ /schedules_paused_until_?\d?$/) { + if ($decode_json->{settings}[$settings]{name} =~ /schedules_paused_until_?(\d)?$/) { #my $ventil = substr($decode_json->{settings}[$settings]{name}, -1); # => 1 - 6 # check if empty, clear scheduling-scheduled_watering_next_start_x readingsBulkUpdateIfChanged( $hash, 'scheduling-'.$decode_json->{settings}[$settings]{name}, diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 6d23b0a..ab581e7 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-25_13:02:19 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-25_16:17:07 70122 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-26_19:21:34 70124 FHEM/74_GardenaSmartDevice.pm From 2eefd813dfa04601cb61e9e7ba1ff8677a242c3a Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 26 Jun 2022 19:24:38 +0200 Subject: [PATCH 55/88] [fix] - cleanup --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index b37aa01..e094dbe 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - watering_next_start + fix - clear next_start diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 7514123..07d1ce8 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -908,7 +908,7 @@ sub setState { $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') if ( Time::Piece->strptime( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, ''), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") - && $has_scheduling && Time::Piece->strptime( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, ''), "%Y-%m-%d %H:%M") > Time::Pice->new + && $has_scheduling && Time::Piece->strptime( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, ''), "%Y-%m-%d %H:%M") > Time::Piece->new ) } # fi } diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index ab581e7..77fe359 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-25_13:02:19 49520 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-26_19:21:34 70124 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-26_19:24:09 70125 FHEM/74_GardenaSmartDevice.pm From 1b7670f8c5aeecbea2719468492396181691d42a Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 28 Jun 2022 13:06:32 +0200 Subject: [PATCH 56/88] [fix] - fixup debug code stuff --- CHANGED | 2 +- FHEM/73_GardenaSmartBridge.pm | 10 ++++++---- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGED b/CHANGED index e094dbe..4e63a70 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - fix - clear next_start + [fix] - cleanup diff --git a/FHEM/73_GardenaSmartBridge.pm b/FHEM/73_GardenaSmartBridge.pm index 19297c3..463e2f5 100644 --- a/FHEM/73_GardenaSmartBridge.pm +++ b/FHEM/73_GardenaSmartBridge.pm @@ -746,11 +746,13 @@ sub ErrorHandling { $i = 0; for my $dev_settings ( @{ $devJson->{abilities} } ) { - $output .= "[" . $i++ . "]id: $dev_settings->{id} \n"; - $output .= "name: $dev_settings->{name} "; + $output .= "[" . $i++ . "]\nid: $dev_settings->{id} \n"; + $output .= "name: $dev_settings->{name} \n"; - if ( ref( $dev_settings->{value} ) eq 'ARRAY' + if (( ref( $dev_settings->{value} ) eq 'ARRAY' || ref( $dev_settings->{value} ) eq 'HASH' ) + && (defined($dev_settings->{value}))) + { $output .= 'N/A \n'; } @@ -1577,7 +1579,7 @@ sub DeletePassword { ], "release_status": "stable", "license": "GPL_2", - "version": "v2.4.7", + "version": "v2.4.8", "author": [ "Marko Oldenburg " ], diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 77fe359..584c48f 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-06-25_13:02:19 49520 FHEM/73_GardenaSmartBridge.pm +UPD 2022-06-28_13:06:17 49580 FHEM/73_GardenaSmartBridge.pm UPD 2022-06-26_19:24:09 70125 FHEM/74_GardenaSmartDevice.pm From 2a5872002f1af53c6d5b2a06f9c9204e86ba67ca Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 28 Jun 2022 13:08:47 +0200 Subject: [PATCH 57/88] [fix] - debug stuff --- CHANGED | 2 +- FHEM/73_GardenaSmartBridge.pm | 15 ++------------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/CHANGED b/CHANGED index 4e63a70..d77d71e 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - cleanup + [fix] - fixup debug code stuff diff --git a/FHEM/73_GardenaSmartBridge.pm b/FHEM/73_GardenaSmartBridge.pm index 463e2f5..8e6dd53 100644 --- a/FHEM/73_GardenaSmartBridge.pm +++ b/FHEM/73_GardenaSmartBridge.pm @@ -731,7 +731,7 @@ sub ErrorHandling { my $i = 0; for my $dev_settings ( @{ $devJson->{settings} } ) { $output .= "[" . $i++ . "]id: $dev_settings->{id} \n"; - $output .= "name: $dev_settings->{name} "; + $output .= "name: $dev_settings->{name} \n"; if ( ref( $dev_settings->{value} ) eq 'ARRAY' || ref( $dev_settings->{value} ) eq 'HASH' ) { @@ -747,18 +747,7 @@ sub ErrorHandling { for my $dev_settings ( @{ $devJson->{abilities} } ) { $output .= "[" . $i++ . "]\nid: $dev_settings->{id} \n"; - $output .= "name: $dev_settings->{name} \n"; - - if (( ref( $dev_settings->{value} ) eq 'ARRAY' - || ref( $dev_settings->{value} ) eq 'HASH' ) - && (defined($dev_settings->{value}))) - - { - $output .= 'N/A \n'; - } - else { - $output .= "value: $dev_settings->{value} \n"; - } + $output .= "name: $dev_settings->{name} "; } $hash->{helper}{debug_device_output} = $output; diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 584c48f..0ec5ad1 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-06-28_13:06:17 49580 FHEM/73_GardenaSmartBridge.pm +UPD 2022-06-28_13:08:35 49241 FHEM/73_GardenaSmartBridge.pm UPD 2022-06-26_19:24:09 70125 FHEM/74_GardenaSmartDevice.pm From 9b1170a97832ba6e8d6fecd4df64ec5318317e8c Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 28 Jun 2022 13:10:10 +0200 Subject: [PATCH 58/88] [fix] - debug stuff --- CHANGED | 2 +- FHEM/73_GardenaSmartBridge.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index d77d71e..b7378f1 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - fixup debug code stuff + [fix] - debug stuff diff --git a/FHEM/73_GardenaSmartBridge.pm b/FHEM/73_GardenaSmartBridge.pm index 8e6dd53..b771f02 100644 --- a/FHEM/73_GardenaSmartBridge.pm +++ b/FHEM/73_GardenaSmartBridge.pm @@ -747,7 +747,7 @@ sub ErrorHandling { for my $dev_settings ( @{ $devJson->{abilities} } ) { $output .= "[" . $i++ . "]\nid: $dev_settings->{id} \n"; - $output .= "name: $dev_settings->{name} "; + $output .= "name: $dev_settings->{name} \n"; } $hash->{helper}{debug_device_output} = $output; diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 0ec5ad1..dec7fe9 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-06-28_13:08:35 49241 FHEM/73_GardenaSmartBridge.pm +UPD 2022-06-28_13:09:29 49243 FHEM/73_GardenaSmartBridge.pm UPD 2022-06-26_19:24:09 70125 FHEM/74_GardenaSmartDevice.pm From 929bd705d59b0fa38f3c964d5efad7e157cd3788 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 28 Jun 2022 13:11:28 +0200 Subject: [PATCH 59/88] [fix] - debug stuff - cleanup --- FHEM/73_GardenaSmartBridge.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FHEM/73_GardenaSmartBridge.pm b/FHEM/73_GardenaSmartBridge.pm index b771f02..8a8710f 100644 --- a/FHEM/73_GardenaSmartBridge.pm +++ b/FHEM/73_GardenaSmartBridge.pm @@ -746,7 +746,7 @@ sub ErrorHandling { $i = 0; for my $dev_settings ( @{ $devJson->{abilities} } ) { - $output .= "[" . $i++ . "]\nid: $dev_settings->{id} \n"; + $output .= "[" . $i++ . "]id: $dev_settings->{id} \n"; $output .= "name: $dev_settings->{name} \n"; } diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index dec7fe9..fec81e9 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-06-28_13:09:29 49243 FHEM/73_GardenaSmartBridge.pm +UPD 2022-06-28_13:11:16 49241 FHEM/73_GardenaSmartBridge.pm UPD 2022-06-26_19:24:09 70125 FHEM/74_GardenaSmartDevice.pm From ae3bf5f68ab36dc84a3187af135b7eaa96303a33 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 28 Jun 2022 23:03:42 +0200 Subject: [PATCH 60/88] [fix] - readings --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 32 +++++++++++++++++--------------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/CHANGED b/CHANGED index b7378f1..08460dd 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - debug stuff + [fix] - debug stuff - cleanup diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 07d1ce8..dfac0a3 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -652,9 +652,9 @@ sub WriteReadings { $hash, $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name}, - RigReadingsValue( $hash, $propertie->{value} ) + ($propertie->{value} eq '') ? 'N/A' : RigReadingsValue( $hash, $propertie->{value} ) ) - if ( defined( $propertie->{value} ) + if ( exists( $propertie->{value} ) # defined ignored 'value':null && $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name} ne 'radio-quality' && $decode_json->{abilities}[$abilities]{name} . '-' @@ -743,8 +743,6 @@ sub WriteReadings { . $r, RigReadingsValue( $hash, $v ) ); - - Log3 $name, 3, "[DEBUG] - GardenaSmartDevice ($name) Ventil $propertie->{name} $r: $v"; } } # ic24 and other watering devices calc irrigation left in sec @@ -801,8 +799,6 @@ sub WriteReadings { # check if empty, clear scheduling-scheduled_watering_next_start_x readingsBulkUpdateIfChanged( $hash, 'scheduling-'.$decode_json->{settings}[$settings]{name}, $decode_json->{settings}[$settings]{value} ); - readingsBulkUpdateIfChanged( $hash, "scheduling-scheduled_watering_next_start_$1", $decode_json->{settings}[$settings]{value}) if ($decode_json->{settings}[$settings]{value} eq ''); - # CommandAttr( undef, $name . " scheduling-scheduled_watering_next_start_") if ($decode_json->{settings}[$settings]{value} eq '' ) } @@ -897,20 +893,26 @@ sub setState { push @ic24opened_ventils, $_ if ( ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0 ) > 0 ); ## find nearst timestamp #$has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); - $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , 'N/A') eq '' ); + $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , 'N/A') eq '' ); + #$has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , 'N/A') eq '' ); $longest_duration = ReadingsVal( $name, "watering-watering_timer_".$_."_irrigation_left", 0 ) if ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > 0 && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > $longest_duration ) ); - if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') ne '' - && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' ) { - $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') - if ( - Time::Piece->strptime( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, ''), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") - && $has_scheduling && Time::Piece->strptime( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, ''), "%Y-%m-%d %H:%M") > Time::Piece->new - ) - } # fi + # if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') ne '' + # && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' ) { + # $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); + # $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') + # if ( + # Time::Piece->strptime( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, ''), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") + # && $has_scheduling && Time::Piece->strptime( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, ''), "%Y-%m-%d %H:%M") > Time::Piece->new + # ) + # } # fi + + $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '') + if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') ne '' ); + } # override state 4 extendedstates if ( AttrVal( $name, "extendedState", 0 ) == 1) { diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index fec81e9..2ce0f2e 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-28_13:11:16 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-26_19:24:09 70125 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-28_23:03:29 70402 FHEM/74_GardenaSmartDevice.pm From ee0c7fa4ba79a4658f2ab4c6d88d303864919e14 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 28 Jun 2022 23:07:34 +0200 Subject: [PATCH 61/88] [test] set empty --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 3 ++- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 08460dd..7dd7fc7 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - debug stuff - cleanup + [fix] - readings diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index dfac0a3..29a3a41 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -652,7 +652,8 @@ sub WriteReadings { $hash, $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name}, - ($propertie->{value} eq '') ? 'N/A' : RigReadingsValue( $hash, $propertie->{value} ) + ($propertie->{value} eq '') ? CommandAttr( undef, $name . ' '. $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name}) : RigReadingsValue( $hash, $propertie->{value} ) ) if ( exists( $propertie->{value} ) # defined ignored 'value':null && $decode_json->{abilities}[$abilities]{name} . '-' diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 2ce0f2e..4798154 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-28_13:11:16 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-28_23:03:29 70402 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-28_23:07:24 70523 FHEM/74_GardenaSmartDevice.pm From 7cefd1c7e3929fc201521cd5032d16d5326f558d Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 28 Jun 2022 23:08:35 +0200 Subject: [PATCH 62/88] d --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 3 +-- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGED b/CHANGED index 7dd7fc7..5bd7cdd 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - readings + [test] set empty diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 29a3a41..50f1639 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -652,8 +652,7 @@ sub WriteReadings { $hash, $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name}, - ($propertie->{value} eq '') ? CommandAttr( undef, $name . ' '. $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name}) : RigReadingsValue( $hash, $propertie->{value} ) + ($propertie->{value} eq '') ? undef : RigReadingsValue( $hash, $propertie->{value} ) ) if ( exists( $propertie->{value} ) # defined ignored 'value':null && $decode_json->{abilities}[$abilities]{name} . '-' diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 4798154..2e958c1 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-28_13:11:16 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-28_23:07:24 70523 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-28_23:08:30 70402 FHEM/74_GardenaSmartDevice.pm From 200751b72b8aa378e3050209d594c3996e5987a9 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 28 Jun 2022 23:09:33 +0200 Subject: [PATCH 63/88] [fix] - rollback --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 5bd7cdd..d2aecf8 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [test] set empty + d diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 50f1639..dfac0a3 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -652,7 +652,7 @@ sub WriteReadings { $hash, $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name}, - ($propertie->{value} eq '') ? undef : RigReadingsValue( $hash, $propertie->{value} ) + ($propertie->{value} eq '') ? 'N/A' : RigReadingsValue( $hash, $propertie->{value} ) ) if ( exists( $propertie->{value} ) # defined ignored 'value':null && $decode_json->{abilities}[$abilities]{name} . '-' diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 2e958c1..16a3083 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-28_13:11:16 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-28_23:08:30 70402 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-28_23:09:26 70402 FHEM/74_GardenaSmartDevice.pm From 54b378d0947a9ff86c563aedeb0c253825a6e7ad Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 29 Jun 2022 09:00:03 +0200 Subject: [PATCH 64/88] [visual] - lowercase not available --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 7 ++++--- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGED b/CHANGED index d2aecf8..7eead8c 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - d + [fix] - rollback diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index dfac0a3..23ea60f 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -652,7 +652,7 @@ sub WriteReadings { $hash, $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name}, - ($propertie->{value} eq '') ? 'N/A' : RigReadingsValue( $hash, $propertie->{value} ) + ($propertie->{value} eq '') ? RigReadingsValue( $hash, 'n/a') : RigReadingsValue( $hash, $propertie->{value} ) ) if ( exists( $propertie->{value} ) # defined ignored 'value':null && $decode_json->{abilities}[$abilities]{name} . '-' @@ -893,8 +893,8 @@ sub setState { push @ic24opened_ventils, $_ if ( ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0 ) > 0 ); ## find nearst timestamp #$has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); - $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , 'N/A') eq '' ); - #$has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , 'N/A') eq '' ); + $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , 'n/a') eq '' ); + #$has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , 'n/a') eq '' ); $longest_duration = ReadingsVal( $name, "watering-watering_timer_".$_."_irrigation_left", 0 ) if ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > 0 @@ -1191,6 +1191,7 @@ sub ReadingLangGerman { 'paused until %s' => 'pausiert bis %s', 'will be irrigated %.f minutes remaining.'=> 'Wird bewässert. %.f Minuten verbleibend.', 'next watering: %s' => 'Nächste Bewässerung: %s', + 'n/a' => 'nicht verfügbar', ); if ( diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 16a3083..601ddd7 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-28_13:11:16 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-28_23:09:26 70402 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-29_08:59:49 70492 FHEM/74_GardenaSmartDevice.pm From 0086f52d7407c8e50461b9ba863debb8f5a21c33 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 29 Jun 2022 12:26:39 +0200 Subject: [PATCH 65/88] [alpha] extendedState - fix empty reading + state ic24/wc --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 9 +++++---- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGED b/CHANGED index 7eead8c..41f11fe 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - rollback + [visual] - lowercase not available diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 23ea60f..352d20f 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -893,7 +893,7 @@ sub setState { push @ic24opened_ventils, $_ if ( ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0 ) > 0 ); ## find nearst timestamp #$has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); - $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , 'n/a') eq '' ); + $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne 'n/a' ); #$has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , 'n/a') eq '' ); $longest_duration = ReadingsVal( $name, "watering-watering_timer_".$_."_irrigation_left", 0 ) if ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms @@ -910,8 +910,8 @@ sub setState { # ) # } # fi - $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '') - if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') ne '' ); + $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); + # if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, 'n/a') ne 'n/a' ); } # override state 4 extendedstates @@ -941,7 +941,8 @@ sub setState { : ( $has_scheduling ) # zeitplan aktiv - ? ( $nearst_irrigation eq '2038-01-18 00:00') + # ? ( $nearst_irrigation eq '2038-01-18 00:00') + ? ( $nearst_irrigation eq 'n/a') # dauerhaft pausiert ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash , 'schedule permanently paused')) ) # naechster zeutplan diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 601ddd7..5859ea2 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-28_13:11:16 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-29_08:59:49 70492 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-29_12:23:57 70548 FHEM/74_GardenaSmartDevice.pm From 967ec86ea1794de269a015a8fbb6171d1728407c Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 29 Jun 2022 13:38:08 +0200 Subject: [PATCH 66/88] [fix] - state ohne plan , nicht listen --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 41f11fe..31a7719 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [visual] - lowercase not available + [alpha] extendedState - fix empty reading + state ic24/wc diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 352d20f..543f93a 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -942,7 +942,7 @@ sub setState { ( $has_scheduling ) # zeitplan aktiv # ? ( $nearst_irrigation eq '2038-01-18 00:00') - ? ( $nearst_irrigation eq 'n/a') + ? ( $nearst_irrigation eq RigReadingsValue( $hash, 'n/a') ) # dauerhaft pausiert ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash , 'schedule permanently paused')) ) # naechster zeutplan diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 5859ea2..3426edb 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-28_13:11:16 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-29_12:23:57 70548 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-29_13:37:44 70575 FHEM/74_GardenaSmartDevice.pm From bc4b6eecf53ae62533d72e5c6a4ba12c175022ca Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 30 Jun 2022 11:37:01 +0200 Subject: [PATCH 67/88] [fix] - timer paused >1 jahr --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 16 ++++++++-------- controls_GardenaSmartDevice.txt | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CHANGED b/CHANGED index 31a7719..b855594 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [alpha] extendedState - fix empty reading + state ic24/wc + [fix] - state ohne plan , nicht listen diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 543f93a..dedd42a 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -901,16 +901,16 @@ sub setState { && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > $longest_duration ) ); # if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') ne '' - # && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' ) { + if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' ) { # $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); - # $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') - # if ( - # Time::Piece->strptime( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, ''), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") - # && $has_scheduling && Time::Piece->strptime( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, ''), "%Y-%m-%d %H:%M") > Time::Piece->new - # ) - # } # fi + $nearst_irrigation = ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '') + if ( + Time::Piece->strptime( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, ''), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") + && $has_scheduling && Time::Piece->strptime( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, ''), "%Y-%m-%d %H:%M") > Time::Piece->new + ) + } # fi - $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); + #$nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); # if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, 'n/a') ne 'n/a' ); } diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 3426edb..b7deb9a 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-06-28_13:11:16 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-29_13:37:44 70575 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-29_20:41:04 49241 FHEM/73_GardenaSmartBridge.pm +UPD 2022-06-30_11:36:45 70541 FHEM/74_GardenaSmartDevice.pm From 6d684ade924a3962ec62bf86cbedbfc8c79e56db Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 30 Jun 2022 13:09:32 +0200 Subject: [PATCH 68/88] [fix] time piece --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 6 +++--- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGED b/CHANGED index b855594..ec3b7c3 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - state ohne plan , nicht listen + [fix] - timer paused >1 jahr diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index dedd42a..8e69f63 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -903,10 +903,10 @@ sub setState { # if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') ne '' if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' ) { # $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); - $nearst_irrigation = ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '') + $nearst_irrigation = RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')) if ( - Time::Piece->strptime( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, ''), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") - && $has_scheduling && Time::Piece->strptime( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, ''), "%Y-%m-%d %H:%M") > Time::Piece->new + Time::Piece->strptime( RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") + && $has_scheduling && Time::Piece->strptime( RigReadingsValue($has, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')), "%Y-%m-%d %H:%M") > Time::Piece->new ) } # fi diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index b7deb9a..2a52add 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-29_20:41:04 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-30_11:36:45 70541 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-30_13:09:23 70614 FHEM/74_GardenaSmartDevice.pm From 782ad5f0a99e3814e085a23fa2d2a8fbb9299acc Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 30 Jun 2022 20:11:32 +0200 Subject: [PATCH 69/88] [fix] - tip fehler --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index ec3b7c3..4d45523 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - timer paused >1 jahr + [fix] time piece diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 8e69f63..869f875 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -906,7 +906,7 @@ sub setState { $nearst_irrigation = RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')) if ( Time::Piece->strptime( RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") - && $has_scheduling && Time::Piece->strptime( RigReadingsValue($has, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')), "%Y-%m-%d %H:%M") > Time::Piece->new + && $has_scheduling && Time::Piece->strptime( RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')), "%Y-%m-%d %H:%M") > Time::Piece->new ) } # fi diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 2a52add..86d4406 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-06-29_20:41:04 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-30_13:09:23 70614 FHEM/74_GardenaSmartDevice.pm +UPD 2022-06-30_20:11:23 70615 FHEM/74_GardenaSmartDevice.pm From c084fabc92b351344426e6feae7cda188290ceaa Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 7 Jul 2022 13:22:38 +0200 Subject: [PATCH 70/88] [fix] - try 2 fix nearst irrigateion > 1 year --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 29 +++++++++++++++++++++-------- controls_GardenaSmartDevice.txt | 4 ++-- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/CHANGED b/CHANGED index 4d45523..56ad212 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] time piece + [fix] - tip fehler diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 869f875..e000019 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -893,7 +893,7 @@ sub setState { push @ic24opened_ventils, $_ if ( ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0 ) > 0 ); ## find nearst timestamp #$has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); - $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne 'n/a' ); + $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '' ); #$has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , 'n/a') eq '' ); $longest_duration = ReadingsVal( $name, "watering-watering_timer_".$_."_irrigation_left", 0 ) if ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms @@ -901,13 +901,26 @@ sub setState { && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > $longest_duration ) ); # if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') ne '' + # --- wenn next_start_x ne 'na' && paused_until_x eq '' -> start_x if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' ) { - # $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); - $nearst_irrigation = RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')) - if ( - Time::Piece->strptime( RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") - && $has_scheduling && Time::Piece->strptime( RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')), "%Y-%m-%d %H:%M") > Time::Piece->new - ) + # $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); + + # $nearst_irrigation = RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')) + # if ( + # Time::Piece->strptime( RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") + # && $has_scheduling && Time::Piece->strptime( RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')), "%Y-%m-%d %H:%M") > Time::Piece->new + # ) + if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '') eq '' ) { # non next start, schedules paused permanently or next schedule > 1 year; get nearst paused_until + $nearst_irrigation = RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')) + if ( Time::Piece->strptime( RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')), "%Y-%m-%d %H:%M") + < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") + && $has_scheduling + && Time::Piece->strptime( RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')), "%Y-%m-%d %H:%M") + > Time::Piece->new + ) + } else { + $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); + } } # fi #$nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); @@ -942,7 +955,7 @@ sub setState { ( $has_scheduling ) # zeitplan aktiv # ? ( $nearst_irrigation eq '2038-01-18 00:00') - ? ( $nearst_irrigation eq RigReadingsValue( $hash, 'n/a') ) + ? ( $nearst_irrigation eq RigReadingsValue( $hash, 'n/a') || $nearst_irrigation eq '2038-01-18 00:00') # dauerhaft pausiert ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash , 'schedule permanently paused')) ) # naechster zeutplan diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 86d4406..4f27717 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-06-29_20:41:04 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-06-30_20:11:23 70615 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-01_16:13:02 49241 FHEM/73_GardenaSmartBridge.pm +UPD 2022-07-07_13:22:07 71695 FHEM/74_GardenaSmartDevice.pm From 6f1eebcf48fdba5951d5ae714d3e4e5fa940d2a4 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 7 Jul 2022 20:03:57 +0200 Subject: [PATCH 71/88] [fix] - change condition has_schedule --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 3 ++- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 56ad212..017f069 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - tip fehler + [fix] - try 2 fix nearst irrigateion > 1 year diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index e000019..32a3979 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -893,7 +893,8 @@ sub setState { push @ic24opened_ventils, $_ if ( ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0 ) > 0 ); ## find nearst timestamp #$has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); - $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '' ); + ## wenn nicht dauerhaft pausiert , dann zeitplan vorhanden. + $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z'; #&& ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); #$has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , 'n/a') eq '' ); $longest_duration = ReadingsVal( $name, "watering-watering_timer_".$_."_irrigation_left", 0 ) if ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 4f27717..d329df7 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-01_16:13:02 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-07_13:22:07 71695 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-07_20:03:42 71765 FHEM/74_GardenaSmartDevice.pm From 9643a9074f92eb7048541b45e320cf5f3c1dcfcc Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 7 Jul 2022 20:05:16 +0200 Subject: [PATCH 72/88] [fix] - condition has_schedule --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 017f069..94b8ea4 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - try 2 fix nearst irrigateion > 1 year + [fix] - change condition has_schedule diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 32a3979..192f4ae 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -894,7 +894,7 @@ sub setState { ## find nearst timestamp #$has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); ## wenn nicht dauerhaft pausiert , dann zeitplan vorhanden. - $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z'; #&& ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); + $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' ); #&& ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); #$has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , 'n/a') eq '' ); $longest_duration = ReadingsVal( $name, "watering-watering_timer_".$_."_irrigation_left", 0 ) if ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index d329df7..09e92f9 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-01_16:13:02 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-07_20:03:42 71765 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-07_20:04:59 71767 FHEM/74_GardenaSmartDevice.pm From 8ce72c5ddc7a01842668a896fd4a3d26fc88ab3d Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 8 Jul 2022 12:29:27 +0200 Subject: [PATCH 73/88] [NEW] - implementation schedules infos --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 210 +++++++++++++++++++------------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 129 insertions(+), 85 deletions(-) diff --git a/CHANGED b/CHANGED index 94b8ea4..69d6f4c 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - change condition has_schedule + [fix] - condition has_schedule diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 192f4ae..71e598d 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -189,23 +189,23 @@ sub Define { my $deviceId = $aArg->[2]; my $category = $aArg->[3]; - $hash->{DEVICEID} = $deviceId; - $hash->{VERSION} = version->parse($VERSION)->normal; - $hash->{helper}{STARTINGPOINTID} = ''; - $hash->{helper}{schedules_paused_until_id} = ''; - $hash->{helper}{eco_mode_id} = ''; - $hash->{helper}{button_config_time_id} = ''; - $hash->{helper}{winter_mode_id} = ''; + $hash->{DEVICEID} = $deviceId; + $hash->{VERSION} = version->parse($VERSION)->normal; + $hash->{helper}{STARTINGPOINTID} = ''; + $hash->{helper}{schedules_paused_until_id} = ''; + $hash->{helper}{eco_mode_id} = ''; + $hash->{helper}{button_config_time_id} = ''; + $hash->{helper}{winter_mode_id} = ''; $hash->{helper}{_id} = ''; # IrrigationControl valve control max 6 - $hash->{helper}{schedules_paused_until_1_id} = ''; - $hash->{helper}{schedules_paused_until_2_id} = ''; - $hash->{helper}{schedules_paused_until_3_id} = ''; - $hash->{helper}{schedules_paused_until_4_id} = ''; - $hash->{helper}{schedules_paused_until_5_id} = ''; - $hash->{helper}{schedules_paused_until_6_id} = ''; + $hash->{helper}{schedules_paused_until_1_id} = ''; + $hash->{helper}{schedules_paused_until_2_id} = ''; + $hash->{helper}{schedules_paused_until_3_id} = ''; + $hash->{helper}{schedules_paused_until_4_id} = ''; + $hash->{helper}{schedules_paused_until_5_id} = ''; + $hash->{helper}{schedules_paused_until_6_id} = ''; CommandAttr( undef, "$name IODev $modules{GardenaSmartBridge}{defptr}{BRIDGE}->{NAME}" ) @@ -609,6 +609,7 @@ sub WriteReadings { my $name = $hash->{NAME}; my $abilities = scalar( @{ $decode_json->{abilities} } ); my $settings = scalar( @{ $decode_json->{settings} } ); + my $scheduled_events = scalar( @{ $decode_json->{scheduled_events} } ); readingsBeginUpdate($hash); @@ -628,6 +629,7 @@ sub WriteReadings { 'watering' ) ) { + if ( $propertie->{name} eq 'button_config_time' ) { if ( $hash->{helper}{ $propertie->{name} . '_id' } ne $decode_json->{abilities}[$abilities]{id} ) @@ -764,6 +766,35 @@ sub WriteReadings { $abilities--; } while ( $abilities >= 0 ); + + if ( + exists( $decode_json->{scheduled_events} ) + && scalar ($decode_json->{scheduled_events} > 0 + && ref ($decode_json->{scheduled_events}) eq 'ARRAY' ) + ) { + readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_events_count', + scalar ($decode_json->{scheduled_events} ) ); + my $valve_id = 1; # ic24 [1..6] | wc, pump [1] + + for my $event_schedules ( @{ $decode_json->{scheduled_events} } ) { + $valve_id = $event_schedules->{valve_id} if ( exists($event_schedules->{valve_id} ) ); #ic24 + + while ( my ( $r, $v ) = each %{ $event_schedules } ) { + readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_valve_' + . $valve_id + . '_' + . $v, + $r) if (ref($v) ne 'HASH' ); + readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_valve_' + . $valve_id + . '_' + . $v->{type}, + join(',', @ { $v->{weekdays}}) ) if (ref($v) qe 'HASH' ); + }; + }; + + }; # fi scheduled_events + my $winter_mode; do { @@ -882,55 +913,67 @@ sub setState { : 'offline' ) if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' ); - # ic24 - if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ){ - my @ic24opened_ventils; - my $state_string = ''; my $nearst_irrigation = '2038-01-18 00:00'; - my $has_scheduling = 0; my $longest_duration = 0; - my @valves_connected = split(',', ReadingsVal( $name, 'ic24-valves_connected', '')); - for (@valves_connected){ + # ic24 / wc / electronic pump + + if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' + || AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' + || AttrVal( $name, 'model', 'unknown' ) eq 'electronic_water_pump' ){ + my @opened_valves; + my $state_string = ''; my $nearst_irrigation = ''; + my $has_schedule = 0; my $longest_duration = 0; + my @valves_connected = AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ? split(',', ReadingsVal( $name, 'ic24-valves_connected', '')) : '1'; + + for (@valves_connected){ # valves 1 or 1..6 ## add to opened ventils, if watering active - push @ic24opened_ventils, $_ if ( ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0 ) > 0 ); - ## find nearst timestamp - #$has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' && ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); - ## wenn nicht dauerhaft pausiert , dann zeitplan vorhanden. - $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' ); #&& ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); - #$has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , 'n/a') eq '' ); + push @opened_valves, $_ if ( ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0 ) > 0 ); + ## find longest irrigation duration $longest_duration = ReadingsVal( $name, "watering-watering_timer_".$_."_irrigation_left", 0 ) if ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > 0 && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > $longest_duration ) ); + + ## wenn nicht dauerhaft pausiert , dann zeitplan vorhanden oder datum der pause enthalten in T Zulu + $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' ) - # if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') ne '' - # --- wenn next_start_x ne 'na' && paused_until_x eq '' -> start_x - if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' ) { - # $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); - # $nearst_irrigation = RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')) - # if ( - # Time::Piece->strptime( RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") - # && $has_scheduling && Time::Piece->strptime( RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')), "%Y-%m-%d %H:%M") > Time::Piece->new - # ) - if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '') eq '' ) { # non next start, schedules paused permanently or next schedule > 1 year; get nearst paused_until - $nearst_irrigation = RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')) - if ( Time::Piece->strptime( RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')), "%Y-%m-%d %H:%M") - < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") - && $has_scheduling - && Time::Piece->strptime( RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')), "%Y-%m-%d %H:%M") - > Time::Piece->new - ) - } else { - $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); - } - } # fi - - #$nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); - # if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, 'n/a') ne 'n/a' ); - - } +###### +###### +###### $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' ); #&& ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') eq '' ); +###### #$has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , 'n/a') eq '' ); +###### +###### # if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, '') ne '' +###### # --- wenn next_start_x ne 'na' && paused_until_x eq '' -> start_x +###### ## scheduling-schedules_paused_until_* = leer oder n/a -> keine zeitpläne +###### +###### if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' ) { +###### # $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); +###### Log3 $name, 3, "[DEBUG] - "; +###### +###### # $nearst_irrigation = RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')) +###### # if ( +###### # Time::Piece->strptime( RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')), "%Y-%m-%d %H:%M") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") +###### # && $has_scheduling && Time::Piece->strptime( RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')), "%Y-%m-%d %H:%M") > Time::Piece->new +###### # ) +###### if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '') eq '' ) { # non next start, schedules paused permanently or next schedule > 1 year; get nearst paused_until +###### $nearst_irrigation = RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')) +###### if ( Time::Piece->strptime( RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')), "%Y-%m-%d %H:%M") +###### < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") +###### && $has_scheduling +###### && Time::Piece->strptime( RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')), "%Y-%m-%d %H:%M") +###### > Time::Piece->new +###### ) +###### } else { +###### $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); +###### } +###### } # fi +###### +###### #$nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); +###### # if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start_'.$_, 'n/a') ne 'n/a' ); +###### + } # for # override state 4 extendedstates if ( AttrVal( $name, "extendedState", 0 ) == 1) { - if (scalar(@ic24opened_ventils) > 0){ + if (scalar(@opened_valves) > 0){ ## valve 1 will be ir.. 23 minutes remaining for (@valves_connected){ $state_string .= sprintf(RigReadingsValue($hash,'valve').' '.$_.' '.(RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.') .'
'), (ReadingsVal( $name, 'watering-watering_timer_'.$_.'_duration', 0 )/60)); @@ -947,8 +990,8 @@ sub setState { ' ) if ( AttrVal( $name, 'stateFormat', 'none' ) eq 'none' ); } else { - Log3 $name, 3, "[DEBUG] - Offene Ventile :".scalar(@ic24opened_ventils)." laengste bewaesserung: $longest_duration . hat Zeitplan: $has_scheduling Naechster Zeitplan: $nearst_irrigation"; - $state_string = scalar(@ic24opened_ventils) > 0 + Log3 $name, 3, "[DEBUG] - Offene Ventile :".scalar(@opened_valves)." laengste bewaesserung: $longest_duration . hat Zeitplan: $has_scheduling Naechster Zeitplan: $nearst_irrigation"; + $state_string = scalar(@opened_valves) > 0 # offen ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.')), $longest_duration/60) # zu @@ -1029,36 +1072,37 @@ sub setState { # Wird bewässert xx Minuten verbleibend" und "Nächste Bewässerung heute um xx:yy Uhr" # 4. Ventil manuell geoeffnet, Zeitpläne deaktiviert. # App zeigt: "Wird bewässert xx Minuten verbleibend" - if ( AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' ){ + ### CHANGE to one + # if ( AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' ){ - my $state_string = ReadingsVal( $name, 'watering-watering_timer_1_duration', 0 ) =~ - m{\A[1-9]([0-9]+)?\z}xms - # offen - ? - ( ReadingsVal($name, 'scheduling-schedules_paused_until', '' ) eq '' ) - # leer ( zeitplan aktiv ... ) - ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash, 'next watering: %s')), (ReadingsVal( $name, 'watering-watering_timer_1_irrigation_left', 0 )/60), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '')) ) - # zeitplan pausiert - : - ( ReadingsVal($name, 'scheduling-schedules_paused_until', '') eq '2038-01-18T00:00:00.000Z') - # pause bis dauerhaft - ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash , 'schedule permanently paused')), (ReadingsVal( $name, 'watering-watering_timer_1_irrigation_left', 0 )/60) ) - # naechter termin - : sprintf( RigReadingsValue($hash , 'paused until %s'), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until', '')) ) - # zu - : - ( ReadingsVal($name, 'scheduling-schedules_paused_until', '' ) eq '' ) - # zeitplan aktiv - ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash, 'next watering: %s')), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '') ) ) - # zeitplan pausiert - : RigReadingsValue($hash, 'closed') - ; - # state offline | override - $state_string = 'offline' if ($online_state eq 'offline'); + # my $state_string = ReadingsVal( $name, 'watering-watering_timer_1_duration', 0 ) =~ + # m{\A[1-9]([0-9]+)?\z}xms + # # offen + # ? + # ( ReadingsVal($name, 'scheduling-schedules_paused_until', '' ) eq '' ) + # # leer ( zeitplan aktiv ... ) + # ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash, 'next watering: %s')), (ReadingsVal( $name, 'watering-watering_timer_1_irrigation_left', 0 )/60), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '')) ) + # # zeitplan pausiert + # : + # ( ReadingsVal($name, 'scheduling-schedules_paused_until', '') eq '2038-01-18T00:00:00.000Z') + # # pause bis dauerhaft + # ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash , 'schedule permanently paused')), (ReadingsVal( $name, 'watering-watering_timer_1_irrigation_left', 0 )/60) ) + # # naechter termin + # : sprintf( RigReadingsValue($hash , 'paused until %s'), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until', '')) ) + # # zu + # : + # ( ReadingsVal($name, 'scheduling-schedules_paused_until', '' ) eq '' ) + # # zeitplan aktiv + # ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash, 'next watering: %s')), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '') ) ) + # # zeitplan pausiert + # : RigReadingsValue($hash, 'closed') + # ; + # # state offline | override + # $state_string = 'offline' if ($online_state eq 'offline'); - readingsBulkUpdate( - $hash, 'state', RigReadingsValue( $hash, $state_string ) ); - } + # readingsBulkUpdate( + # $hash, 'state', RigReadingsValue( $hash, $state_string ) ); + # } if ( AttrVal( $name, 'model', 'unknown' ) =~ /sensor.?/ ) { my $state_string = diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 09e92f9..abb6b28 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-01_16:13:02 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-07_20:04:59 71767 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-08_12:29:06 73951 FHEM/74_GardenaSmartDevice.pm From ec88be0b064966cb60104848452566be33eb14e2 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 8 Jul 2022 12:39:38 +0200 Subject: [PATCH 74/88] [enhancment] - schedules --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 11 ++++++++--- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGED b/CHANGED index 69d6f4c..7c93cec 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - condition has_schedule + [NEW] - implementation schedules infos diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 71e598d..237218a 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -774,18 +774,23 @@ sub WriteReadings { ) { readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_events_count', scalar ($decode_json->{scheduled_events} ) ); - my $valve_id = 1; # ic24 [1..6] | wc, pump [1] + my $valve_id, $index= 1; # ic24 [1..6] | wc, pump [1] for my $event_schedules ( @{ $decode_json->{scheduled_events} } ) { $valve_id = $event_schedules->{valve_id} if ( exists($event_schedules->{valve_id} ) ); #ic24 + my $event_id = $index++; # event id while ( my ( $r, $v ) = each %{ $event_schedules } ) { readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_valve_' + . $event_id + . '_' . $valve_id . '_' - . $v, - $r) if (ref($v) ne 'HASH' ); + . $r, + $v) if (ref($v) ne 'HASH' ); readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_valve_' + . $event_id + . '_' . $valve_id . '_' . $v->{type}, diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index abb6b28..b660cbd 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-01_16:13:02 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-08_12:29:06 73951 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-08_12:38:54 74224 FHEM/74_GardenaSmartDevice.pm From 41c226536f8d3380fd8197d215ff79cf90029ec3 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 8 Jul 2022 12:42:32 +0200 Subject: [PATCH 75/88] fix --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 4 ++-- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGED b/CHANGED index 7c93cec..3ab596c 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [NEW] - implementation schedules infos + [enhancment] - schedules diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 237218a..0155883 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -774,11 +774,11 @@ sub WriteReadings { ) { readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_events_count', scalar ($decode_json->{scheduled_events} ) ); - my $valve_id, $index= 1; # ic24 [1..6] | wc, pump [1] + my $valve_id, $event_id = 1; # ic24 [1..6] | wc, pump [1] for my $event_schedules ( @{ $decode_json->{scheduled_events} } ) { $valve_id = $event_schedules->{valve_id} if ( exists($event_schedules->{valve_id} ) ); #ic24 - my $event_id = $index++; # event id + $event_id++; # event id while ( my ( $r, $v ) = each %{ $event_schedules } ) { readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_valve_' diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index b660cbd..1319d04 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-01_16:13:02 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-08_12:38:54 74224 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-08_12:42:27 74216 FHEM/74_GardenaSmartDevice.pm From 43d9356d8c755c68ed228e257a09e2c63bdb4e10 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 8 Jul 2022 12:43:14 +0200 Subject: [PATCH 76/88] fix --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 3ab596c..e4fe25a 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [enhancment] - schedules + fix diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 0155883..eda3856 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -774,7 +774,7 @@ sub WriteReadings { ) { readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_events_count', scalar ($decode_json->{scheduled_events} ) ); - my $valve_id, $event_id = 1; # ic24 [1..6] | wc, pump [1] + my $valve_id =1; my $event_id = 1; # ic24 [1..6] | wc, pump [1] for my $event_schedules ( @{ $decode_json->{scheduled_events} } ) { $valve_id = $event_schedules->{valve_id} if ( exists($event_schedules->{valve_id} ) ); #ic24 diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 1319d04..dc1cd86 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-01_16:13:02 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-08_12:42:27 74216 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-08_12:43:08 74222 FHEM/74_GardenaSmartDevice.pm From f77f49b7f1f633798f105d7e910cb7a5065bb402 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 8 Jul 2022 12:46:20 +0200 Subject: [PATCH 77/88] fix --- FHEM/74_GardenaSmartDevice.pm | 6 +++--- controls_GardenaSmartDevice.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index eda3856..746442c 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -769,7 +769,7 @@ sub WriteReadings { if ( exists( $decode_json->{scheduled_events} ) - && scalar ($decode_json->{scheduled_events} > 0 + # && scalar ($decode_json->{scheduled_events} > 0 && ref ($decode_json->{scheduled_events}) eq 'ARRAY' ) ) { readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_events_count', @@ -794,7 +794,7 @@ sub WriteReadings { . $valve_id . '_' . $v->{type}, - join(',', @ { $v->{weekdays}}) ) if (ref($v) qe 'HASH' ); + join(',', @ { $v->{weekdays}}) ) if (ref($v) eq 'HASH' ); }; }; @@ -938,7 +938,7 @@ sub setState { && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > $longest_duration ) ); ## wenn nicht dauerhaft pausiert , dann zeitplan vorhanden oder datum der pause enthalten in T Zulu - $has_scheduling = 1 if ( ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_ , '') ne '2038-01-18T00:00:00.000Z' ) + $has_schedule = 1 if ( ReadingsVal($name, 'scheduling-schedules_events_count', '') ne '' ); ###### diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index dc1cd86..d736436 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-01_16:13:02 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-08_12:43:08 74222 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-08_12:46:16 74193 FHEM/74_GardenaSmartDevice.pm From 5b8bd75c55e57d2dddf88d851aaa3365b5f6c794 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 8 Jul 2022 12:47:49 +0200 Subject: [PATCH 78/88] [fix] - ifcondition schedules events --- FHEM/74_GardenaSmartDevice.pm | 5 ++--- controls_GardenaSmartDevice.txt | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 746442c..f01f9ac 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -769,9 +769,8 @@ sub WriteReadings { if ( exists( $decode_json->{scheduled_events} ) - # && scalar ($decode_json->{scheduled_events} > 0 - && ref ($decode_json->{scheduled_events}) eq 'ARRAY' ) - ) { + # && scalar ($decode_json->{scheduled_events} ) > 0 + && ref ($decode_json->{scheduled_events}) eq 'ARRAY' ) { readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_events_count', scalar ($decode_json->{scheduled_events} ) ); my $valve_id =1; my $event_id = 1; # ic24 [1..6] | wc, pump [1] diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index d736436..a4f2ca8 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-01_16:13:02 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-08_12:46:16 74193 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-08_12:47:27 74189 FHEM/74_GardenaSmartDevice.pm From 9e389681f0bd325009a1dcdca2882a9a8251d6d0 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 8 Jul 2022 12:48:51 +0200 Subject: [PATCH 79/88] [fix] - scheduled --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 6 +++--- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGED b/CHANGED index e4fe25a..e28c7d9 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - fix + [fix] - ifcondition schedules events diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index f01f9ac..bd1e05a 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -985,7 +985,7 @@ sub setState { } else { $state_string .= RigReadingsValue($hash, 'closed'); } - $state_string .= ($has_scheduling) ? sprintf( RigReadingsValue($hash, 'next watering: %s'), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''))) : sprintf( RigReadingsValue($hash, 'paused until %s') , $nearst_irrigation); + $state_string .= ($has_schedule) ? sprintf( RigReadingsValue($hash, 'next watering: %s'), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''))) : sprintf( RigReadingsValue($hash, 'paused until %s') , $nearst_irrigation); #TODO: Write state format for ventil 1-@valces_connected -> map ? CommandAttr( undef, $name . ' stateFormat { @@ -994,13 +994,13 @@ sub setState { ' ) if ( AttrVal( $name, 'stateFormat', 'none' ) eq 'none' ); } else { - Log3 $name, 3, "[DEBUG] - Offene Ventile :".scalar(@opened_valves)." laengste bewaesserung: $longest_duration . hat Zeitplan: $has_scheduling Naechster Zeitplan: $nearst_irrigation"; + Log3 $name, 3, "[DEBUG] - Offene Ventile :".scalar(@opened_valves)." laengste bewaesserung: $longest_duration . hat Zeitplan: $has_schedule Naechster Zeitplan: $nearst_irrigation"; $state_string = scalar(@opened_valves) > 0 # offen ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.')), $longest_duration/60) # zu : - ( $has_scheduling ) + ( $has_schedule ) # zeitplan aktiv # ? ( $nearst_irrigation eq '2038-01-18 00:00') ? ( $nearst_irrigation eq RigReadingsValue( $hash, 'n/a') || $nearst_irrigation eq '2038-01-18 00:00') diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index a4f2ca8..9073ed0 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-01_16:13:02 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-08_12:47:27 74189 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-08_12:48:38 74183 FHEM/74_GardenaSmartDevice.pm From 5e10125a09852027fbcc678c5b0fe83f9780677b Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 8 Jul 2022 12:51:51 +0200 Subject: [PATCH 80/88] [fix] - readings schedules_event --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 8 ++++---- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGED b/CHANGED index e28c7d9..4b53e1e 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - ifcondition schedules events + [fix] - scheduled diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index bd1e05a..c795658 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -780,16 +780,16 @@ sub WriteReadings { $event_id++; # event id while ( my ( $r, $v ) = each %{ $event_schedules } ) { - readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_valve_' + readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_' . $event_id - . '_' + . '_valve_' . $valve_id . '_' . $r, $v) if (ref($v) ne 'HASH' ); - readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_valve_' + readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_' . $event_id - . '_' + . '_valve_' . $valve_id . '_' . $v->{type}, diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 9073ed0..3f895fb 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-01_16:13:02 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-08_12:48:38 74183 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-08_12:51:41 74183 FHEM/74_GardenaSmartDevice.pm From 9b49c7531792aaab6a6cef64536c0eb2d2578289 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 8 Jul 2022 12:58:49 +0200 Subject: [PATCH 81/88] [fix] scheduled count --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 4b53e1e..fd9cfca 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - scheduled + [fix] - readings schedules_event diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index c795658..d9d3ebd 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -772,7 +772,7 @@ sub WriteReadings { # && scalar ($decode_json->{scheduled_events} ) > 0 && ref ($decode_json->{scheduled_events}) eq 'ARRAY' ) { readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_events_count', - scalar ($decode_json->{scheduled_events} ) ); + scalar( @{$decode_json->{scheduled_events} } ) ); my $valve_id =1; my $event_id = 1; # ic24 [1..6] | wc, pump [1] for my $event_schedules ( @{ $decode_json->{scheduled_events} } ) { diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 3f895fb..e89a256 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-01_16:13:02 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-08_12:51:41 74183 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-08_12:58:42 74187 FHEM/74_GardenaSmartDevice.pm From 93d0ef26c7a787c2b8800f6acd7b3c472cbd7cf5 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 8 Jul 2022 15:11:18 +0200 Subject: [PATCH 82/88] [fix] - schedules events --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 31 ++++++++++++++++++++++++++----- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/CHANGED b/CHANGED index fd9cfca..05634a2 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - readings schedules_event + [fix] scheduled count diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index d9d3ebd..3055287 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -923,10 +923,11 @@ sub setState { || AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' || AttrVal( $name, 'model', 'unknown' ) eq 'electronic_water_pump' ){ my @opened_valves; - my $state_string = ''; my $nearst_irrigation = ''; - my $has_schedule = 0; my $longest_duration = 0; + my $state_string = ''; my $nearst_irrigation = '2999-12-12 23:59'; + my $has_schedule = 0; my $longest_duration = 0; my $processed_item = ''; my @valves_connected = AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ? split(',', ReadingsVal( $name, 'ic24-valves_connected', '')) : '1'; + $has_schedule = 1 if ( ReadingsVal($name, 'scheduling-schedules_events_count', '') ne '' ); for (@valves_connected){ # valves 1 or 1..6 ## add to opened ventils, if watering active push @opened_valves, $_ if ( ( ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms ) ? $_ : 0 ) > 0 ); @@ -935,9 +936,29 @@ sub setState { ( ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) =~ m{\A[1-9]([0-9]+)?\z}xms && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > 0 && ReadingsVal( $name, "watering-watering_timer_".$_."_duration", 0 ) > $longest_duration ) ); - - ## wenn nicht dauerhaft pausiert , dann zeitplan vorhanden oder datum der pause enthalten in T Zulu - $has_schedule = 1 if ( ReadingsVal($name, 'scheduling-schedules_events_count', '') ne '' ); + + # y-m-d h:m + $processed_item = AttrVal( $name, 'model', 'unknown' ) eq 'ic24' + ? RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')) + : RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until', '')); + + Log3 $name, 3, "[DEBUG] - process: $processed_item"; + Log3 $name, 3, "[DEBUG] - next_start: ". ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); # n/a RigReadingsValue( $hash, 'n/a') + # $nearst_irrigation = RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')) + if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '') eq RigReadingsValue( $hash, 'n/a') ) { # non next start, schedules paused permanently or next schedule > 1 year; get nearst paused_until + Log3 $name, 3, "[DEBUG] - next_start: empty "; + + $nearst_irrigation = $processed_item + if ( Time::Piece->strptime( $processed_item, "%Y-%m-%d %H:%M") + < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") + && $has_schedule + && Time::Piece->strptime( $processed_item, "%Y-%m-%d %H:%M") + > Time::Piece->new + ) + } else { + $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); + } + Log3 $name, 3, "[DEBUG] - nearst 2: $nearst_irrigation"; ###### diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index e89a256..9bdbf59 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-01_16:13:02 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-08_12:58:42 74187 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-08_15:09:01 75678 FHEM/74_GardenaSmartDevice.pm From 0c75c89cf09c767c7967d8bb2a41d5e07db21abf Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 8 Jul 2022 15:23:36 +0200 Subject: [PATCH 83/88] [enhancement] - scheudiles handling wc,ic24,pump, next schedule, permanenlty cloesd --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 05634a2..c6d2764 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] scheduled count + [fix] - schedules events diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 3055287..bfd0ab8 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -1024,7 +1024,7 @@ sub setState { ( $has_schedule ) # zeitplan aktiv # ? ( $nearst_irrigation eq '2038-01-18 00:00') - ? ( $nearst_irrigation eq RigReadingsValue( $hash, 'n/a') || $nearst_irrigation eq '2038-01-18 00:00') + ? ( $nearst_irrigation eq RigReadingsValue( $hash, 'n/a') || $nearst_irrigation =~ '2038-01-18.*') # dauerhaft pausiert ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash , 'schedule permanently paused')) ) # naechster zeutplan diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 9bdbf59..7302583 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-01_16:13:02 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-08_15:09:01 75678 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-08_15:22:30 75674 FHEM/74_GardenaSmartDevice.pm From 97540ef9c4d1b074e0dab60ae95c7ae86a60e621 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 8 Jul 2022 15:38:30 +0200 Subject: [PATCH 84/88] [fix] Garbage at end of string in strptime --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 11 ++++++----- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGED b/CHANGED index c6d2764..bbbfd2d 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - schedules events + [enhancement] - scheudiles handling wc,ic24,pump, next schedule, permanenlty cloesd diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index bfd0ab8..2d27b6f 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -923,7 +923,7 @@ sub setState { || AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' || AttrVal( $name, 'model', 'unknown' ) eq 'electronic_water_pump' ){ my @opened_valves; - my $state_string = ''; my $nearst_irrigation = '2999-12-12 23:59'; + my $state_string = ''; my $nearst_irrigation = '2999-12-12 12:00'; my $has_schedule = 0; my $longest_duration = 0; my $processed_item = ''; my @valves_connected = AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ? split(',', ReadingsVal( $name, 'ic24-valves_connected', '')) : '1'; @@ -947,12 +947,13 @@ sub setState { # $nearst_irrigation = RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until_'.$_, '')) if ( ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '') eq RigReadingsValue( $hash, 'n/a') ) { # non next start, schedules paused permanently or next schedule > 1 year; get nearst paused_until Log3 $name, 3, "[DEBUG] - next_start: empty "; - + Log3 $name, 3, "[DEBUG] - empty pro item ".Time::Piece->strptime( $processed_item, "%Y-%m-%d %H:%M:%S"); + Log3 $name, 3, "[DEBUG] - empty nearst ".Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M:%S"); $nearst_irrigation = $processed_item - if ( Time::Piece->strptime( $processed_item, "%Y-%m-%d %H:%M") - < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M") + if ( Time::Piece->strptime( $processed_item, "%Y-%m-%d %H:%M:%S") + < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M:%S") && $has_schedule - && Time::Piece->strptime( $processed_item, "%Y-%m-%d %H:%M") + && Time::Piece->strptime( $processed_item, "%Y-%m-%d %H:%M:%S") > Time::Piece->new ) } else { diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 7302583..0324260 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-01_16:13:02 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-08_15:22:30 75674 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-08_15:37:45 75905 FHEM/74_GardenaSmartDevice.pm From c6ee46489bb1fa0abc29152215dcbfac26927b19 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 10 Jul 2022 20:16:07 +0200 Subject: [PATCH 85/88] [fix] state , initial nearst fallback, paused untel readded - paused_until is UTC no bug -> calc for state in localtim --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 13 ++++++++----- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGED b/CHANGED index bbbfd2d..2203b05 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [enhancement] - scheudiles handling wc,ic24,pump, next schedule, permanenlty cloesd + [fix] Garbage at end of string in strptime diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 2d27b6f..a1e3325 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -959,7 +959,7 @@ sub setState { } else { $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); } - Log3 $name, 3, "[DEBUG] - nearst 2: $nearst_irrigation"; + Log3 $name, 3, "[DEBUG] - choosed nearst: $nearst_irrigation"; ###### @@ -1022,16 +1022,19 @@ sub setState { ? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.')), $longest_duration/60) # zu : - ( $has_schedule ) + ( $has_schedule + && $nearst_irrigation ne '2999-12-12 12:00') # zeitplan aktiv - # ? ( $nearst_irrigation eq '2038-01-18 00:00') + # ? ( $nearst_irrigation eq '2038-01-18 00:00') sprintf( RigReadingsValue($hash, 'paused until %s') , $nearst_irrigation) ? ( $nearst_irrigation eq RigReadingsValue( $hash, 'n/a') || $nearst_irrigation =~ '2038-01-18.*') # dauerhaft pausiert ? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash , 'schedule permanently paused')) ) # naechster zeutplan - : sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash, 'next watering: %s')), $nearst_irrigation ) + : (ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '') eq RigReadingsValue($hash, 'n/a')) + ? sprintf( RigReadingsValue($hash, 'paused until %s') , $nearst_irrigation) + : sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash, 'next watering: %s')), $nearst_irrigation ) # zeitplan pausiert - : RigReadingsValue($hash, 'closed') + : RigReadingsValue($hash, 'closed') ; # state offline | override $state_string = 'offline' if ($online_state eq 'offline'); diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 0324260..c624819 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-01_16:13:02 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-08_15:37:45 75905 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-10_20:11:36 76264 FHEM/74_GardenaSmartDevice.pm From 5e87026852886337701f113ca6c0598b09b85cea Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 11 Jul 2022 20:03:12 +0200 Subject: [PATCH 86/88] [enhancement] - change stopSchedule and resumeSchedule setter to connected valves --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 2203b05..a6803f0 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] Garbage at end of string in strptime + [fix] state , initial nearst fallback, paused untel readded - paused_until is UTC no bug -> calc for state in localtim diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index a1e3325..514ebf7 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -527,7 +527,7 @@ sub Set { if ( AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' ); $list .= -'closeAllValves:noArg stopScheduleValve:selectnumbers,1,1,6,0,lin resumeScheduleValve:selectnumbers,1,1,6,0,lin manualDurationValve1:slider,1,1,90 manualDurationValve2:slider,1,1,90 manualDurationValve3:slider,1,1,90 manualDurationValve4:slider,1,1,90 manualDurationValve5:slider,1,1,90 manualDurationValve6:slider,1,1,90 cancelOverrideValve1:noArg cancelOverrideValve2:noArg cancelOverrideValve3:noArg cancelOverrideValve4:noArg cancelOverrideValve5:noArg cancelOverrideValve6:noArg' +'closeAllValves:noArg stopScheduleValve:select,'.ReadingsVal( $name, 'ic24-valves_connected', '1' ).' resumeScheduleValve:select,'.ReadingsVal( $name, 'ic24-valves_connected', '1' ).' manualDurationValve1:slider,1,1,90 manualDurationValve2:slider,1,1,90 manualDurationValve3:slider,1,1,90 manualDurationValve4:slider,1,1,90 manualDurationValve5:slider,1,1,90 manualDurationValve6:slider,1,1,90 cancelOverrideValve1:noArg cancelOverrideValve2:noArg cancelOverrideValve3:noArg cancelOverrideValve4:noArg cancelOverrideValve5:noArg cancelOverrideValve6:noArg' if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ); $list .= 'refresh:temperature,humidity' diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index c624819..a6ba303 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-01_16:13:02 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-10_20:11:36 76264 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-11_13:47:43 76336 FHEM/74_GardenaSmartDevice.pm From 63443d75b4c8e41ac94408f7832c4a3095b6e2dd Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 11 Jul 2022 20:22:27 +0200 Subject: [PATCH 87/88] [add] - cancleValve for conencted valvs only --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 14 ++++++++++++-- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGED b/CHANGED index a6803f0..62a74ed 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] state , initial nearst fallback, paused untel readded - paused_until is UTC no bug -> calc for state in localtim + [enhancement] - change stopSchedule and resumeSchedule setter to connected valves diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 514ebf7..fb93c29 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -527,9 +527,19 @@ sub Set { if ( AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' ); $list .= -'closeAllValves:noArg stopScheduleValve:select,'.ReadingsVal( $name, 'ic24-valves_connected', '1' ).' resumeScheduleValve:select,'.ReadingsVal( $name, 'ic24-valves_connected', '1' ).' manualDurationValve1:slider,1,1,90 manualDurationValve2:slider,1,1,90 manualDurationValve3:slider,1,1,90 manualDurationValve4:slider,1,1,90 manualDurationValve5:slider,1,1,90 manualDurationValve6:slider,1,1,90 cancelOverrideValve1:noArg cancelOverrideValve2:noArg cancelOverrideValve3:noArg cancelOverrideValve4:noArg cancelOverrideValve5:noArg cancelOverrideValve6:noArg' +'closeAllValves:noArg stopScheduleValve:select,'.ReadingsVal( $name, 'ic24-valves_connected', '1' ).' resumeScheduleValve:select,'.ReadingsVal( $name, 'ic24-valves_connected', '1' ) if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ); - + + foreach my $valve (split(',', ReadingsVal( $name, 'ic24-valves_connected', '1'))) { + $list .= ' manualDurationValve'.$valve.':slider,1,1,90 ' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ); + } + + foreach my $valve (split(',', ReadingsVal( $name, 'ic24-valves_connected', '1'))) { + $list .= ' cancelOverrideValve'.$valve.':noArg ' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' ); + } + $list .= 'refresh:temperature,humidity' if ( AttrVal( $name, 'model', 'unknown' ) =~ /sensor.?/ ); diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index a6ba303..94f5a05 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-01_16:13:02 49241 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-11_13:47:43 76336 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-11_20:22:02 76451 FHEM/74_GardenaSmartDevice.pm From 73d7c50db00ac0b3cac60fc9f7610952c4d444c4 Mon Sep 17 00:00:00 2001 From: Sebastian Schwaz Date: Tue, 12 Jul 2022 20:09:33 +0200 Subject: [PATCH 88/88] =?UTF-8?q?=E2=80=9EFHEM/74=5FGardenaSmartDevice.pm?= =?UTF-8?q?=E2=80=9C=20=C3=A4ndern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FHEM/74_GardenaSmartDevice.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 32cda05..e11c5aa 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -992,7 +992,7 @@ sub setState { if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' || AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' - || AttrVal( $name, 'model', 'unknown' ) eq 'electronic_water_pump' ){ + || AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' ){ my @opened_valves; my $state_string = ''; my $nearst_irrigation = '2999-12-12 12:00'; my $has_schedule = 0; my $longest_duration = 0; my $processed_item = '';