From 6b87b19f0db67d67b6bc79c257d0634ea4823a60 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 14 Apr 2022 16:42:18 +0200 Subject: [PATCH 001/126] 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 002/126] 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 003/126] 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 004/126] 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 005/126] 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 006/126] 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 007/126] 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 008/126] 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 009/126] 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 010/126] 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 011/126] 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 012/126] 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 013/126] 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 014/126] 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 015/126] 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 016/126] 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 017/126] 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 018/126] 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 019/126] 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 020/126] 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 021/126] 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 022/126] 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 023/126] [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 024/126] 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 025/126] 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 026/126] [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 027/126] [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 028/126] [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 029/126] [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 030/126] [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 031/126] [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 032/126] 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 033/126] [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 034/126] [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 035/126] - --- 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 036/126] [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 037/126] 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 038/126] [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 039/126] [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 040/126] [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 041/126] [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 042/126] 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 043/126] 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 044/126] 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 045/126] 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 046/126] 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 047/126] [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 048/126] [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 049/126] [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 050/126] [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 051/126] [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 052/126] [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 053/126] [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 054/126] 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 055/126] [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 056/126] [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 057/126] [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 058/126] [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 059/126] [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 060/126] [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 061/126] [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 062/126] 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 063/126] [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 064/126] [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 065/126] [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 066/126] [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 067/126] [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 068/126] [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 069/126] [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 070/126] [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 071/126] [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 072/126] [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 073/126] [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 074/126] [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 075/126] 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 076/126] 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 077/126] 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 078/126] [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 079/126] [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 080/126] [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 081/126] [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 082/126] [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 083/126] [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 084/126] [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 085/126] [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 086/126] [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 087/126] [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 088/126] =?UTF-8?q?=E2=80=9EFHEM/74=5FGardenaSmartDevice.p?= =?UTF-8?q?m=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 = ''; From 1abf586f71dad40150e9bdd1bff656775ba0a110 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Wed, 13 Jul 2022 07:58:43 +0200 Subject: [PATCH 089/126] change version number [Ticket: no] --- FHEM/74_GardenaSmartDevice.pm | 2 +- controls_GardenaSmartDevice.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index e11c5aa..3dad48b 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -1866,7 +1866,7 @@ sub SetPredefinedStartPoints { ], "release_status": "stable", "license": "GPL_2", - "version": "v2.5.3", + "version": "v2.5.4", "author": [ "Marko Oldenburg " ], diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 063f842..69f0b31 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-07-12_19:25:17 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-12_19:24:20 81601 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-13_07:48:46 49634 FHEM/73_GardenaSmartBridge.pm +UPD 2022-07-13_07:58:25 81604 FHEM/74_GardenaSmartDevice.pm From 6aba15caca2fc210ceac6f31c41bef77a12f65c2 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 13 Jul 2022 20:56:47 +0200 Subject: [PATCH 090/126] readd lost setter webinterface --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 68 +++++++++++++++++---------------- controls_GardenaSmartDevice.txt | 4 +- 3 files changed, 39 insertions(+), 35 deletions(-) diff --git a/CHANGED b/CHANGED index 15570ea..edb2815 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [add] - cancleValve for conencted valvs only + [Ticket: no] diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 3dad48b..ec8973d 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -565,6 +565,10 @@ sub Set { 'manualOverride:slider,1,1,59 cancelOverride:noArg resumeSchedule:noArg stopSchedule manualButtonTime:slider,0,2,100' if ( AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' ); + + $list .= 'manualOverride:slider,1,1,90 cancelOverride:noArg operating_mode:automatic,scheduled leakage_detection:watering,washing_machine,domestic_water_supply,off turn_on_pressure:slider,2,0.2,3.0,1 resetValveErrors:noArg' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' ); + $list .= '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' ); @@ -1237,39 +1241,39 @@ sub setState { ReadingsVal( $name, 'power-power_timer', 'no info from power-timer' ) ) if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' ); - #electronic water pump - if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' ) { # | ok | pump_not_filled (Pumpe nicht gefüllt) - 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_duration', 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) ) - # 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'); - # check valv error, override state - my $error_type = ReadingsVal( $name, 'error-valve_error_1_type', 'ok' ); - $state_string = ( $error_type ne 'ok' ) ? $error_type : $state_string; + # #electronic water pump + # if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' ) { # | ok | pump_not_filled (Pumpe nicht gefüllt) + # 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_duration', 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) ) + # # 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'); + # # check valv error, override state + # my $error_type = ReadingsVal( $name, 'error-valve_error_1_type', 'ok' ); + # $state_string = ( $error_type ne 'ok' ) ? $error_type : $state_string; - readingsBulkUpdate( - $hash, 'state', RigReadingsValue( $hash, $state_string ) ); - } + # readingsBulkUpdate( + # $hash, 'state', RigReadingsValue( $hash, $state_string ) ); + # } return; } diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 69f0b31..69e96c8 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-07-13_07:48:46 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-13_07:58:25 81604 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-12_20:03:00 49634 FHEM/73_GardenaSmartBridge.pm +UPD 2022-07-13_20:56:14 81987 FHEM/74_GardenaSmartDevice.pm From f61e9d327b77c9e2ecbc79d3685b4a89459afe45 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 19 Jul 2022 20:20:20 +0200 Subject: [PATCH 091/126] cleanup code, fix start up defined string --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 150 ++++---------------------------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 19 insertions(+), 135 deletions(-) diff --git a/CHANGED b/CHANGED index edb2815..37eb437 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [Ticket: no] + Reviewed-by: Marko Oldenburg diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index ec8973d..a68b12b 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -921,9 +921,10 @@ sub WriteReadings { $winter_mode = $decode_json->{settings}[$settings]{value}; } } - - if ($decode_json->{settings}[$settings]{name} eq 'valve_names' - && ref( $decode_json->{settings}[$settings]{value} ) eq "ARRAY" ) { # or HASH ? + + if ( defined( $decode_json->{settings}[$settings]{name} ) + && $decode_json->{settings}[$settings]{name} eq 'valve_names' + && 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'}"; @@ -1000,12 +1001,15 @@ sub setState { 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 = ''; + my $error_type = 'ok'; 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 ); + ## set error type (pumpe required) + $error_type = ReadingsVal( $name, 'error-valve_error_'.$_.'_type', 'ok' ) if (ReadingsVal( $name, 'error-valve_error_'.$_.'_type', 'ok' ) ne 'ok'); ## 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 @@ -1017,13 +1021,13 @@ sub setState { ? 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') + Log3 $name, 5, "[DEBUG] - process: $processed_item"; + Log3 $name, 5, "[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 "; - 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"); + Log3 $name, 5, "[DEBUG] - next_start: empty "; + Log3 $name, 5, "[DEBUG] - empty pro item ".Time::Piece->strptime( $processed_item, "%Y-%m-%d %H:%M:%S"); + Log3 $name, 5, "[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:%S") < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M:%S") @@ -1034,7 +1038,7 @@ sub setState { } else { $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); } - Log3 $name, 3, "[DEBUG] - choosed nearst: $nearst_irrigation"; + Log3 $name, 5, "[DEBUG] - choosed nearst: $nearst_irrigation"; ###### @@ -1091,7 +1095,7 @@ 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_schedule Naechster Zeitplan: $nearst_irrigation"; + Log3 $name, 5, "[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) @@ -1113,101 +1117,14 @@ sub setState { ; # state offline | override $state_string = 'offline' if ($online_state eq 'offline'); + $state_string = ( $error_type ne 'ok' ) ? $error_type : $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 - - # watering-watering_timer_1_state idle | scheduled | manual - # watering-watering_timer_1_duration 0 in sec - # scheduling-scheduled_watering_next_start XXX - # scheduling-scheduled_watering_end | end < NOW && duration = 0 => abbruch manuell - # scheduling-schedules_paused_until - - - # 1. Ventil geschlossen, Zeitplan pausiert. - # App zeigt: nichts (wenn vorher ein Zeitplan abgebrochen wurde, steht da "Unterbrochen xx:yy - zz:aa") - # 2. Ventil geschlossen, Zeitplan aktiv. - # App zeigt: "Nächste Bewässerung heute um xx:yy Uhr" (wenn vorher ein Zeitplan abgebrochen wurde, steht da vorher auch "Unterbrochen xx:yy - zz:aa") - # 3. Ventil manuell geoeffnet, späterer Zeitplan aktiv. - # 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" - ### 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'); - - # readingsBulkUpdate( - # $hash, 'state', RigReadingsValue( $hash, $state_string ) ); - # } + # Sensor / Sensor 2 if ( AttrVal( $name, 'model', 'unknown' ) =~ /sensor.?/ ) { my $state_string = ( ReadingsVal( $name, 'device_info-category', 'unknown' ) eq @@ -1241,39 +1158,6 @@ sub setState { ReadingsVal( $name, 'power-power_timer', 'no info from power-timer' ) ) if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' ); - # #electronic water pump - # if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' ) { # | ok | pump_not_filled (Pumpe nicht gefüllt) - # 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_duration', 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) ) - # # 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'); - # # check valv error, override state - # my $error_type = ReadingsVal( $name, 'error-valve_error_1_type', 'ok' ); - # $state_string = ( $error_type ne 'ok' ) ? $error_type : $state_string; - - # readingsBulkUpdate( - # $hash, 'state', RigReadingsValue( $hash, $state_string ) ); - # } return; } @@ -1870,7 +1754,7 @@ sub SetPredefinedStartPoints { ], "release_status": "stable", "license": "GPL_2", - "version": "v2.5.4", + "version": "v2.5.5", "author": [ "Marko Oldenburg " ], diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 69e96c8..af773db 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-12_20:03:00 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-13_20:56:14 81987 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-19_20:20:03 71804 FHEM/74_GardenaSmartDevice.pm From abcccefeb4771059c04ae7ee0b19a0f3f5320097 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 20 Jul 2022 12:15:53 +0200 Subject: [PATCH 092/126] cleanup --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 3535 +++++++++++++++---------------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 1752 insertions(+), 1787 deletions(-) diff --git a/CHANGED b/CHANGED index 37eb437..af74819 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - Reviewed-by: Marko Oldenburg + cleanup code, fix start up defined string diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index a68b12b..363f97d 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -1,1785 +1,1750 @@ -############################################################################### -# -# Developed with VSCodium and richterger perl plugin. -# -# (c) 2017-2022 Copyright: Marko Oldenburg (fhemdevelopment at cooltux dot net) -# All rights reserved -# -# Special thanks goes to comitters: -# - Michael (mbrak) Thanks for Commandref -# - Matthias (Kenneth) Thanks for Wiki entry -# - BioS Thanks for predefined start points Code -# - fettgu Thanks for Debugging Irrigation Control data flow -# - Sebastian (BOFH) Thanks for new Auth Code after API Change -# -# -# This script is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# any later version. -# -# The GNU General Public License can be found at -# http://www.gnu.org/copyleft/gpl.html. -# A copy is found in the textfile GPL.txt and important notices to the license -# from the author is found in LICENSE.txt distributed with these scripts. -# -# This script is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# -# $Id$ -# -############################################################################### -## -## -## Das JSON Modul immer in einem eval aufrufen -# $data = eval{decode_json($data)}; -# -# if($@){ -# Log3($SELF, 2, "$TYPE ($SELF) - error while request: $@"); -# -# readingsSingleUpdate($hash, "state", "error", 1); -# -# return; -# } -# -# -###### Wichtige Notizen -# -# apt-get install libio-socket-ssl-perl -# http://www.dxsdata.com/de/2016/07/php-class-for-gardena-smart-system-api/ -# -## -## - -## unserer packagename -package FHEM::GardenaSmartDevice; -use GPUtils qw(GP_Import GP_Export); - -use strict; -use warnings; -use POSIX; -use FHEM::Meta; -use Time::Local; -use Time::Piece; -use Time::Seconds; - -# try to use JSON::MaybeXS wrapper -# for chance of better performance + open code -eval { - require JSON::MaybeXS; - import JSON::MaybeXS qw( decode_json encode_json ); - 1; -} or do { - - # try to use JSON wrapper - # for chance of better performance - eval { - # JSON preference order - local $ENV{PERL_JSON_BACKEND} = - 'Cpanel::JSON::XS,JSON::XS,JSON::PP,JSON::backportPP' - unless ( defined( $ENV{PERL_JSON_BACKEND} ) ); - - require JSON; - import JSON qw( decode_json encode_json ); - 1; - } or do { - - # In rare cases, Cpanel::JSON::XS may - # be installed but JSON|JSON::MaybeXS not ... - eval { - require Cpanel::JSON::XS; - import Cpanel::JSON::XS qw(decode_json encode_json); - 1; - } or do { - - # In rare cases, JSON::XS may - # be installed but JSON not ... - eval { - require JSON::XS; - import JSON::XS qw(decode_json encode_json); - 1; - } or do { - - # Fallback to built-in JSON which SHOULD - # be available since 5.014 ... - eval { - require JSON::PP; - import JSON::PP qw(decode_json encode_json); - 1; - } or do { - - # Fallback to JSON::backportPP in really rare cases - require JSON::backportPP; - import JSON::backportPP qw(decode_json encode_json); - 1; - }; - }; - }; - }; -}; - -## Import der FHEM Funktionen -#-- Run before package compilation -BEGIN { - - # Import from main context - GP_Import( - qw(readingsSingleUpdate - readingsBulkUpdate - readingsBulkUpdateIfChanged - readingsBeginUpdate - readingsEndUpdate - Log3 - CommandAttr - AttrVal - ReadingsVal - readingFnAttributes - AssignIoPort - modules - IOWrite - defs - makeDeviceName) - ); -} - -#-- Export to main context with different name -GP_Export( - qw( - Initialize - ) -); - -sub Initialize { - my $hash = shift; - - $hash->{Match} = '^{"id":".*'; - - $hash->{SetFn} = \&Set; - $hash->{DefFn} = \&Define; - $hash->{UndefFn} = \&Undef; - $hash->{ParseFn} = \&Parse; - - $hash->{AttrFn} = \&Attr; - $hash->{AttrList} = - "readingValueLanguage:de,en " - . "model:watering_computer,sensor,sensor2,mower,ic24,power,electronic_pressure_pump " - . "extendedState:0,1 " - . "IODev " - . $readingFnAttributes; - $hash->{parseParams} = 1; - - return FHEM::Meta::InitMod( __FILE__, $hash ); -} - -sub Define { - my $hash = shift // return; - my $aArg = shift // return; - - return $@ unless ( FHEM::Meta::SetInternals($hash) ); - use version 0.60; our $VERSION = FHEM::Meta::Get( $hash, 'version' ); - - return - "too few parameters: define GardenaSmartDevice " - if ( scalar( @{$aArg} ) < 3 ); - - my $name = $aArg->[0]; - 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} = ''; - # Electroni Pressure Pump - $hash->{helper}{operating_mode_id} = ''; - $hash->{helper}{leakage_detection_id} = ''; - $hash->{helper}{turn_on_pressure_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} = ''; - - CommandAttr( undef, - "$name IODev $modules{GardenaSmartBridge}{defptr}{BRIDGE}->{NAME}" ) - if ( AttrVal( $name, 'IODev', 'none' ) eq 'none' ); - - my $iodev = AttrVal( $name, 'IODev', 'none' ); - - AssignIoPort( $hash, $iodev ) if ( !$hash->{IODev} ); - - if ( defined( $hash->{IODev}->{NAME} ) ) { - Log3 $name, 3, "GardenaSmartDevice ($name) - I/O device is " - . $hash->{IODev}->{NAME}; - } - else { - Log3 $name, 1, "GardenaSmartDevice ($name) - no I/O device"; - } - - $iodev = $hash->{IODev}->{NAME}; - - my $d = $modules{GardenaSmartDevice}{defptr}{$deviceId}; - - return -"GardenaSmartDevice device $name on GardenaSmartBridge $iodev already defined." - if ( defined($d) - && $d->{IODev} == $hash->{IODev} - && $d->{NAME} ne $name ); - - CommandAttr( undef, $name . ' room GardenaSmart' ) - if ( AttrVal( $name, 'room', 'none' ) eq 'none' ); - - CommandAttr( undef, $name . ' model ' . $category ) - if ( AttrVal( $name, 'model', 'none' ) eq 'none' ); - - Log3 $name, 3, -"GardenaSmartDevice ($name) - defined GardenaSmartDevice with DEVICEID: $deviceId"; - readingsSingleUpdate( $hash, 'state', 'initialized', 1 ); - - $modules{GardenaSmartDevice}{defptr}{$deviceId} = $hash; - - return; -} - -sub Undef { - my $hash = shift; - my $arg = shift; - - my $name = $hash->{NAME}; - my $deviceId = $hash->{DEVICEID}; - - delete $modules{GardenaSmartDevice}{defptr}{$deviceId}; - - return; -} - -sub Attr { - - my ( $cmd, $name, $attrName, $attrVal ) = @_; - my $hash = $defs{$name}; - - return; -} - -sub Set { - my $hash = shift // return; - my $aArg = shift // return; - - my $name = shift @$aArg; - my $cmd = shift @$aArg - // return qq{"set $name" needs at least one argument}; - - my $payload; - my $abilities; - my $service_id; - my $mainboard_version = - ReadingsVal( $name, 'mower_type-mainboard_version', 0.0 ); - - my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat, - $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) = localtime(time); - - my $timezone_offset = $Sommerzeit ? 0 : ( Time::Piece->new )->tzoffset; - - #set default abilitie ... overwrite in cmd to change - $abilities = 'mower' - if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' ); - $abilities = 'watering' - if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' - || AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' ); - $abilities = 'power' - if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' ); - $abilities = 'watering' - if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' ); - - ### mower - # service_id (eco, parkuntilfurhternotice, startpoints) - if ( lc $cmd eq 'parkuntilfurthernotice' ) { - $payload = '"name":"park_until_further_notice"'; - if ( $mainboard_version > 10.30 ) { - $payload = -' "settings":{"name":"schedules_paused_until","value":"2038-01-18T00:00:00.000Z","device":"' - . $hash->{DEVICEID} . '"}'; - $abilities = 'mower_settings'; - $service_id = $hash->{helper}{schedules_paused_until_id}; - } - } - elsif ( lc $cmd eq 'parkuntilnexttimer' ) { - $payload = '"name":"park_until_next_timer"'; - if ( $mainboard_version > 10.30 ) { - $payload = '"properties":{"name":"mower_timer","value":0}'; - $abilities = 'mower_timer'; - } - } - elsif ( lc $cmd eq 'startresumeschedule' ) { - $payload = '"name":"start_resume_schedule"'; - if ( $mainboard_version > 10.30 ) { - $payload = -' "settings":{"name":"schedules_paused_until","value":"","device":"' - . $hash->{DEVICEID} . '"}'; - $abilities = 'mower_settings'; - $service_id = $hash->{helper}{schedules_paused_until_id}; - } - } - elsif ( lc $cmd eq 'startoverridetimer' ) { - $payload = '"name":"start_override_timer","parameters":{"duration":' - . $aArg->[0] * 60 . '}'; - if ( $mainboard_version > 10.30 ) { - $payload = '"properties":{"name":"mower_timer","value":' - . $aArg->[0] * 60 . '}'; - $abilities = 'mower_timer'; - } - - } - elsif ( lc $cmd eq 'startpoint' ) { - my $err; - ( $err, $payload, $abilities ) = - SetPredefinedStartPoints( $hash, $aArg ); - $service_id = $hash->{helper}{STARTINGPOINTID}; - return $err if ( defined($err) ); - } - elsif ( lc $cmd eq 'eco' ) { - $payload = - '"settings": {"name": "eco_mode", "value": ' - . $aArg->[0] - . ', "device": "' - . $hash->{DEVICEID} . '"}'; - $abilities = 'mower_settings' if ( $mainboard_version > 10.30 ); - $service_id = $hash->{helper}{eco_mode_id}; - -#$abilities['service_id'] = $hash->{helper}{SCHEDULESID} if ( $mainboard_version > 10.30 ); - } - ### electronic_pressure_pump - # elsif ( lc $cmd eq 'pumptimer' ) { - # $payload = - # '"name":"pump_manual_watering_timer","parameters":{"duration":' - # . $aArg->[0] . '}'; - # } - ### watering_computer & electronic pump - elsif ( lc $cmd eq 'manualoverride' ) { - $payload = - '"properties":{"name":"watering_timer_1' - . '","value":{"state":"manual","duration":' - . $aArg->[0] * 60 - . ',"valve_id":1}}'; - } - elsif ( lc $cmd eq 'manualbuttontime' ) { - $service_id = $hash->{helper}{button_config_time_id}; - $payload = - '"properties":{"name":"button_config_time",' - . '"value":' - . $aArg->[0] * 60 - . ',"timestamp":"2021-05-26T19:06:23.680Z"' - . ',"at_bound":null,"unit":"seconds","ability":"' - . $service_id . '"}'; - $abilities = 'watering_button_config'; - } - elsif ( $cmd =~ m{\AcancelOverride}xms ) { - - my $valve_id = 1; - - if ( $cmd =~ m{\AcancelOverrideValve(\d)\z}xms ) { - $valve_id = $1; - } - - $payload = - '"properties":{"name":"watering_timer_' - . $valve_id - . '","value":{"state":"idle","duration":' - . 0 - . ',"valve_id":' - . $valve_id . '}}'; - } - elsif ( $cmd =~ /.*Schedule$/ ) { - my $duration = ( - ( - defined( $aArg->[0] ) - ? ( - ( - ( Time::Piece->new ) + - ( ONE_HOUR * $aArg->[0] ) - - $timezone_offset - )->datetime - ) - . '.000Z' - : '2038-01-18T00:00:00.000Z' - ) - ); - - $abilities = 'wateringcomputer_settings'; - $service_id = $hash->{helper}->{'schedules_paused_until_id'}; - $payload = - '"settings":{"name":"schedules_paused_until"' - . ', "value":"' - . ( $cmd eq 'resumeSchedule' ? '' : $duration ) - . '","device":"' - . $hash->{DEVICEID} . '"}'; - } - elsif ( lc $cmd eq 'on' || lc $cmd eq 'off' || lc $cmd eq 'on-for-timer' ) { - my $val = ( - scalar( !@$aArg == 0 ) && ref($aArg) eq 'ARRAY' - ? $aArg->[0] * 60 - : lc $cmd - ); - - $payload = - '"properties":{"name":"power_timer", "value":"' . $val . '"}'; - } - ### Watering ic24 - elsif ( $cmd =~ m{\AmanualDurationValve\d\z}xms ) { - my $valve_id; - - if ( $cmd =~ m{\AmanualDurationValve(\d)\z}xms ) { - $valve_id = $1; - } - - $payload = - '"properties":{"name":"watering_timer_' - . $valve_id - . '","value":{"state":"manual","duration":' - . $aArg->[0] * 60 - . ',"valve_id":' - . $valve_id . '}}'; - } - elsif ( $cmd eq 'closeAllValves' ) { - $payload = '"name":"close_all_valves","parameters":{}'; - } - elsif ( $cmd =~ /.*ScheduleValve$/ ) { - my $valve_id = $aArg->[0]; - my $duration = ( - ( - defined( $aArg->[1] ) - ? ( - ( - ( Time::Piece->new ) + - ( ONE_HOUR * $aArg->[1] ) - - $timezone_offset - )->datetime - ) - . '.000Z' - : '2038-01-18T00:00:00.000Z' - ) - ); - - $abilities = 'irrigation_settings'; - $service_id = - $hash->{helper}->{ 'schedules_paused_until_' . $valve_id . '_id' }; - $payload = - '"settings":{"name":"schedules_paused_until_' - . $valve_id - . '", "value":"' - . ( $cmd eq 'resumeScheduleValve' ? '' : $duration ) - . '","device":"' - . $hash->{DEVICEID} . '"}'; - } - ### Watering_pressure_pump - elsif ( lc $cmd eq 'operating_mode') { - my $op_mode = $aArg->[0]; - $payload = '"settings":{"name":"operating_mode",' - .'"value":"'.$op_mode.'",' - .'"device":"' - . $hash->{DEVICEID}.'"}'; - $abilities = 'watering_pressure_pump_settings'; - $service_id = $hash->{helper}->{ 'operating_mode_id' }; - } - elsif ( lc $cmd eq 'leakage_detection') { - my $leakdetection_mode = $aArg->[0]; - $payload = '"settings":{"name":"leakage_detection",' - .'"value":"'.$leakdetection_mode.'",' - .'"device":"' - . $hash->{DEVICEID}.'"}'; - $abilities = 'watering_pressure_pump_settings'; - $service_id = $hash->{helper}->{ 'leakage_detection_id' }; - } - elsif ( lc $cmd eq 'turn_on_pressure') { - my $turnonpressure = $aArg->[0]; - $payload = '"settings":{"name":"turn_on_pressure",' - .'"value":"'.$turnonpressure.'",' - .'"device":"' - . $hash->{DEVICEID}.'"}'; - $abilities = 'watering_pressure_pump_settings'; - $service_id = $hash->{helper}->{ 'turn_on_pressure_id' }; - } - elsif ( lc $cmd eq 'resetvalveerrors') { - $payload = '"name":"reset_valve_errors",' - .' "parameters": {}'; - $abilities = 'error'; - } - - ### Sensors - elsif ( lc $cmd eq 'refresh' ) { - - my $sensname = $aArg->[0]; - if ( lc $sensname eq 'temperature' ) { - if ( ReadingsVal( $name, 'device_info-category', 'sensor' ) eq - 'sensor' ) - { - $payload = '"name":"measure_ambient_temperature"'; - $abilities = 'ambient_temperature'; - } - else { - $payload = '"name":"measure_soil_temperature"'; - $abilities = 'soil_temperature'; - } - } - elsif ( lc $sensname eq 'light' ) { - $payload = '"name":"measure_light"'; - $abilities = 'light'; - - } - elsif ( lc $sensname eq 'humidity' ) { - $payload = '"name":"measure_soil_humidity"'; - $abilities = 'humidity'; - } - } - ## winter sleep - elsif ( lc $cmd eq 'winter_mode' ) { - $payload = - '"settings":{"name":"winter_mode","value":"' - . $aArg->[0] - . '","device":"' - . $hash->{DEVICEID} . '"}'; - $abilities = 'winter_settings'; - $service_id = $hash->{helper}->{'winter_mode_id'}; - } - else { - - my $list = ''; - - $list .= -'parkUntilFurtherNotice:noArg parkUntilNextTimer:noArg startResumeSchedule:noArg startOverrideTimer:slider,0,1,240 startpoint' - if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' ); - - $list .= -'manualOverride:slider,1,1,59 cancelOverride:noArg resumeSchedule:noArg stopSchedule manualButtonTime:slider,0,2,100' - if ( AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' ); - - - $list .= 'manualOverride:slider,1,1,90 cancelOverride:noArg operating_mode:automatic,scheduled leakage_detection:watering,washing_machine,domestic_water_supply,off turn_on_pressure:slider,2,0.2,3.0,1 resetValveErrors:noArg' - if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' ); - - $list .= -'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.?/ ); - - # add light for old sensors - $list .= ',light' - if ( AttrVal( $name, 'model', 'unknown' ) eq 'sensor' - && ReadingsVal( $name, 'device_info-category', 'unknown' ) eq - 'sensor' ); - - $list .= 'on:noArg off:noArg on-for-timer:slider,0,1,720' - if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' ); - - # all devices has abilitie to fall a sleep - $list .= ' winter_mode:awake,hibernate'; - return "Unknown argument $cmd, choose one of $list"; - } - - $hash->{helper}{deviceAction} = $payload; - readingsSingleUpdate( $hash, "state", "send command to gardena cloud", 1 ); - - IOWrite( $hash, $payload, $hash->{DEVICEID}, $abilities, $service_id ); - Log3 $name, 4, -"GardenaSmartBridge ($name) - IOWrite: $payload $hash->{DEVICEID} $abilities IODevHash=$hash->{IODev}"; - - return; -} - -sub Parse { - my $io_hash = shift; - my $json = shift; - - my $name = $io_hash->{NAME}; - - my $decode_json = eval { decode_json($json) }; - if ($@) { - Log3 $name, 3, - "GardenaSmartDevice ($name) - JSON error while request: $@"; - } - - Log3 $name, 4, "GardenaSmartDevice ($name) - ParseFn was called"; - Log3 $name, 4, "GardenaSmartDevice ($name) - JSON: $json"; - - if ( defined( $decode_json->{id} ) ) { - - my $deviceId = $decode_json->{id}; - - if ( my $hash = $modules{GardenaSmartDevice}{defptr}{$deviceId} ) { - my $name = $hash->{NAME}; - - WriteReadings( $hash, $decode_json ); - Log3 $name, 4, - "GardenaSmartDevice ($name) - find logical device: $hash->{NAME}"; - - return $hash->{NAME}; - - } - else { - - Log3 $name, 3, - "GardenaSmartDevice ($name) - autocreate new device " - . makeDeviceName( $decode_json->{name} ) - . " with deviceId $decode_json->{id}, model $decode_json->{category}"; - return - "UNDEFINED " - . makeDeviceName( $decode_json->{name} ) - . " GardenaSmartDevice $decode_json->{id} $decode_json->{category}"; - } - } - - return; -} - -sub WriteReadings { - my $hash = shift; - my $decode_json = shift; - - 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); - - do { - - if ( - ref( $decode_json->{abilities}[$abilities]{properties} ) eq "ARRAY" - && scalar( @{ $decode_json->{abilities}[$abilities]{properties} } ) - > 0 ) - { - for my $propertie ( - @{ $decode_json->{abilities}[$abilities]{properties} } ) - { - if ( - exists( $decode_json->{abilities}[$abilities]{name} ) - && ( $decode_json->{abilities}[$abilities]{name} eq - 'watering' ) - ) - { - - if ( $propertie->{name} eq 'button_config_time' ) { - if ( $hash->{helper}{ $propertie->{name} . '_id' } ne - $decode_json->{abilities}[$abilities]{id} ) - { - $hash->{helper}{ $propertie->{name} . '_id' } = - $decode_json->{abilities}[$abilities]{id}; - } - readingsBulkUpdateIfChanged( - $hash, - 'manualButtonTime', - ( - RigReadingsValue( - $hash, $propertie->{value} / 60 - ) - ) - ); - next; - } - } - - readingsBulkUpdateIfChanged( - $hash, - $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name}, - ($propertie->{value} eq '') ? RigReadingsValue( $hash, 'n/a') : RigReadingsValue( $hash, $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} . '-' - . $propertie->{name} ne 'battery-level' - && $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} ne 'internal_temperature-temperature' - && $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} ne 'ambient_temperature-temperature' - && $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} ne 'soil_temperature-temperature' - && $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} ne 'humidity-humidity' - && $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} ne 'light-light' - && ref( $propertie->{value} ) ne "HASH" ); - - readingsBulkUpdateIfChanged( - $hash, - $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name}, - RigReadingsValue( $hash, $propertie->{value} ) - ) - if ( - defined( $propertie->{value} ) - && ( $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} eq 'radio-quality' - || $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} eq 'battery-level' - || $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} eq - 'internal_temperature-temperature' - || $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} eq - 'ambient_temperature-temperature' - || $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} eq 'soil_temperature-temperature' - || $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} eq 'humidity-humidity' - || $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} eq 'light-light' ) - ); - - readingsBulkUpdateIfChanged( - $hash, - $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} - . '_timestamp', - Time::Piece->strptime( - RigReadingsValue( $hash, $propertie->{timestamp} ), - "%Y-%m-%d %H:%M:%S" )->strftime('%s') - - ) - if ( - defined( $propertie->{value} ) - && ( $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} eq 'mower_timer-mower_timer' ) - ); - - readingsBulkUpdateIfChanged( - $hash, - $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name}, - join( ',', @{ $propertie->{value} } ) - ) - if ( defined( $propertie->{value} ) - && $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} eq 'ic24-valves_connected' ); - - readingsBulkUpdateIfChanged( - $hash, - $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name}, - join( ',', @{ $propertie->{value} } ) - ) - if ( defined( $propertie->{value} ) - && $decode_json->{abilities}[$abilities]{name} . '-' - . $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} } ) { - if ( ref( $v ) ne "HASH" ) { - readingsBulkUpdate( - $hash, - $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} . '_' - . $r, - RigReadingsValue( $hash, $v ) - ); - } else { - while ( my ( $i_r, $i_v ) = each %{ $v } ) { - readingsBulkUpdate( - $hash, - $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} . '_' - . $r . '_' . $i_r, - RigReadingsValue( $hash, $i_v ) - ); - } - } - } - } - # ic24 and other watering devices calc irrigation left in sec - readingsBulkUpdateIfChanged( - $hash, - $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} - . '_irrigation_left', - ( $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) : 0 - ) - if ( defined( $propertie->{value} ) - && $decode_json->{abilities}[$abilities]{name} eq 'watering' - ); - } - } - - $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; 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 - $event_id++; # event id - - while ( my ( $r, $v ) = each %{ $event_schedules } ) { - readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_' - . $event_id - . '_valve_' - . $valve_id - . '_' - . $r, - $v) if (ref($v) ne 'HASH' ); - readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_' - . $event_id - . '_valve_' - . $valve_id - . '_' - . $v->{type}, - join(',', @ { $v->{weekdays}}) ) if (ref($v) eq 'HASH' ); - }; - }; - - }; # fi scheduled_events - - my $winter_mode; - - do { -#Log3 $name, 1, "Settings pro Device : ".$decode_json->{settings}[$settings]{name}; -#Log3 $name, 1, " - KEIN ARRAY" if ( ref( $decode_json->{settings}[$settings]{value} ) ne "ARRAY"); -#Log3 $name, 1, " - IST ARRAY" if ( ref( $decode_json->{settings}[$settings]{value} ) eq "ARRAY"); - - if ( - exists( $decode_json->{settings}[$settings]{name} ) - && ( $decode_json->{settings}[$settings]{name} =~ - /schedules_paused_until_?\d?$/ - || $decode_json->{settings}[$settings]{name} eq 'eco_mode' - || $decode_json->{settings}[$settings]{name} eq 'winter_mode' - || $decode_json->{settings}[$settings]{name} eq 'operating_mode' - || $decode_json->{settings}[$settings]{name} eq 'leakage_detection' - || $decode_json->{settings}[$settings]{name} eq 'turn_on_pressure' ) - ) - { - if ( $hash->{helper} - { $decode_json->{settings}[$settings]{name} . '_id' } ne - $decode_json->{settings}[$settings]{id} ) - { - $hash->{helper} - { $decode_json->{settings}[$settings]{name} . '_id' } = - $decode_json->{settings}[$settings]{id}; - } - # check watering controler single schedules pause until - if ( $decode_json->{settings}[$settings]{name} eq 'schedules_paused_until' ) { - 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 - # check if empty, clear scheduling-scheduled_watering_next_start_x - readingsBulkUpdateIfChanged( $hash, 'scheduling-'.$decode_json->{settings}[$settings]{name}, - $decode_json->{settings}[$settings]{value} ); - # CommandAttr( undef, $name . " scheduling-scheduled_watering_next_start_") if ($decode_json->{settings}[$settings]{value} eq '' ) - } - - # save electronid pressure pump settings as readings - if ( $decode_json->{settings}[$settings]{name} eq 'operating_mode' - || $decode_json->{settings}[$settings]{name} eq 'leakage_detection' - || $decode_json->{settings}[$settings]{name} eq 'turn_on_pressure' ) { - readingsBulkUpdateIfChanged( $hash, $decode_json->{settings}[$settings]{name}, - $decode_json->{settings}[$settings]{value} ); - - } - # save winter mode as reading - if ( $decode_json->{settings}[$settings]{name} eq 'winter_mode' ) { - readingsBulkUpdateIfChanged( $hash, 'winter_mode', - $decode_json->{settings}[$settings]{value} ); - - $winter_mode = $decode_json->{settings}[$settings]{value}; - } - } - - if ( defined( $decode_json->{settings}[$settings]{name} ) - && $decode_json->{settings}[$settings]{name} eq 'valve_names' - && 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'}"; - 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' ) - { - #save the startingpointid needed to update the startingpoints - if ( $hash->{helper}{STARTINGPOINTID} ne - $decode_json->{settings}[$settings]{id} ) - { - $hash->{helper}{STARTINGPOINTID} = - $decode_json->{settings}[$settings]{id}; - } - - $hash->{helper}{STARTINGPOINTS} = - '{ "name": "starting_points", "value": ' - . encode_json( $decode_json->{settings}[$settings]{value} ) . '}'; - my $startpoint_cnt = 0; - - for my $startingpoint ( - @{ $decode_json->{settings}[$settings]{value} } ) - { - $startpoint_cnt++; - readingsBulkUpdateIfChanged( - $hash, - 'startpoint-' . $startpoint_cnt . '-enabled', - $startingpoint->{enabled} - ); - } - } - - $settings--; - } while ( $settings >= 0 ); - - if ( $winter_mode ne 'hibernate' ) { - setState($hash); - } - else { - readingsBulkUpdate( $hash, 'state', - RigReadingsValue( $hash, 'hibernate' ) ); - } - - readingsEndUpdate( $hash, 1 ); - - Log3 $name, 4, "GardenaSmartDevice ($name) - readings was written"; - - return; -} - -sub setState { - my $hash = shift; - my $name = $hash->{NAME}; - - my $online_state = - ReadingsVal( $name, 'device_info-connection_status', 'unknown' ); - - #online state mower - readingsBulkUpdate( $hash, 'state', - $online_state eq 'online' - ? ReadingsVal( $name, 'mower-status', 'readingsValError' ) - : 'offline' ) - if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' ); - - # ic24 / wc / electronic pump - - if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' - || AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' - || 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 = ''; - my $error_type = 'ok'; - 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 ); - ## set error type (pumpe required) - $error_type = ReadingsVal( $name, 'error-valve_error_'.$_.'_type', 'ok' ) if (ReadingsVal( $name, 'error-valve_error_'.$_.'_type', 'ok' ) ne 'ok'); - ## 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 ) ); - - # 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, 5, "[DEBUG] - process: $processed_item"; - Log3 $name, 5, "[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, 5, "[DEBUG] - next_start: empty "; - Log3 $name, 5, "[DEBUG] - empty pro item ".Time::Piece->strptime( $processed_item, "%Y-%m-%d %H:%M:%S"); - Log3 $name, 5, "[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:%S") - < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M:%S") - && $has_schedule - && Time::Piece->strptime( $processed_item, "%Y-%m-%d %H:%M:%S") - > Time::Piece->new - ) - } else { - $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); - } - Log3 $name, 5, "[DEBUG] - choosed nearst: $nearst_irrigation"; - - -###### -###### -###### $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(@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)); - } # /for - } else { - $state_string .= RigReadingsValue($hash, 'closed'); - } - $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 - { - - } - ' ) - if ( AttrVal( $name, 'stateFormat', 'none' ) eq 'none' ); - } else { - Log3 $name, 5, "[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_schedule - && $nearst_irrigation ne '2999-12-12 12:00') - # zeitplan aktiv - # ? ( $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 - : (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') - ; - # state offline | override - $state_string = 'offline' if ($online_state eq 'offline'); - $state_string = ( $error_type ne 'ok' ) ? $error_type : $state_string; - - } - readingsBulkUpdate( - $hash, 'state', RigReadingsValue( $hash, $state_string ) ); - } - - # Sensor / Sensor 2 - if ( AttrVal( $name, 'model', 'unknown' ) =~ /sensor.?/ ) { - my $state_string = - ( ReadingsVal( $name, 'device_info-category', 'unknown' ) eq - 'sensor' ) - ? 'T: ' - . ReadingsVal( $name, 'ambient_temperature-temperature', - 'readingsValError' ) - . '°C, ' - : 'T: ' - . ReadingsVal( $name, 'soil_temperature-temperature', - 'readingsValError' ) - . '°C, '; - $state_string .= 'H: ' - . ReadingsVal( $name, 'humidity-humidity', 'readingsValError' ) . '%'; - $state_string .= ', L: ' - . ReadingsVal( $name, 'light-light', 'readingsValError' ) . 'lux' - if ( ReadingsVal( $name, 'device_info-category', 'unknown' ) eq - 'sensor' ); - -# if ( $online_state eq 'offline') { -# readingsBulkUpdate( $hash, 'humidity-humidity', '-1' ); -# readingsBulkUpdate( $hash, 'ambient_temperature-temperature', '-1' ) if (ReadingsVal($name, 'device_info-category', 'unknown') eq 'sensor'); -# readingsBulkUpdate( $hash, 'light-light', '-1' ) if (ReadingsVal($name, 'device_info-category', 'unknown') eq 'sensor'); -# } - #online state sensor I II - readingsBulkUpdate( $hash, 'state', - $online_state eq 'online' ? RigReadingsValue( $hash, $state_string) : RigReadingsValue( $hash, 'offline') ); - } - - readingsBulkUpdate( $hash, 'state', - ReadingsVal( $name, 'power-power_timer', 'no info from power-timer' ) ) - if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' ); - - return; -} - -################################## -################################## -#### my little helpers ########### - -sub ReadingLangGerman { - my $hash = shift; - my $readingValue = shift; - - my $name = $hash->{NAME}; - my %langGermanMapp = ( - 'ok_cutting' => 'mähen', - 'paused' => 'pausiert', - 'ok_searching' => 'suche Ladestation', - 'ok_charging' => 'lädt', - 'ok_leaving' => 'unterwegs zum Startpunkt', - 'wait_updating' => 'wird aktualisiert ...', - 'wait_power_up' => 'wird eingeschaltet ...', - 'parked_timer' => 'geparkt nach Zeitplan', - 'parked_park_selected' => 'geparkt', - 'off_disabled' => 'der Mäher ist ausgeschaltet', - 'off_hatch_open' => 'deaktiviert. Abdeckung ist offen oder PIN-Code erforderlich', - 'unknown' => 'unbekannter Status', - 'error' => 'Fehler', - 'error_at_power_up' => 'Neustart ...', - 'off_hatch_closed' => 'Deaktiviert. Manueller Start erforderlich', - 'ok_cutting_timer_overridden' => 'manuelles mähen', - 'parked_autotimer' => 'geparkt durch SensorControl', - 'parked_daily_limit_reached' => 'abgeschlossen', - 'no_message' => 'kein Fehler', - 'outside_working_area' => 'außerhalb des Arbeitsbereichs', - 'no_loop_signal' => 'kein Schleifensignal', - 'wrong_loop_signal' => 'falsches Schleifensignal', - 'loop_sensor_problem_front' => 'Problem Schleifensensor, vorne', - 'loop_sensor_problem_rear' => 'Problem Schleifensensor, hinten', - 'trapped' => 'eingeschlossen', - 'upside_down' => 'steht auf dem Kopf', - 'low_battery' => 'niedriger Batteriestand', - 'empty_battery' => 'Batterie leer', - 'no_drive' => 'fährt nicht', - 'lifted' => 'angehoben', - 'stuck_in_charging_station' => 'eingeklemmt in Ladestation', - 'charging_station_blocked' => 'Ladestation blockiert', - 'collision_sensor_problem_rear' => 'Problem Stoßsensor hinten', - 'collision_sensor_problem_front' => 'Problem Stoßsensor vorne', - 'wheel_motor_blocked_right' => 'Radmotor rechts blockiert', - 'wheel_motor_blocked_left' => 'Radmotor links blockiert', - 'wheel_drive_problem_right' => 'Problem Antrieb, rechts', - 'wheel_drive_problem_left' => 'Problem Antrieb, links', - 'cutting_system_blocked' => 'Schneidsystem blockiert', - 'invalid_sub_device_combination' => 'fehlerhafte Verbindung', - 'settings_restored' => 'Standardeinstellungen', - 'electronic_problem' => 'elektronisches Problem', - 'charging_system_problem' => 'Problem Ladesystem', - 'tilt_sensor_problem' => 'Kippsensor Problem', - 'wheel_motor_overloaded_right' => 'rechter Radmotor überlastet', - 'wheel_motor_overloaded_left' => 'linker Radmotor überlastet', - 'charging_current_too_high' => 'Ladestrom zu hoch', - 'temporary_problem' => 'vorübergehendes Problem', - 'guide_1_not_found' => 'SK 1 nicht gefunden', - 'guide_2_not_found' => 'SK 2 nicht gefunden', - 'guide_3_not_found' => 'SK 3 nicht gefunden', - 'difficult_finding_home' => 'Problem die Ladestation zu finden', - 'guide_calibration_accomplished' => 'Kalibrierung des Suchkabels beendet', - 'guide_calibration_failed' => 'Kalibrierung des Suchkabels fehlgeschlagen', - 'temporary_battery_problem' => 'kurzzeitiges Batterieproblem', - 'battery_problem' => 'Batterieproblem', - 'alarm_mower_switched_off' => 'Alarm! Mäher ausgeschalten', - 'alarm_mower_stopped' => 'Alarm! Mäher gestoppt', - 'alarm_mower_lifted' => 'Alarm! Mäher angehoben', - 'alarm_mower_tilted' => 'Alarm! Mäher gekippt', - 'connection_changed' => 'Verbindung geändert', - 'connection_not_changed' => 'Verbindung nicht geändert', - 'com_board_not_available' => 'COM Board nicht verfügbar', - 'slipped' => 'rutscht', - 'out_of_operation' => 'ausser Betrieb', - 'replace_now' => 'kritischer Batteriestand, wechseln Sie jetzt', - 'low' => 'niedrig', - 'ok' => 'ok', - 'no_source' => 'ok', - 'mower_charging' => 'Mäher wurde geladen', - 'completed_cutting_autotimer' => 'Sensor Control erreicht', - 'week_timer' => 'Wochentimer erreicht', - 'countdown_timer' => 'Stoppuhr Timer', - 'undefined' => 'unklar', - 'unknown' => 'unklar', - 'status_device_unreachable' => 'Gerät ist nicht in Reichweite', - 'status_device_alive' => 'Gerät ist in Reichweite', - 'bad' => 'schlecht', - 'poor' => 'schwach', - 'good' => 'gut', - 'undefined' => 'unklar', - 'idle' => 'nichts zu tun', - 'firmware_cancel' => 'Firmwareupload unterbrochen', - 'firmware_upload' => 'Firmwareupload', - 'unsupported' => 'nicht unterstützt', - 'up_to_date' => 'auf dem neusten Stand', - 'mower' => 'Mäher', - 'watering_computer' => 'Bewässerungscomputer', - 'no_frost' => 'kein Frost', - 'open' => 'offen', - 'closed' => 'geschlossen', - 'included' => 'inbegriffen', - 'active' => 'aktiv', - 'inactive' => 'nicht aktiv', - 'hibernate' => 'Winterschlaf', - 'awake' => 'Aufgewacht', - 'schedule permanently paused' => 'Zeitplan dauerhaft pausiert', - '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', - 'pump_not_filled' => 'Pumpe nicht gefüllt', - ); - - if ( - defined( $langGermanMapp{$readingValue} ) - && ( AttrVal( 'global', 'language', 'none' ) eq 'DE' - || AttrVal( $name, 'readingValueLanguage', 'none' ) eq 'de' ) - && AttrVal( $name, 'readingValueLanguage', 'none' ) ne 'en' - ) - { - return $langGermanMapp{$readingValue}; - } - else { - return $readingValue; - } - - return; -} - -sub RigReadingsValue { - my $hash = shift; - my $readingValue = shift; - - my $rigReadingValue; - - if ( $readingValue =~ /^(\d+)-(\d\d)-(\d\d)T(\d\d)/ ) { - $rigReadingValue = Zulu2LocalString($readingValue); - } - else { - $rigReadingValue = ReadingLangGerman( $hash, $readingValue ); - } - - return $rigReadingValue; -} - -sub Zulu2LocalString { - my $t = shift; - - my ( $datehour, $datemin, $rest ) = split( /:/, $t, 3 ); - - my ( $year, $month, $day, $hour, $min ) = - $datehour =~ /(\d+)-(\d\d)-(\d\d)T(\d\d)/; - my $epoch = timegm( 0, 0, $hour, $day, $month - 1, $year ); - - my ( $lyear, $lmonth, $lday, $lhour, $isdst ) = - ( localtime($epoch) )[ 5, 4, 3, 2, -1 ]; - - $lyear += 1900; # year is 1900 based - $lmonth++; # month number is zero based - - if ( defined($rest) ) { - return ( - sprintf( - "%04d-%02d-%02d %02d:%02d:%s", - $lyear, $lmonth, $lday, - $lhour, $datemin, substr( $rest, 0, 2 ) - ) - ); - } - elsif ( $lyear < 2000 ) { - return 'temporarily unavailable'; - } - else { - return ( - sprintf( - "%04d-%02d-%02d %02d:%02d", - $lyear, $lmonth, $lday, $lhour, substr( $datemin, 0, 2 ) - ) - ); - } - - return; -} - -sub SetPredefinedStartPoints { - my $hash = shift; - my $aArg = shift; - - my ( $startpoint_state, $startpoint_num, @morestartpoints ) = @{$aArg}; - - my $name = $hash->{NAME}; - my $payload; - my $abilities; - - if ( defined($startpoint_state) && defined($startpoint_num) ) { - if ( defined( $hash->{helper}{STARTINGPOINTS} ) - && $hash->{helper}{STARTINGPOINTS} ne '' ) - { -# add needed parameters to saved settings config and change the value in request - my $decode_json_settings = - eval { decode_json( $hash->{helper}{STARTINGPOINTS} ) }; - if ($@) { - Log3 $name, 3, -"GardenaSmartBridge ($name) - JSON error while setting startpoint: $@"; - } - - $decode_json_settings->{device} = $hash->{DEVICEID}; - my $setval = $startpoint_state eq 'disable' ? \0 : \1; - $decode_json_settings->{value}[ $startpoint_num - 1 ]{enabled} = - $setval; - - #set more startpoints - if ( - defined scalar(@morestartpoints) - && ( scalar(@morestartpoints) == 2 - || scalar(@morestartpoints) == 4 ) - ) - { - if ( scalar(@morestartpoints) == 2 ) { - $setval = $morestartpoints[0] eq 'disable' ? \0 : \1; - $decode_json_settings->{value}[ $morestartpoints[1] - 1 ] - {enabled} = $setval; - - } - elsif ( scalar(@morestartpoints) == 4 ) { - $setval = $morestartpoints[0] eq 'disable' ? \0 : \1; - $decode_json_settings->{value}[ $morestartpoints[1] - 1 ] - {enabled} = $setval; - $setval = $morestartpoints[2] eq 'disable' ? \0 : \1; - $decode_json_settings->{value}[ $morestartpoints[3] - 1 ] - {enabled} = $setval; - } - } - - $payload = '"settings": ' . encode_json($decode_json_settings); - $abilities = 'mower_settings'; - - #$abilities['service_id'] = $hash->{helper}{STARTINGPOINTID}; - } - else { - return - "startingpoints not loaded yet, please wait a couple of minutes", - undef, undef; - } - } - else { - return - "startpoint usage: set " - . $hash->{NAME} - . " startpoint disable 1 [enable 2] [disable 3]", undef, undef; - } - - return undef, $payload, $abilities; -} - -1; - -=pod - -=item device -=item summary Modul to control GardenaSmart Devices -=item summary_DE Modul zur Steuerung von GardenaSmartgeräten - -=begin html - - -

GardenaSmartDevice

-
    - In combination with GardenaSmartBridge this FHEM Module controls the GardenaSmart Device using the GardenaCloud -

    - Once the Bridge device is created, the connected devices are automatically recognized and created in FHEM.
    - From now on the devices can be controlled and changes in the GardenaAPP are synchronized with the state and readings of the devices. - -


    - Readings -
      -
    • battery-charging - Indicator if the Battery is charged (0/1) or with newer Firmware (false/true)
    • -
    • battery-level - load percentage of the Battery
    • -
    • battery-rechargeable_battery_status - healthyness of the battery (out_of_operation/replace_now/low/ok)
    • -
    • device_info-category - category of device (mower/watering_computer)
    • -
    • device_info-last_time_online - timestamp of last radio contact
    • -
    • device_info-manufacturer - manufacturer
    • -
    • device_info-product - product type
    • -
    • device_info-serial_number - serial number
    • -
    • device_info-sgtin -
    • -
    • device_info-version - firmware version
    • -
    • firmware-firmware_command - firmware command (idle/firmware_cancel/firmware_upload/unsupported)
    • -
    • firmware-firmware_status - firmware status
    • -
    • firmware-firmware_update_start - indicator when a firmwareupload is started
    • -
    • firmware-firmware_upload_progress - progress indicator of firmware update
    • -
    • firmware-inclusion_status - inclusion status
    • -
    • internal_temperature-temperature - internal device temperature
    • -
    • mower-error - actual error message -
        -
      • no_message
      • -
      • outside_working_area
      • -
      • no_loop_signal
      • -
      • wrong_loop_signal
      • -
      • loop_sensor_problem_front
      • -
      • loop_sensor_problem_rear
      • -
      • trapped
      • -
      • upside_down
      • -
      • low_battery
      • -
      • empty_battery
      • -
      • no_drive
      • -
      • lifted
      • -
      • stuck_in_charging_station
      • -
      • charging_station_blocked
      • -
      • collision_sensor_problem_rear
      • -
      • collision_sensor_problem_front
      • -
      • wheel_motor_blocked_right
      • -
      • wheel_motor_blocked_left
      • -
      • wheel_drive_problem_right
      • -
      • wheel_drive_problem_left
      • -
      • cutting_system_blocked
      • -
      • invalid_sub_device_combination
      • -
      • settings_restored
      • -
      • electronic_problem
      • -
      • charging_system_problem
      • -
      • tilt_sensor_problem
      • -
      • wheel_motor_overloaded_right
      • -
      • wheel_motor_overloaded_left
      • -
      • charging_current_too_high
      • -
      • temporary_problem
      • -
      • guide_1_not_found
      • -
      • guide_2_not_found
      • -
      • guide_3_not_found
      • -
      • difficult_finding_home
      • -
      • guide_calibration_accomplished
      • -
      • guide_calibration_failed
      • -
      • temporary_battery_problem
      • -
      • battery_problem
      • -
      • alarm_mower_switched_off
      • -
      • alarm_mower_stopped
      • -
      • alarm_mower_lifted
      • -
      • alarm_mower_tilted
      • -
      • connection_changed
      • -
      • connection_not_changed
      • -
      • com_board_not_available
      • -
      • slipped
      • -
      -
    • -
    • mower-manual_operation - (0/1) or with newer Firmware (false/true)
    • -
    • mower-override_end_time - manual override end time
    • -
    • mower-source_for_next_start - source for the next start -
        -
      • no_source
      • -
      • mower_charging
      • -
      • completed_cutting_autotimer
      • -
      • week_timer
      • -
      • countdown_timer
      • -
      • undefined
      • -
      -
    • -
    • mower-status - mower state (see state)
    • -
    • mower-timestamp_next_start - timestamp of next scheduled start
    • -
    • radio-connection_status - state of connection
    • -
    • radio-quality - percentage of the radio quality
    • -
    • radio-state - radio state (bad/poor/good/undefined)
    • -
    • state - state of the mower -
        -
      • paused
      • -
      • ok_cutting
      • -
      • ok_searching
      • -
      • ok_charging
      • -
      • ok_leaving
      • -
      • wait_updating
      • -
      • wait_power_up
      • -
      • parked_timer
      • -
      • parked_park_selected
      • -
      • off_disabled
      • -
      • off_hatch_open
      • -
      • unknown
      • -
      • error
      • -
      • error_at_power_up
      • -
      • off_hatch_closed
      • -
      • ok_cutting_timer_overridden
      • -
      • parked_autotimer
      • -
      • parked_daily_limit_reached
      • -
      -
    • -
    -

    - - Attributes -
      -
    • readingValueLanguage - Change the Language of Readings (de,en/if not set the default is english and the global language is not set at german)
    • -
    • model -
    • -
    -

    - - set -
      -
    • winter_mode - awake | hibernate
    • -
    -
      -

      mower

      -
    • parkUntilFurtherNotice
    • -
    • parkUntilNextTimer
    • -
    • startOverrideTimer - (in minutes, 60 = 1h, 1440 = 24h, 4320 = 72h)
    • -
    • startResumeSchedule
    • -
    • startpoint enable|disable 1|2|3 - enables or disables one or more predefined start points
    • -
        -
      • set NAME startpoint enable 1
      • -
      • set NAME startpoint disable 3 enable 1
      • -
      -

      irrigation control

      -
    • resumeScheduleValve - start schedule irrigation on valve n
    • -
    • stopScheduleValve - stop schedule irrigation on valve n (Default: 2038-01-18T00:00:00.000Z) | optional params hours (now + hours)
    • -
    • closeAllValves - close all valves
    • -

      water control

      -
    • manualButtonTime - set manual time for button press (in minutes) 0 disable button
    • -
    • stopSchedule - stop schedule for now + n hours (Default: 2038-01-18T00:00:00.000Z)
    • -
    • resumeSchedule - resume schedule
    • -
    -
- -=end html -=begin html_DE - - -

GardenaSmartDevice

-
    - Zusammen mit dem Device GardenaSmartDevice stellt dieses FHEM Modul die Kommunikation zwischen der GardenaCloud und Fhem her. -

    - Wenn das GardenaSmartBridge Device erzeugt wurde, werden verbundene Geräte automatisch erkannt und in Fhem angelegt.
    - Von nun an können die eingebundenen Geräte gesteuert werden. Änderungen in der APP werden mit den Readings und dem Status syncronisiert. - -
-
-
    - Readings -
      -
    • battery-charging - Ladeindikator (0/1) oder mit neuerer Firmware (false/true)
    • -
    • battery-level - Ladezustand der Batterie in Prozent
    • -
    • battery-rechargeable_battery_status - Zustand der Batterie (Ausser Betrieb/Kritischer Batteriestand, wechseln Sie jetzt/Niedrig/oK)
    • -
    • device_info-category - Eigenschaft des Gerätes (Mäher/Bewässerungscomputer/Bodensensor)
    • -
    • device_info-last_time_online - Zeitpunkt der letzten Funkübertragung
    • -
    • device_info-manufacturer - Hersteller
    • -
    • device_info-product - Produkttyp
    • -
    • device_info-serial_number - Seriennummer
    • -
    • device_info-sgtin -
    • -
    • device_info-version - Firmware Version
    • -
    • firmware-firmware_command - Firmware Kommando (Nichts zu tun/Firmwareupload unterbrochen/Firmwareupload/nicht unterstützt)
    • -
    • firmware-firmware_status - Firmware Status
    • -
    • firmware-firmware_update_start - Firmwareupdate (0/1) oder mit neuerer Firmware (false/true)
    • -
    • firmware-firmware_upload_progress - Firmwareupdatestatus in Prozent
    • -
    • firmware-inclusion_status - Einbindungsstatus
    • -
    • internal_temperature-temperature - Interne Geräte Temperatur
    • -
    • mower-error - Aktuelle Fehler Meldung -
        -
      • Kein Fehler
      • -
      • Außerhalb des Arbeitsbereichs
      • -
      • Kein Schleifensignal
      • -
      • Falsches Schleifensignal
      • -
      • Problem Schleifensensor, vorne
      • -
      • Problem Schleifensensor, hinten
      • -
      • Eingeschlossen
      • -
      • Steht auf dem Kopf
      • -
      • Niedriger Batteriestand
      • -
      • Batterie ist leer
      • -
      • Kein Antrieb
      • -
      • Angehoben
      • -
      • Eingeklemmt in Ladestation
      • -
      • Ladestation blockiert
      • -
      • Problem Stoßsensor hinten
      • -
      • Problem Stoßsensor vorne
      • -
      • Radmotor rechts blockiert
      • -
      • Radmotor links blockiert
      • -
      • Problem Antrieb, rechts
      • -
      • Problem Antrieb, links
      • -
      • Schneidsystem blockiert
      • -
      • Fehlerhafte Verbindung
      • -
      • Standardeinstellungen
      • -
      • Elektronisches Problem
      • -
      • Problem Ladesystem
      • -
      • Kippsensorproblem
      • -
      • Rechter Radmotor überlastet
      • -
      • Linker Radmotor überlastet
      • -
      • Ladestrom zu hoch
      • -
      • Vorübergehendes Problem
      • -
      • SK 1 nicht gefunden
      • -
      • SK 2 nicht gefunden
      • -
      • SK 3 nicht gefunden
      • -
      • Problem die Ladestation zu finden
      • -
      • Kalibration des Suchkabels beendet
      • -
      • Kalibration des Suchkabels fehlgeschlagen
      • -
      • Kurzzeitiges Batterieproblem
      • -
      • Batterieproblem
      • -
      • Alarm! Mäher ausgeschalten
      • -
      • Alarm! Mäher gestoppt
      • -
      • Alarm! Mäher angehoben
      • -
      • Alarm! Mäher gekippt
      • -
      • Verbindung geändert
      • -
      • Verbindung nicht geändert
      • -
      • COM board nicht verfügbar
      • -
      • Rutscht
      • -
      -
    • -
    • mower-manual_operation - Manueller Betrieb (0/1) oder mit neuerer Firmware (false/true)
    • -
    • mower-override_end_time - Zeitpunkt wann der manuelle Betrieb beendet ist
    • -
    • mower-source_for_next_start - Grund für den nächsten Start -
        -
      • Kein Grund
      • -
      • Mäher wurde geladen
      • -
      • SensorControl erreicht
      • -
      • Wochentimer erreicht
      • -
      • Stoppuhr Timer
      • -
      • Undefiniert
      • -
      -
    • -
    • mower-status - Mäher Status (siehe state)
    • -
    • mower-timestamp_next_start - Zeitpunkt des nächsten geplanten Starts
    • -
    • radio-connection_status - Status der Funkverbindung
    • -
    • radio-quality - Indikator für die Funkverbindung in Prozent
    • -
    • radio-state - radio state (schlecht/schwach/gut/Undefiniert)
    • -
    • state - Staus des Mähers -
        -
      • Pausiert
      • -
      • Mähen
      • -
      • Suche Ladestation
      • -
      • Lädt
      • -
      • Mähen
      • -
      • Wird aktualisiert ...
      • -
      • Wird eingeschaltet ...
      • -
      • Geparkt nach Zeitplan
      • -
      • Geparkt
      • -
      • Der Mäher ist ausgeschaltet
      • -
      • Deaktiviert. Abdeckung ist offen oder PIN-Code erforderlich
      • -
      • Unbekannter Status
      • -
      • Fehler
      • -
      • Neustart ...
      • -
      • Deaktiviert. Manueller Start erforderlich
      • -
      • Manuelles Mähen
      • -
      • Geparkt durch SensorControl
      • -
      • Abgeschlossen
      • -
      -
    • -
    -

    - - Attribute -
      -
    • readingValueLanguage - Änderung der Sprache der Readings (de,en/wenn nichts gesetzt ist, dann Englisch es sei denn deutsch ist als globale Sprache gesetzt)
    • -
    • model -
    • -
    - - set -
      -
    • winter_mode - aufwäcken (awake)| winterschlaf (hibernate)
    • -
    -
      -

      mäher

      -
    • parkUntilFurtherNotice - Parken des Mähers unter Umgehung des Zeitplans
    • -
    • parkUntilNextTimer - Parken bis zum nächsten Zeitplan
    • -
    • startOverrideTimer - Manuelles mähen (in Minuten, 60 = 1h, 1440 = 24h, 4320 = 72h)
    • -
    • startResumeSchedule - Weiterführung des Zeitplans
    • -
    • startpoint enable|disable 1|2|3 - Aktiviert oder deaktiviert einen vordefinierten Startbereich
    • -
        -
      • set NAME startpoint enable 1
      • -
      • set NAME startpoint disable 3 enable 1
      • -
      -

      irrigation control

      -
    • resumeScheduleValve - Startet Bew&aauml;sserung am Ventil n nach Zeitplan
    • -
    • stopScheduleValve - Setzt Bew&aauml;sserung am Ventil n aus (Default: 2038-01-18T00:00:00.000Z) | Optionaler Parameter Stunden (Jetzt + Stunden)
    • -
    • closeAllValves - Stopt Bew&aauml;sserung an allen Ventilen
    • -

      water control

      -
    • manualButtonTime - setzt die Dauer für den manuellen Knopf (in Minuten) 0 Schaltet den Knopf aus
    • -
    • stopSchedule - Halte Zeitplan an für x Stunden - (Default: 2038-01-18T00:00:00.000Z)
    • -
    • resumeSchedule - Weiterführung des Zeitplans
    • -
    -
- -=end html_DE - -=for :application/json;q=META.json 74_GardenaSmartDevice.pm -{ - "abstract": "Modul to control GardenaSmart Devices", - "x_lang": { - "de": { - "abstract": "Modul zur Steuerung von Gardena Smart Geräten" - } - }, - "keywords": [ - "fhem-mod-device", - "fhem-core", - "Garden", - "Gardena", - "Smart" - ], - "release_status": "stable", - "license": "GPL_2", - "version": "v2.5.5", - "author": [ - "Marko Oldenburg " - ], - "x_fhem_maintainer": [ - "CoolTux" - ], - "x_fhem_maintainer_github": [ - "LeonGaultier" - ], - "prereqs": { - "runtime": { - "requires": { - "FHEM": 5.00918799, - "perl": 5.016, - "Meta": 0, - "JSON": 0, - "Time::Local": 0 - }, - "recommends": { - }, - "suggests": { - } - } - } -} -=end :application/json;q=META.json - -=cut +############################################################################### +# +# Developed with VSCodium and richterger perl plugin. +# +# (c) 2017-2022 Copyright: Marko Oldenburg (fhemdevelopment at cooltux dot net) +# All rights reserved +# +# Special thanks goes to comitters: +# - Michael (mbrak) Thanks for Commandref +# - Matthias (Kenneth) Thanks for Wiki entry +# - BioS Thanks for predefined start points Code +# - fettgu Thanks for Debugging Irrigation Control data flow +# - Sebastian (BOFH) Thanks for new Auth Code after API Change +# +# +# This script is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# any later version. +# +# The GNU General Public License can be found at +# http://www.gnu.org/copyleft/gpl.html. +# A copy is found in the textfile GPL.txt and important notices to the license +# from the author is found in LICENSE.txt distributed with these scripts. +# +# This script is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# +# $Id$ +# +############################################################################### +## +## +## Das JSON Modul immer in einem eval aufrufen +# $data = eval{decode_json($data)}; +# +# if($@){ +# Log3($SELF, 2, "$TYPE ($SELF) - error while request: $@"); +# +# readingsSingleUpdate($hash, "state", "error", 1); +# +# return; +# } +# +# +###### Wichtige Notizen +# +# apt-get install libio-socket-ssl-perl +# http://www.dxsdata.com/de/2016/07/php-class-for-gardena-smart-system-api/ +# +## +## + +## unserer packagename +package FHEM::GardenaSmartDevice; +use GPUtils qw(GP_Import GP_Export); + +use strict; +use warnings; +use POSIX; +use FHEM::Meta; +use Time::Local; +use Time::Piece; +use Time::Seconds; + +# try to use JSON::MaybeXS wrapper +# for chance of better performance + open code +eval { + require JSON::MaybeXS; + import JSON::MaybeXS qw( decode_json encode_json ); + 1; +} or do { + + # try to use JSON wrapper + # for chance of better performance + eval { + # JSON preference order + local $ENV{PERL_JSON_BACKEND} = + 'Cpanel::JSON::XS,JSON::XS,JSON::PP,JSON::backportPP' + unless ( defined( $ENV{PERL_JSON_BACKEND} ) ); + + require JSON; + import JSON qw( decode_json encode_json ); + 1; + } or do { + + # In rare cases, Cpanel::JSON::XS may + # be installed but JSON|JSON::MaybeXS not ... + eval { + require Cpanel::JSON::XS; + import Cpanel::JSON::XS qw(decode_json encode_json); + 1; + } or do { + + # In rare cases, JSON::XS may + # be installed but JSON not ... + eval { + require JSON::XS; + import JSON::XS qw(decode_json encode_json); + 1; + } or do { + + # Fallback to built-in JSON which SHOULD + # be available since 5.014 ... + eval { + require JSON::PP; + import JSON::PP qw(decode_json encode_json); + 1; + } or do { + + # Fallback to JSON::backportPP in really rare cases + require JSON::backportPP; + import JSON::backportPP qw(decode_json encode_json); + 1; + }; + }; + }; + }; +}; + +## Import der FHEM Funktionen +#-- Run before package compilation +BEGIN { + + # Import from main context + GP_Import( + qw(readingsSingleUpdate + readingsBulkUpdate + readingsBulkUpdateIfChanged + readingsBeginUpdate + readingsEndUpdate + Log3 + CommandAttr + AttrVal + ReadingsVal + readingFnAttributes + AssignIoPort + modules + IOWrite + defs + makeDeviceName) + ); +} + +#-- Export to main context with different name +GP_Export( + qw( + Initialize + ) +); + +sub Initialize { + my $hash = shift; + + $hash->{Match} = '^{"id":".*'; + + $hash->{SetFn} = \&Set; + $hash->{DefFn} = \&Define; + $hash->{UndefFn} = \&Undef; + $hash->{ParseFn} = \&Parse; + + $hash->{AttrFn} = \&Attr; + $hash->{AttrList} = + "readingValueLanguage:de,en " + . "model:watering_computer,sensor,sensor2,mower,ic24,power,electronic_pressure_pump " + . "extendedState:0,1 " + . "IODev " + . $readingFnAttributes; + $hash->{parseParams} = 1; + + return FHEM::Meta::InitMod( __FILE__, $hash ); +} + +sub Define { + my $hash = shift // return; + my $aArg = shift // return; + + return $@ unless ( FHEM::Meta::SetInternals($hash) ); + use version 0.60; our $VERSION = FHEM::Meta::Get( $hash, 'version' ); + + return + "too few parameters: define GardenaSmartDevice " + if ( scalar( @{$aArg} ) < 3 ); + + my $name = $aArg->[0]; + 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} = ''; + # Electroni Pressure Pump + $hash->{helper}{operating_mode_id} = ''; + $hash->{helper}{leakage_detection_id} = ''; + $hash->{helper}{turn_on_pressure_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} = ''; + + CommandAttr( undef, + "$name IODev $modules{GardenaSmartBridge}{defptr}{BRIDGE}->{NAME}" ) + if ( AttrVal( $name, 'IODev', 'none' ) eq 'none' ); + + my $iodev = AttrVal( $name, 'IODev', 'none' ); + + AssignIoPort( $hash, $iodev ) if ( !$hash->{IODev} ); + + if ( defined( $hash->{IODev}->{NAME} ) ) { + Log3 $name, 3, "GardenaSmartDevice ($name) - I/O device is " + . $hash->{IODev}->{NAME}; + } + else { + Log3 $name, 1, "GardenaSmartDevice ($name) - no I/O device"; + } + + $iodev = $hash->{IODev}->{NAME}; + + my $d = $modules{GardenaSmartDevice}{defptr}{$deviceId}; + + return +"GardenaSmartDevice device $name on GardenaSmartBridge $iodev already defined." + if ( defined($d) + && $d->{IODev} == $hash->{IODev} + && $d->{NAME} ne $name ); + + CommandAttr( undef, $name . ' room GardenaSmart' ) + if ( AttrVal( $name, 'room', 'none' ) eq 'none' ); + + CommandAttr( undef, $name . ' model ' . $category ) + if ( AttrVal( $name, 'model', 'none' ) eq 'none' ); + + Log3 $name, 3, +"GardenaSmartDevice ($name) - defined GardenaSmartDevice with DEVICEID: $deviceId"; + readingsSingleUpdate( $hash, 'state', 'initialized', 1 ); + + $modules{GardenaSmartDevice}{defptr}{$deviceId} = $hash; + + return; +} + +sub Undef { + my $hash = shift; + my $arg = shift; + + my $name = $hash->{NAME}; + my $deviceId = $hash->{DEVICEID}; + + delete $modules{GardenaSmartDevice}{defptr}{$deviceId}; + + return; +} + +sub Attr { + + my ( $cmd, $name, $attrName, $attrVal ) = @_; + my $hash = $defs{$name}; + + return; +} + +sub Set { + my $hash = shift // return; + my $aArg = shift // return; + + my $name = shift @$aArg; + my $cmd = shift @$aArg + // return qq{"set $name" needs at least one argument}; + + my $payload; + my $abilities; + my $service_id; + my $mainboard_version = + ReadingsVal( $name, 'mower_type-mainboard_version', 0.0 ); + + my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat, + $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) = localtime(time); + + my $timezone_offset = $Sommerzeit ? 0 : ( Time::Piece->new )->tzoffset; + + #set default abilitie ... overwrite in cmd to change + $abilities = 'mower' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' ); + $abilities = 'watering' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' + || AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' ); + $abilities = 'power' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' ); + $abilities = 'watering' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' ); + + ### mower + # service_id (eco, parkuntilfurhternotice, startpoints) + if ( lc $cmd eq 'parkuntilfurthernotice' ) { + $payload = '"name":"park_until_further_notice"'; + if ( $mainboard_version > 10.30 ) { + $payload = +' "settings":{"name":"schedules_paused_until","value":"2038-01-18T00:00:00.000Z","device":"' + . $hash->{DEVICEID} . '"}'; + $abilities = 'mower_settings'; + $service_id = $hash->{helper}{schedules_paused_until_id}; + } + } + elsif ( lc $cmd eq 'parkuntilnexttimer' ) { + $payload = '"name":"park_until_next_timer"'; + if ( $mainboard_version > 10.30 ) { + $payload = '"properties":{"name":"mower_timer","value":0}'; + $abilities = 'mower_timer'; + } + } + elsif ( lc $cmd eq 'startresumeschedule' ) { + $payload = '"name":"start_resume_schedule"'; + if ( $mainboard_version > 10.30 ) { + $payload = +' "settings":{"name":"schedules_paused_until","value":"","device":"' + . $hash->{DEVICEID} . '"}'; + $abilities = 'mower_settings'; + $service_id = $hash->{helper}{schedules_paused_until_id}; + } + } + elsif ( lc $cmd eq 'startoverridetimer' ) { + $payload = '"name":"start_override_timer","parameters":{"duration":' + . $aArg->[0] * 60 . '}'; + if ( $mainboard_version > 10.30 ) { + $payload = '"properties":{"name":"mower_timer","value":' + . $aArg->[0] * 60 . '}'; + $abilities = 'mower_timer'; + } + + } + elsif ( lc $cmd eq 'startpoint' ) { + my $err; + ( $err, $payload, $abilities ) = + SetPredefinedStartPoints( $hash, $aArg ); + $service_id = $hash->{helper}{STARTINGPOINTID}; + return $err if ( defined($err) ); + } + elsif ( lc $cmd eq 'eco' ) { + $payload = + '"settings": {"name": "eco_mode", "value": ' + . $aArg->[0] + . ', "device": "' + . $hash->{DEVICEID} . '"}'; + $abilities = 'mower_settings' if ( $mainboard_version > 10.30 ); + $service_id = $hash->{helper}{eco_mode_id}; + +#$abilities['service_id'] = $hash->{helper}{SCHEDULESID} if ( $mainboard_version > 10.30 ); + } + ### electronic_pressure_pump + # elsif ( lc $cmd eq 'pumptimer' ) { + # $payload = + # '"name":"pump_manual_watering_timer","parameters":{"duration":' + # . $aArg->[0] . '}'; + # } + ### watering_computer & electronic pump + elsif ( lc $cmd eq 'manualoverride' ) { + $payload = + '"properties":{"name":"watering_timer_1' + . '","value":{"state":"manual","duration":' + . $aArg->[0] * 60 + . ',"valve_id":1}}'; + } + elsif ( lc $cmd eq 'manualbuttontime' ) { + $service_id = $hash->{helper}{button_config_time_id}; + $payload = + '"properties":{"name":"button_config_time",' + . '"value":' + . $aArg->[0] * 60 + . ',"timestamp":"2021-05-26T19:06:23.680Z"' + . ',"at_bound":null,"unit":"seconds","ability":"' + . $service_id . '"}'; + $abilities = 'watering_button_config'; + } + elsif ( $cmd =~ m{\AcancelOverride}xms ) { + + my $valve_id = 1; + + if ( $cmd =~ m{\AcancelOverrideValve(\d)\z}xms ) { + $valve_id = $1; + } + + $payload = + '"properties":{"name":"watering_timer_' + . $valve_id + . '","value":{"state":"idle","duration":' + . 0 + . ',"valve_id":' + . $valve_id . '}}'; + } + elsif ( $cmd =~ /.*Schedule$/ ) { + my $duration = ( + ( + defined( $aArg->[0] ) + ? ( + ( + ( Time::Piece->new ) + + ( ONE_HOUR * $aArg->[0] ) - + $timezone_offset + )->datetime + ) + . '.000Z' + : '2038-01-18T00:00:00.000Z' + ) + ); + + $abilities = 'wateringcomputer_settings'; + $service_id = $hash->{helper}->{'schedules_paused_until_id'}; + $payload = + '"settings":{"name":"schedules_paused_until"' + . ', "value":"' + . ( $cmd eq 'resumeSchedule' ? '' : $duration ) + . '","device":"' + . $hash->{DEVICEID} . '"}'; + } + elsif ( lc $cmd eq 'on' || lc $cmd eq 'off' || lc $cmd eq 'on-for-timer' ) { + my $val = ( + scalar( !@$aArg == 0 ) && ref($aArg) eq 'ARRAY' + ? $aArg->[0] * 60 + : lc $cmd + ); + + $payload = + '"properties":{"name":"power_timer", "value":"' . $val . '"}'; + } + ### Watering ic24 + elsif ( $cmd =~ m{\AmanualDurationValve\d\z}xms ) { + my $valve_id; + + if ( $cmd =~ m{\AmanualDurationValve(\d)\z}xms ) { + $valve_id = $1; + } + + $payload = + '"properties":{"name":"watering_timer_' + . $valve_id + . '","value":{"state":"manual","duration":' + . $aArg->[0] * 60 + . ',"valve_id":' + . $valve_id . '}}'; + } + elsif ( $cmd eq 'closeAllValves' ) { + $payload = '"name":"close_all_valves","parameters":{}'; + } + elsif ( $cmd =~ /.*ScheduleValve$/ ) { + my $valve_id = $aArg->[0]; + my $duration = ( + ( + defined( $aArg->[1] ) + ? ( + ( + ( Time::Piece->new ) + + ( ONE_HOUR * $aArg->[1] ) - + $timezone_offset + )->datetime + ) + . '.000Z' + : '2038-01-18T00:00:00.000Z' + ) + ); + + $abilities = 'irrigation_settings'; + $service_id = + $hash->{helper}->{ 'schedules_paused_until_' . $valve_id . '_id' }; + $payload = + '"settings":{"name":"schedules_paused_until_' + . $valve_id + . '", "value":"' + . ( $cmd eq 'resumeScheduleValve' ? '' : $duration ) + . '","device":"' + . $hash->{DEVICEID} . '"}'; + } + ### Watering_pressure_pump + elsif ( lc $cmd eq 'operating_mode') { + my $op_mode = $aArg->[0]; + $payload = '"settings":{"name":"operating_mode",' + .'"value":"'.$op_mode.'",' + .'"device":"' + . $hash->{DEVICEID}.'"}'; + $abilities = 'watering_pressure_pump_settings'; + $service_id = $hash->{helper}->{ 'operating_mode_id' }; + } + elsif ( lc $cmd eq 'leakage_detection') { + my $leakdetection_mode = $aArg->[0]; + $payload = '"settings":{"name":"leakage_detection",' + .'"value":"'.$leakdetection_mode.'",' + .'"device":"' + . $hash->{DEVICEID}.'"}'; + $abilities = 'watering_pressure_pump_settings'; + $service_id = $hash->{helper}->{ 'leakage_detection_id' }; + } + elsif ( lc $cmd eq 'turn_on_pressure') { + my $turnonpressure = $aArg->[0]; + $payload = '"settings":{"name":"turn_on_pressure",' + .'"value":"'.$turnonpressure.'",' + .'"device":"' + . $hash->{DEVICEID}.'"}'; + $abilities = 'watering_pressure_pump_settings'; + $service_id = $hash->{helper}->{ 'turn_on_pressure_id' }; + } + elsif ( lc $cmd eq 'resetvalveerrors') { + $payload = '"name":"reset_valve_errors",' + .' "parameters": {}'; + $abilities = 'error'; + } + + ### Sensors + elsif ( lc $cmd eq 'refresh' ) { + + my $sensname = $aArg->[0]; + if ( lc $sensname eq 'temperature' ) { + if ( ReadingsVal( $name, 'device_info-category', 'sensor' ) eq + 'sensor' ) + { + $payload = '"name":"measure_ambient_temperature"'; + $abilities = 'ambient_temperature'; + } + else { + $payload = '"name":"measure_soil_temperature"'; + $abilities = 'soil_temperature'; + } + } + elsif ( lc $sensname eq 'light' ) { + $payload = '"name":"measure_light"'; + $abilities = 'light'; + + } + elsif ( lc $sensname eq 'humidity' ) { + $payload = '"name":"measure_soil_humidity"'; + $abilities = 'humidity'; + } + } + ## winter sleep + elsif ( lc $cmd eq 'winter_mode' ) { + $payload = + '"settings":{"name":"winter_mode","value":"' + . $aArg->[0] + . '","device":"' + . $hash->{DEVICEID} . '"}'; + $abilities = 'winter_settings'; + $service_id = $hash->{helper}->{'winter_mode_id'}; + } + else { + + my $list = ''; + + $list .= +'parkUntilFurtherNotice:noArg parkUntilNextTimer:noArg startResumeSchedule:noArg startOverrideTimer:slider,0,1,240 startpoint' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' ); + + $list .= +'manualOverride:slider,1,1,59 cancelOverride:noArg resumeSchedule:noArg stopSchedule manualButtonTime:slider,0,2,100' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' ); + + + $list .= 'manualOverride:slider,1,1,90 cancelOverride:noArg operating_mode:automatic,scheduled leakage_detection:watering,washing_machine,domestic_water_supply,off turn_on_pressure:slider,2,0.2,3.0,1 resetValveErrors:noArg' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' ); + + $list .= +'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.?/ ); + + # add light for old sensors + $list .= ',light' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'sensor' + && ReadingsVal( $name, 'device_info-category', 'unknown' ) eq + 'sensor' ); + + $list .= 'on:noArg off:noArg on-for-timer:slider,0,1,720' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' ); + + # all devices has abilitie to fall a sleep + $list .= ' winter_mode:awake,hibernate'; + return "Unknown argument $cmd, choose one of $list"; + } + + $hash->{helper}{deviceAction} = $payload; + readingsSingleUpdate( $hash, "state", "send command to gardena cloud", 1 ); + + IOWrite( $hash, $payload, $hash->{DEVICEID}, $abilities, $service_id ); + Log3 $name, 4, +"GardenaSmartBridge ($name) - IOWrite: $payload $hash->{DEVICEID} $abilities IODevHash=$hash->{IODev}"; + + return; +} + +sub Parse { + my $io_hash = shift; + my $json = shift; + + my $name = $io_hash->{NAME}; + + my $decode_json = eval { decode_json($json) }; + if ($@) { + Log3 $name, 3, + "GardenaSmartDevice ($name) - JSON error while request: $@"; + } + + Log3 $name, 4, "GardenaSmartDevice ($name) - ParseFn was called"; + Log3 $name, 4, "GardenaSmartDevice ($name) - JSON: $json"; + + if ( defined( $decode_json->{id} ) ) { + + my $deviceId = $decode_json->{id}; + + if ( my $hash = $modules{GardenaSmartDevice}{defptr}{$deviceId} ) { + my $name = $hash->{NAME}; + + WriteReadings( $hash, $decode_json ); + Log3 $name, 4, + "GardenaSmartDevice ($name) - find logical device: $hash->{NAME}"; + + return $hash->{NAME}; + + } + else { + + Log3 $name, 3, + "GardenaSmartDevice ($name) - autocreate new device " + . makeDeviceName( $decode_json->{name} ) + . " with deviceId $decode_json->{id}, model $decode_json->{category}"; + return + "UNDEFINED " + . makeDeviceName( $decode_json->{name} ) + . " GardenaSmartDevice $decode_json->{id} $decode_json->{category}"; + } + } + + return; +} + +sub WriteReadings { + my $hash = shift; + my $decode_json = shift; + + 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); + + do { + + if ( + ref( $decode_json->{abilities}[$abilities]{properties} ) eq "ARRAY" + && scalar( @{ $decode_json->{abilities}[$abilities]{properties} } ) + > 0 ) + { + for my $propertie ( + @{ $decode_json->{abilities}[$abilities]{properties} } ) + { + if ( + exists( $decode_json->{abilities}[$abilities]{name} ) + && ( $decode_json->{abilities}[$abilities]{name} eq + 'watering' ) + ) + { + + if ( $propertie->{name} eq 'button_config_time' ) { + if ( $hash->{helper}{ $propertie->{name} . '_id' } ne + $decode_json->{abilities}[$abilities]{id} ) + { + $hash->{helper}{ $propertie->{name} . '_id' } = + $decode_json->{abilities}[$abilities]{id}; + } + readingsBulkUpdateIfChanged( + $hash, + 'manualButtonTime', + ( + RigReadingsValue( + $hash, $propertie->{value} / 60 + ) + ) + ); + next; + } + } + + readingsBulkUpdateIfChanged( + $hash, + $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name}, + ($propertie->{value} eq '') ? RigReadingsValue( $hash, 'n/a') : RigReadingsValue( $hash, $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} . '-' + . $propertie->{name} ne 'battery-level' + && $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} ne 'internal_temperature-temperature' + && $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} ne 'ambient_temperature-temperature' + && $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} ne 'soil_temperature-temperature' + && $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} ne 'humidity-humidity' + && $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} ne 'light-light' + && ref( $propertie->{value} ) ne "HASH" ); + + readingsBulkUpdateIfChanged( + $hash, + $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name}, + RigReadingsValue( $hash, $propertie->{value} ) + ) + if ( + defined( $propertie->{value} ) + && ( $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} eq 'radio-quality' + || $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} eq 'battery-level' + || $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} eq + 'internal_temperature-temperature' + || $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} eq + 'ambient_temperature-temperature' + || $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} eq 'soil_temperature-temperature' + || $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} eq 'humidity-humidity' + || $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} eq 'light-light' ) + ); + + readingsBulkUpdateIfChanged( + $hash, + $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} + . '_timestamp', + Time::Piece->strptime( + RigReadingsValue( $hash, $propertie->{timestamp} ), + "%Y-%m-%d %H:%M:%S" )->strftime('%s') + + ) + if ( + defined( $propertie->{value} ) + && ( $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} eq 'mower_timer-mower_timer' ) + ); + + readingsBulkUpdateIfChanged( + $hash, + $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name}, + join( ',', @{ $propertie->{value} } ) + ) + if ( defined( $propertie->{value} ) + && $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} eq 'ic24-valves_connected' ); + + readingsBulkUpdateIfChanged( + $hash, + $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name}, + join( ',', @{ $propertie->{value} } ) + ) + if ( defined( $propertie->{value} ) + && $decode_json->{abilities}[$abilities]{name} . '-' + . $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} } ) { + if ( ref( $v ) ne "HASH" ) { + readingsBulkUpdate( + $hash, + $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} . '_' + . $r, + RigReadingsValue( $hash, $v ) + ); + } else { + while ( my ( $i_r, $i_v ) = each %{ $v } ) { + readingsBulkUpdate( + $hash, + $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} . '_' + . $r . '_' . $i_r, + RigReadingsValue( $hash, $i_v ) + ); + } + } + } + } + # ic24 and other watering devices calc irrigation left in sec + readingsBulkUpdateIfChanged( + $hash, + $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} + . '_irrigation_left', + ( $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) : 0 + ) + if ( defined( $propertie->{value} ) + && $decode_json->{abilities}[$abilities]{name} eq 'watering' + ); + } + } + + $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; 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 + $event_id++; # event id + + while ( my ( $r, $v ) = each %{ $event_schedules } ) { + readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_' + . $event_id + . '_valve_' + . $valve_id + . '_' + . $r, + $v) if (ref($v) ne 'HASH' ); + readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_' + . $event_id + . '_valve_' + . $valve_id + . '_' + . $v->{type}, + join(',', @ { $v->{weekdays}}) ) if (ref($v) eq 'HASH' ); + }; + }; + + }; # fi scheduled_events + + my $winter_mode; + + do { +#Log3 $name, 1, "Settings pro Device : ".$decode_json->{settings}[$settings]{name}; +#Log3 $name, 1, " - KEIN ARRAY" if ( ref( $decode_json->{settings}[$settings]{value} ) ne "ARRAY"); +#Log3 $name, 1, " - IST ARRAY" if ( ref( $decode_json->{settings}[$settings]{value} ) eq "ARRAY"); + + if ( + exists( $decode_json->{settings}[$settings]{name} ) + && ( $decode_json->{settings}[$settings]{name} =~ + /schedules_paused_until_?\d?$/ + || $decode_json->{settings}[$settings]{name} eq 'eco_mode' + || $decode_json->{settings}[$settings]{name} eq 'winter_mode' + || $decode_json->{settings}[$settings]{name} eq 'operating_mode' + || $decode_json->{settings}[$settings]{name} eq 'leakage_detection' + || $decode_json->{settings}[$settings]{name} eq 'turn_on_pressure' ) + ) + { + if ( $hash->{helper} + { $decode_json->{settings}[$settings]{name} . '_id' } ne + $decode_json->{settings}[$settings]{id} ) + { + $hash->{helper} + { $decode_json->{settings}[$settings]{name} . '_id' } = + $decode_json->{settings}[$settings]{id}; + } + # check watering controler single schedules pause until + if ( $decode_json->{settings}[$settings]{name} eq 'schedules_paused_until' ) { + 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 + # check if empty, clear scheduling-scheduled_watering_next_start_x + readingsBulkUpdateIfChanged( $hash, 'scheduling-'.$decode_json->{settings}[$settings]{name}, + $decode_json->{settings}[$settings]{value} ); + # CommandAttr( undef, $name . " scheduling-scheduled_watering_next_start_") if ($decode_json->{settings}[$settings]{value} eq '' ) + } + + # save electronid pressure pump settings as readings + if ( $decode_json->{settings}[$settings]{name} eq 'operating_mode' + || $decode_json->{settings}[$settings]{name} eq 'leakage_detection' + || $decode_json->{settings}[$settings]{name} eq 'turn_on_pressure' ) { + readingsBulkUpdateIfChanged( $hash, $decode_json->{settings}[$settings]{name}, + $decode_json->{settings}[$settings]{value} ); + + } + # save winter mode as reading + if ( $decode_json->{settings}[$settings]{name} eq 'winter_mode' ) { + readingsBulkUpdateIfChanged( $hash, 'winter_mode', + $decode_json->{settings}[$settings]{value} ); + + $winter_mode = $decode_json->{settings}[$settings]{value}; + } + } + + if ( defined( $decode_json->{settings}[$settings]{name} ) + && $decode_json->{settings}[$settings]{name} eq 'valve_names' + && 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'}"; + 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' ) + { + #save the startingpointid needed to update the startingpoints + if ( $hash->{helper}{STARTINGPOINTID} ne + $decode_json->{settings}[$settings]{id} ) + { + $hash->{helper}{STARTINGPOINTID} = + $decode_json->{settings}[$settings]{id}; + } + + $hash->{helper}{STARTINGPOINTS} = + '{ "name": "starting_points", "value": ' + . encode_json( $decode_json->{settings}[$settings]{value} ) . '}'; + my $startpoint_cnt = 0; + + for my $startingpoint ( + @{ $decode_json->{settings}[$settings]{value} } ) + { + $startpoint_cnt++; + readingsBulkUpdateIfChanged( + $hash, + 'startpoint-' . $startpoint_cnt . '-enabled', + $startingpoint->{enabled} + ); + } + } + + $settings--; + } while ( $settings >= 0 ); + + if ( $winter_mode ne 'hibernate' ) { + setState($hash); + } + else { + readingsBulkUpdate( $hash, 'state', + RigReadingsValue( $hash, 'hibernate' ) ); + } + + readingsEndUpdate( $hash, 1 ); + + Log3 $name, 4, "GardenaSmartDevice ($name) - readings was written"; + + return; +} + +sub setState { + my $hash = shift; + my $name = $hash->{NAME}; + + my $online_state = + ReadingsVal( $name, 'device_info-connection_status', 'unknown' ); + + #online state mower + readingsBulkUpdate( $hash, 'state', + $online_state eq 'online' + ? ReadingsVal( $name, 'mower-status', 'readingsValError' ) + : 'offline' ) + if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' ); + + # ic24 / wc / electronic pump + + if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' + || AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' + || 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 = ''; + my $error_type = 'ok'; + 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 ); + ## set error type (pumpe required) + $error_type = ReadingsVal( $name, 'error-valve_error_'.$_.'_type', 'ok' ) if (ReadingsVal( $name, 'error-valve_error_'.$_.'_type', 'ok' ) ne 'ok'); + ## 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 ) ); + + # 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, 5, "[DEBUG] - process: $processed_item"; + Log3 $name, 5, "[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, 5, "[DEBUG] - next_start: empty "; + Log3 $name, 5, "[DEBUG] - empty pro item ".Time::Piece->strptime( $processed_item, "%Y-%m-%d %H:%M:%S"); + Log3 $name, 5, "[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:%S") + < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M:%S") + && $has_schedule + && Time::Piece->strptime( $processed_item, "%Y-%m-%d %H:%M:%S") + > Time::Piece->new + ) + } else { + $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); + } + Log3 $name, 5, "[DEBUG] - choosed nearst: $nearst_irrigation"; + + } # for + # override state 4 extendedstates + if ( AttrVal( $name, "extendedState", 0 ) == 1) { + 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)); + } # /for + } else { + $state_string .= RigReadingsValue($hash, 'closed'); + } + $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 + { + + } + ' ) + if ( AttrVal( $name, 'stateFormat', 'none' ) eq 'none' ); + } else { + Log3 $name, 5, "[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_schedule + && $nearst_irrigation ne '2999-12-12 12:00') + # zeitplan aktiv + # ? ( $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 + : (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') + ; + # state offline | override + $state_string = 'offline' if ($online_state eq 'offline'); + $state_string = ( $error_type ne 'ok' ) ? $error_type : $state_string; + + } + readingsBulkUpdate( + $hash, 'state', RigReadingsValue( $hash, $state_string ) ); + } + + # Sensor / Sensor 2 + if ( AttrVal( $name, 'model', 'unknown' ) =~ /sensor.?/ ) { + my $state_string = + ( ReadingsVal( $name, 'device_info-category', 'unknown' ) eq + 'sensor' ) + ? 'T: ' + . ReadingsVal( $name, 'ambient_temperature-temperature', + 'readingsValError' ) + . '°C, ' + : 'T: ' + . ReadingsVal( $name, 'soil_temperature-temperature', + 'readingsValError' ) + . '°C, '; + $state_string .= 'H: ' + . ReadingsVal( $name, 'humidity-humidity', 'readingsValError' ) . '%'; + $state_string .= ', L: ' + . ReadingsVal( $name, 'light-light', 'readingsValError' ) . 'lux' + if ( ReadingsVal( $name, 'device_info-category', 'unknown' ) eq + 'sensor' ); + +# if ( $online_state eq 'offline') { +# readingsBulkUpdate( $hash, 'humidity-humidity', '-1' ); +# readingsBulkUpdate( $hash, 'ambient_temperature-temperature', '-1' ) if (ReadingsVal($name, 'device_info-category', 'unknown') eq 'sensor'); +# readingsBulkUpdate( $hash, 'light-light', '-1' ) if (ReadingsVal($name, 'device_info-category', 'unknown') eq 'sensor'); +# } + #online state sensor I II + readingsBulkUpdate( $hash, 'state', + $online_state eq 'online' ? RigReadingsValue( $hash, $state_string) : RigReadingsValue( $hash, 'offline') ); + } + + readingsBulkUpdate( $hash, 'state', + ReadingsVal( $name, 'power-power_timer', 'no info from power-timer' ) ) + if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' ); + + return; +} + +################################## +################################## +#### my little helpers ########### + +sub ReadingLangGerman { + my $hash = shift; + my $readingValue = shift; + + my $name = $hash->{NAME}; + my %langGermanMapp = ( + 'ok_cutting' => 'mähen', + 'paused' => 'pausiert', + 'ok_searching' => 'suche Ladestation', + 'ok_charging' => 'lädt', + 'ok_leaving' => 'unterwegs zum Startpunkt', + 'wait_updating' => 'wird aktualisiert ...', + 'wait_power_up' => 'wird eingeschaltet ...', + 'parked_timer' => 'geparkt nach Zeitplan', + 'parked_park_selected' => 'geparkt', + 'off_disabled' => 'der Mäher ist ausgeschaltet', + 'off_hatch_open' => 'deaktiviert. Abdeckung ist offen oder PIN-Code erforderlich', + 'unknown' => 'unbekannter Status', + 'error' => 'Fehler', + 'error_at_power_up' => 'Neustart ...', + 'off_hatch_closed' => 'Deaktiviert. Manueller Start erforderlich', + 'ok_cutting_timer_overridden' => 'manuelles mähen', + 'parked_autotimer' => 'geparkt durch SensorControl', + 'parked_daily_limit_reached' => 'abgeschlossen', + 'no_message' => 'kein Fehler', + 'outside_working_area' => 'außerhalb des Arbeitsbereichs', + 'no_loop_signal' => 'kein Schleifensignal', + 'wrong_loop_signal' => 'falsches Schleifensignal', + 'loop_sensor_problem_front' => 'Problem Schleifensensor, vorne', + 'loop_sensor_problem_rear' => 'Problem Schleifensensor, hinten', + 'trapped' => 'eingeschlossen', + 'upside_down' => 'steht auf dem Kopf', + 'low_battery' => 'niedriger Batteriestand', + 'empty_battery' => 'Batterie leer', + 'no_drive' => 'fährt nicht', + 'lifted' => 'angehoben', + 'stuck_in_charging_station' => 'eingeklemmt in Ladestation', + 'charging_station_blocked' => 'Ladestation blockiert', + 'collision_sensor_problem_rear' => 'Problem Stoßsensor hinten', + 'collision_sensor_problem_front' => 'Problem Stoßsensor vorne', + 'wheel_motor_blocked_right' => 'Radmotor rechts blockiert', + 'wheel_motor_blocked_left' => 'Radmotor links blockiert', + 'wheel_drive_problem_right' => 'Problem Antrieb, rechts', + 'wheel_drive_problem_left' => 'Problem Antrieb, links', + 'cutting_system_blocked' => 'Schneidsystem blockiert', + 'invalid_sub_device_combination' => 'fehlerhafte Verbindung', + 'settings_restored' => 'Standardeinstellungen', + 'electronic_problem' => 'elektronisches Problem', + 'charging_system_problem' => 'Problem Ladesystem', + 'tilt_sensor_problem' => 'Kippsensor Problem', + 'wheel_motor_overloaded_right' => 'rechter Radmotor überlastet', + 'wheel_motor_overloaded_left' => 'linker Radmotor überlastet', + 'charging_current_too_high' => 'Ladestrom zu hoch', + 'temporary_problem' => 'vorübergehendes Problem', + 'guide_1_not_found' => 'SK 1 nicht gefunden', + 'guide_2_not_found' => 'SK 2 nicht gefunden', + 'guide_3_not_found' => 'SK 3 nicht gefunden', + 'difficult_finding_home' => 'Problem die Ladestation zu finden', + 'guide_calibration_accomplished' => 'Kalibrierung des Suchkabels beendet', + 'guide_calibration_failed' => 'Kalibrierung des Suchkabels fehlgeschlagen', + 'temporary_battery_problem' => 'kurzzeitiges Batterieproblem', + 'battery_problem' => 'Batterieproblem', + 'alarm_mower_switched_off' => 'Alarm! Mäher ausgeschalten', + 'alarm_mower_stopped' => 'Alarm! Mäher gestoppt', + 'alarm_mower_lifted' => 'Alarm! Mäher angehoben', + 'alarm_mower_tilted' => 'Alarm! Mäher gekippt', + 'connection_changed' => 'Verbindung geändert', + 'connection_not_changed' => 'Verbindung nicht geändert', + 'com_board_not_available' => 'COM Board nicht verfügbar', + 'slipped' => 'rutscht', + 'out_of_operation' => 'ausser Betrieb', + 'replace_now' => 'kritischer Batteriestand, wechseln Sie jetzt', + 'low' => 'niedrig', + 'ok' => 'ok', + 'no_source' => 'ok', + 'mower_charging' => 'Mäher wurde geladen', + 'completed_cutting_autotimer' => 'Sensor Control erreicht', + 'week_timer' => 'Wochentimer erreicht', + 'countdown_timer' => 'Stoppuhr Timer', + 'undefined' => 'unklar', + 'unknown' => 'unklar', + 'status_device_unreachable' => 'Gerät ist nicht in Reichweite', + 'status_device_alive' => 'Gerät ist in Reichweite', + 'bad' => 'schlecht', + 'poor' => 'schwach', + 'good' => 'gut', + 'undefined' => 'unklar', + 'idle' => 'nichts zu tun', + 'firmware_cancel' => 'Firmwareupload unterbrochen', + 'firmware_upload' => 'Firmwareupload', + 'unsupported' => 'nicht unterstützt', + 'up_to_date' => 'auf dem neusten Stand', + 'mower' => 'Mäher', + 'watering_computer' => 'Bewässerungscomputer', + 'no_frost' => 'kein Frost', + 'open' => 'offen', + 'closed' => 'geschlossen', + 'included' => 'inbegriffen', + 'active' => 'aktiv', + 'inactive' => 'nicht aktiv', + 'hibernate' => 'Winterschlaf', + 'awake' => 'Aufgewacht', + 'schedule permanently paused' => 'Zeitplan dauerhaft pausiert', + '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', + 'pump_not_filled' => 'Pumpe nicht gefüllt', + ); + + if ( + defined( $langGermanMapp{$readingValue} ) + && ( AttrVal( 'global', 'language', 'none' ) eq 'DE' + || AttrVal( $name, 'readingValueLanguage', 'none' ) eq 'de' ) + && AttrVal( $name, 'readingValueLanguage', 'none' ) ne 'en' + ) + { + return $langGermanMapp{$readingValue}; + } + else { + return $readingValue; + } + + return; +} + +sub RigReadingsValue { + my $hash = shift; + my $readingValue = shift; + + my $rigReadingValue; + + if ( $readingValue =~ /^(\d+)-(\d\d)-(\d\d)T(\d\d)/ ) { + $rigReadingValue = Zulu2LocalString($readingValue); + } + else { + $rigReadingValue = ReadingLangGerman( $hash, $readingValue ); + } + + return $rigReadingValue; +} + +sub Zulu2LocalString { + my $t = shift; + + my ( $datehour, $datemin, $rest ) = split( /:/, $t, 3 ); + + my ( $year, $month, $day, $hour, $min ) = + $datehour =~ /(\d+)-(\d\d)-(\d\d)T(\d\d)/; + my $epoch = timegm( 0, 0, $hour, $day, $month - 1, $year ); + + my ( $lyear, $lmonth, $lday, $lhour, $isdst ) = + ( localtime($epoch) )[ 5, 4, 3, 2, -1 ]; + + $lyear += 1900; # year is 1900 based + $lmonth++; # month number is zero based + + if ( defined($rest) ) { + return ( + sprintf( + "%04d-%02d-%02d %02d:%02d:%s", + $lyear, $lmonth, $lday, + $lhour, $datemin, substr( $rest, 0, 2 ) + ) + ); + } + elsif ( $lyear < 2000 ) { + return 'temporarily unavailable'; + } + else { + return ( + sprintf( + "%04d-%02d-%02d %02d:%02d", + $lyear, $lmonth, $lday, $lhour, substr( $datemin, 0, 2 ) + ) + ); + } + + return; +} + +sub SetPredefinedStartPoints { + my $hash = shift; + my $aArg = shift; + + my ( $startpoint_state, $startpoint_num, @morestartpoints ) = @{$aArg}; + + my $name = $hash->{NAME}; + my $payload; + my $abilities; + + if ( defined($startpoint_state) && defined($startpoint_num) ) { + if ( defined( $hash->{helper}{STARTINGPOINTS} ) + && $hash->{helper}{STARTINGPOINTS} ne '' ) + { +# add needed parameters to saved settings config and change the value in request + my $decode_json_settings = + eval { decode_json( $hash->{helper}{STARTINGPOINTS} ) }; + if ($@) { + Log3 $name, 3, +"GardenaSmartBridge ($name) - JSON error while setting startpoint: $@"; + } + + $decode_json_settings->{device} = $hash->{DEVICEID}; + my $setval = $startpoint_state eq 'disable' ? \0 : \1; + $decode_json_settings->{value}[ $startpoint_num - 1 ]{enabled} = + $setval; + + #set more startpoints + if ( + defined scalar(@morestartpoints) + && ( scalar(@morestartpoints) == 2 + || scalar(@morestartpoints) == 4 ) + ) + { + if ( scalar(@morestartpoints) == 2 ) { + $setval = $morestartpoints[0] eq 'disable' ? \0 : \1; + $decode_json_settings->{value}[ $morestartpoints[1] - 1 ] + {enabled} = $setval; + + } + elsif ( scalar(@morestartpoints) == 4 ) { + $setval = $morestartpoints[0] eq 'disable' ? \0 : \1; + $decode_json_settings->{value}[ $morestartpoints[1] - 1 ] + {enabled} = $setval; + $setval = $morestartpoints[2] eq 'disable' ? \0 : \1; + $decode_json_settings->{value}[ $morestartpoints[3] - 1 ] + {enabled} = $setval; + } + } + + $payload = '"settings": ' . encode_json($decode_json_settings); + $abilities = 'mower_settings'; + + #$abilities['service_id'] = $hash->{helper}{STARTINGPOINTID}; + } + else { + return + "startingpoints not loaded yet, please wait a couple of minutes", + undef, undef; + } + } + else { + return + "startpoint usage: set " + . $hash->{NAME} + . " startpoint disable 1 [enable 2] [disable 3]", undef, undef; + } + + return undef, $payload, $abilities; +} + +1; + +=pod + +=item device +=item summary Modul to control GardenaSmart Devices +=item summary_DE Modul zur Steuerung von GardenaSmartgeräten + +=begin html + + +

GardenaSmartDevice

+
    + In combination with GardenaSmartBridge this FHEM Module controls the GardenaSmart Device using the GardenaCloud +

    + Once the Bridge device is created, the connected devices are automatically recognized and created in FHEM.
    + From now on the devices can be controlled and changes in the GardenaAPP are synchronized with the state and readings of the devices. + +


    + Readings +
      +
    • battery-charging - Indicator if the Battery is charged (0/1) or with newer Firmware (false/true)
    • +
    • battery-level - load percentage of the Battery
    • +
    • battery-rechargeable_battery_status - healthyness of the battery (out_of_operation/replace_now/low/ok)
    • +
    • device_info-category - category of device (mower/watering_computer)
    • +
    • device_info-last_time_online - timestamp of last radio contact
    • +
    • device_info-manufacturer - manufacturer
    • +
    • device_info-product - product type
    • +
    • device_info-serial_number - serial number
    • +
    • device_info-sgtin -
    • +
    • device_info-version - firmware version
    • +
    • firmware-firmware_command - firmware command (idle/firmware_cancel/firmware_upload/unsupported)
    • +
    • firmware-firmware_status - firmware status
    • +
    • firmware-firmware_update_start - indicator when a firmwareupload is started
    • +
    • firmware-firmware_upload_progress - progress indicator of firmware update
    • +
    • firmware-inclusion_status - inclusion status
    • +
    • internal_temperature-temperature - internal device temperature
    • +
    • mower-error - actual error message +
        +
      • no_message
      • +
      • outside_working_area
      • +
      • no_loop_signal
      • +
      • wrong_loop_signal
      • +
      • loop_sensor_problem_front
      • +
      • loop_sensor_problem_rear
      • +
      • trapped
      • +
      • upside_down
      • +
      • low_battery
      • +
      • empty_battery
      • +
      • no_drive
      • +
      • lifted
      • +
      • stuck_in_charging_station
      • +
      • charging_station_blocked
      • +
      • collision_sensor_problem_rear
      • +
      • collision_sensor_problem_front
      • +
      • wheel_motor_blocked_right
      • +
      • wheel_motor_blocked_left
      • +
      • wheel_drive_problem_right
      • +
      • wheel_drive_problem_left
      • +
      • cutting_system_blocked
      • +
      • invalid_sub_device_combination
      • +
      • settings_restored
      • +
      • electronic_problem
      • +
      • charging_system_problem
      • +
      • tilt_sensor_problem
      • +
      • wheel_motor_overloaded_right
      • +
      • wheel_motor_overloaded_left
      • +
      • charging_current_too_high
      • +
      • temporary_problem
      • +
      • guide_1_not_found
      • +
      • guide_2_not_found
      • +
      • guide_3_not_found
      • +
      • difficult_finding_home
      • +
      • guide_calibration_accomplished
      • +
      • guide_calibration_failed
      • +
      • temporary_battery_problem
      • +
      • battery_problem
      • +
      • alarm_mower_switched_off
      • +
      • alarm_mower_stopped
      • +
      • alarm_mower_lifted
      • +
      • alarm_mower_tilted
      • +
      • connection_changed
      • +
      • connection_not_changed
      • +
      • com_board_not_available
      • +
      • slipped
      • +
      +
    • +
    • mower-manual_operation - (0/1) or with newer Firmware (false/true)
    • +
    • mower-override_end_time - manual override end time
    • +
    • mower-source_for_next_start - source for the next start +
        +
      • no_source
      • +
      • mower_charging
      • +
      • completed_cutting_autotimer
      • +
      • week_timer
      • +
      • countdown_timer
      • +
      • undefined
      • +
      +
    • +
    • mower-status - mower state (see state)
    • +
    • mower-timestamp_next_start - timestamp of next scheduled start
    • +
    • radio-connection_status - state of connection
    • +
    • radio-quality - percentage of the radio quality
    • +
    • radio-state - radio state (bad/poor/good/undefined)
    • +
    • state - state of the mower +
        +
      • paused
      • +
      • ok_cutting
      • +
      • ok_searching
      • +
      • ok_charging
      • +
      • ok_leaving
      • +
      • wait_updating
      • +
      • wait_power_up
      • +
      • parked_timer
      • +
      • parked_park_selected
      • +
      • off_disabled
      • +
      • off_hatch_open
      • +
      • unknown
      • +
      • error
      • +
      • error_at_power_up
      • +
      • off_hatch_closed
      • +
      • ok_cutting_timer_overridden
      • +
      • parked_autotimer
      • +
      • parked_daily_limit_reached
      • +
      +
    • +
    +

    + + Attributes +
      +
    • readingValueLanguage - Change the Language of Readings (de,en/if not set the default is english and the global language is not set at german)
    • +
    • model -
    • +
    +

    + + set +
      +
    • winter_mode - awake | hibernate
    • +
    +
      +

      mower

      +
    • parkUntilFurtherNotice
    • +
    • parkUntilNextTimer
    • +
    • startOverrideTimer - (in minutes, 60 = 1h, 1440 = 24h, 4320 = 72h)
    • +
    • startResumeSchedule
    • +
    • startpoint enable|disable 1|2|3 - enables or disables one or more predefined start points
    • +
        +
      • set NAME startpoint enable 1
      • +
      • set NAME startpoint disable 3 enable 1
      • +
      +

      irrigation control

      +
    • resumeScheduleValve - start schedule irrigation on valve n
    • +
    • stopScheduleValve - stop schedule irrigation on valve n (Default: 2038-01-18T00:00:00.000Z) | optional params hours (now + hours)
    • +
    • closeAllValves - close all valves
    • +

      water control

      +
    • manualButtonTime - set manual time for button press (in minutes) 0 disable button
    • +
    • stopSchedule - stop schedule for now + n hours (Default: 2038-01-18T00:00:00.000Z)
    • +
    • resumeSchedule - resume schedule
    • +
    +
+ +=end html +=begin html_DE + + +

GardenaSmartDevice

+
    + Zusammen mit dem Device GardenaSmartDevice stellt dieses FHEM Modul die Kommunikation zwischen der GardenaCloud und Fhem her. +

    + Wenn das GardenaSmartBridge Device erzeugt wurde, werden verbundene Geräte automatisch erkannt und in Fhem angelegt.
    + Von nun an können die eingebundenen Geräte gesteuert werden. Änderungen in der APP werden mit den Readings und dem Status syncronisiert. + +
+
+
    + Readings +
      +
    • battery-charging - Ladeindikator (0/1) oder mit neuerer Firmware (false/true)
    • +
    • battery-level - Ladezustand der Batterie in Prozent
    • +
    • battery-rechargeable_battery_status - Zustand der Batterie (Ausser Betrieb/Kritischer Batteriestand, wechseln Sie jetzt/Niedrig/oK)
    • +
    • device_info-category - Eigenschaft des Gerätes (Mäher/Bewässerungscomputer/Bodensensor)
    • +
    • device_info-last_time_online - Zeitpunkt der letzten Funkübertragung
    • +
    • device_info-manufacturer - Hersteller
    • +
    • device_info-product - Produkttyp
    • +
    • device_info-serial_number - Seriennummer
    • +
    • device_info-sgtin -
    • +
    • device_info-version - Firmware Version
    • +
    • firmware-firmware_command - Firmware Kommando (Nichts zu tun/Firmwareupload unterbrochen/Firmwareupload/nicht unterstützt)
    • +
    • firmware-firmware_status - Firmware Status
    • +
    • firmware-firmware_update_start - Firmwareupdate (0/1) oder mit neuerer Firmware (false/true)
    • +
    • firmware-firmware_upload_progress - Firmwareupdatestatus in Prozent
    • +
    • firmware-inclusion_status - Einbindungsstatus
    • +
    • internal_temperature-temperature - Interne Geräte Temperatur
    • +
    • mower-error - Aktuelle Fehler Meldung +
        +
      • Kein Fehler
      • +
      • Außerhalb des Arbeitsbereichs
      • +
      • Kein Schleifensignal
      • +
      • Falsches Schleifensignal
      • +
      • Problem Schleifensensor, vorne
      • +
      • Problem Schleifensensor, hinten
      • +
      • Eingeschlossen
      • +
      • Steht auf dem Kopf
      • +
      • Niedriger Batteriestand
      • +
      • Batterie ist leer
      • +
      • Kein Antrieb
      • +
      • Angehoben
      • +
      • Eingeklemmt in Ladestation
      • +
      • Ladestation blockiert
      • +
      • Problem Stoßsensor hinten
      • +
      • Problem Stoßsensor vorne
      • +
      • Radmotor rechts blockiert
      • +
      • Radmotor links blockiert
      • +
      • Problem Antrieb, rechts
      • +
      • Problem Antrieb, links
      • +
      • Schneidsystem blockiert
      • +
      • Fehlerhafte Verbindung
      • +
      • Standardeinstellungen
      • +
      • Elektronisches Problem
      • +
      • Problem Ladesystem
      • +
      • Kippsensorproblem
      • +
      • Rechter Radmotor überlastet
      • +
      • Linker Radmotor überlastet
      • +
      • Ladestrom zu hoch
      • +
      • Vorübergehendes Problem
      • +
      • SK 1 nicht gefunden
      • +
      • SK 2 nicht gefunden
      • +
      • SK 3 nicht gefunden
      • +
      • Problem die Ladestation zu finden
      • +
      • Kalibration des Suchkabels beendet
      • +
      • Kalibration des Suchkabels fehlgeschlagen
      • +
      • Kurzzeitiges Batterieproblem
      • +
      • Batterieproblem
      • +
      • Alarm! Mäher ausgeschalten
      • +
      • Alarm! Mäher gestoppt
      • +
      • Alarm! Mäher angehoben
      • +
      • Alarm! Mäher gekippt
      • +
      • Verbindung geändert
      • +
      • Verbindung nicht geändert
      • +
      • COM board nicht verfügbar
      • +
      • Rutscht
      • +
      +
    • +
    • mower-manual_operation - Manueller Betrieb (0/1) oder mit neuerer Firmware (false/true)
    • +
    • mower-override_end_time - Zeitpunkt wann der manuelle Betrieb beendet ist
    • +
    • mower-source_for_next_start - Grund für den nächsten Start +
        +
      • Kein Grund
      • +
      • Mäher wurde geladen
      • +
      • SensorControl erreicht
      • +
      • Wochentimer erreicht
      • +
      • Stoppuhr Timer
      • +
      • Undefiniert
      • +
      +
    • +
    • mower-status - Mäher Status (siehe state)
    • +
    • mower-timestamp_next_start - Zeitpunkt des nächsten geplanten Starts
    • +
    • radio-connection_status - Status der Funkverbindung
    • +
    • radio-quality - Indikator für die Funkverbindung in Prozent
    • +
    • radio-state - radio state (schlecht/schwach/gut/Undefiniert)
    • +
    • state - Staus des Mähers +
        +
      • Pausiert
      • +
      • Mähen
      • +
      • Suche Ladestation
      • +
      • Lädt
      • +
      • Mähen
      • +
      • Wird aktualisiert ...
      • +
      • Wird eingeschaltet ...
      • +
      • Geparkt nach Zeitplan
      • +
      • Geparkt
      • +
      • Der Mäher ist ausgeschaltet
      • +
      • Deaktiviert. Abdeckung ist offen oder PIN-Code erforderlich
      • +
      • Unbekannter Status
      • +
      • Fehler
      • +
      • Neustart ...
      • +
      • Deaktiviert. Manueller Start erforderlich
      • +
      • Manuelles Mähen
      • +
      • Geparkt durch SensorControl
      • +
      • Abgeschlossen
      • +
      +
    • +
    +

    + + Attribute +
      +
    • readingValueLanguage - Änderung der Sprache der Readings (de,en/wenn nichts gesetzt ist, dann Englisch es sei denn deutsch ist als globale Sprache gesetzt)
    • +
    • model -
    • +
    + + set +
      +
    • winter_mode - aufwäcken (awake)| winterschlaf (hibernate)
    • +
    +
      +

      mäher

      +
    • parkUntilFurtherNotice - Parken des Mähers unter Umgehung des Zeitplans
    • +
    • parkUntilNextTimer - Parken bis zum nächsten Zeitplan
    • +
    • startOverrideTimer - Manuelles mähen (in Minuten, 60 = 1h, 1440 = 24h, 4320 = 72h)
    • +
    • startResumeSchedule - Weiterführung des Zeitplans
    • +
    • startpoint enable|disable 1|2|3 - Aktiviert oder deaktiviert einen vordefinierten Startbereich
    • +
        +
      • set NAME startpoint enable 1
      • +
      • set NAME startpoint disable 3 enable 1
      • +
      +

      irrigation control

      +
    • resumeScheduleValve - Startet Bew&aauml;sserung am Ventil n nach Zeitplan
    • +
    • stopScheduleValve - Setzt Bew&aauml;sserung am Ventil n aus (Default: 2038-01-18T00:00:00.000Z) | Optionaler Parameter Stunden (Jetzt + Stunden)
    • +
    • closeAllValves - Stopt Bew&aauml;sserung an allen Ventilen
    • +

      water control

      +
    • manualButtonTime - setzt die Dauer für den manuellen Knopf (in Minuten) 0 Schaltet den Knopf aus
    • +
    • stopSchedule - Halte Zeitplan an für x Stunden - (Default: 2038-01-18T00:00:00.000Z)
    • +
    • resumeSchedule - Weiterführung des Zeitplans
    • +
    +
+ +=end html_DE + +=for :application/json;q=META.json 74_GardenaSmartDevice.pm +{ + "abstract": "Modul to control GardenaSmart Devices", + "x_lang": { + "de": { + "abstract": "Modul zur Steuerung von Gardena Smart Geräten" + } + }, + "keywords": [ + "fhem-mod-device", + "fhem-core", + "Garden", + "Gardena", + "Smart" + ], + "release_status": "stable", + "license": "GPL_2", + "version": "v2.5.5", + "author": [ + "Marko Oldenburg " + ], + "x_fhem_maintainer": [ + "CoolTux" + ], + "x_fhem_maintainer_github": [ + "LeonGaultier" + ], + "prereqs": { + "runtime": { + "requires": { + "FHEM": 5.00918799, + "perl": 5.016, + "Meta": 0, + "JSON": 0, + "Time::Local": 0 + }, + "recommends": { + }, + "suggests": { + } + } + } +} +=end :application/json;q=META.json + +=cut diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index af773db..280e02b 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-12_20:03:00 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-19_20:20:03 71804 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-20_12:15:45 73554 FHEM/74_GardenaSmartDevice.pm From 33a10d3756c9642662c8ced5f05c807ff3935364 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 22 Jul 2022 21:08:02 +0200 Subject: [PATCH 093/126] [fix] - exists gegen defined --- 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 af74819..649a414 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - cleanup code, fix start up defined string + cleanup diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 363f97d..1790f6a 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -709,7 +709,7 @@ sub WriteReadings { . $propertie->{name}, ($propertie->{value} eq '') ? RigReadingsValue( $hash, 'n/a') : RigReadingsValue( $hash, $propertie->{value} ) ) - if ( exists( $propertie->{value} ) # defined ignored 'value':null + if ( defined( $propertie->{value} ) && $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name} ne 'radio-quality' && $decode_json->{abilities}[$abilities]{name} . '-' @@ -904,7 +904,7 @@ sub WriteReadings { $decode_json->{settings}[$settings]{value} ); # CommandAttr( undef, $name . " scheduling-scheduled_watering_next_start_") if ($decode_json->{settings}[$settings]{value} eq '' ) } - +#TODO: Readings und Setter ?! # save electronid pressure pump settings as readings if ( $decode_json->{settings}[$settings]{name} eq 'operating_mode' || $decode_json->{settings}[$settings]{name} eq 'leakage_detection' diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 280e02b..d496860 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2022-07-12_20:03:00 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-20_12:15:45 73554 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm +UPD 2022-07-22_21:07:48 73554 FHEM/74_GardenaSmartDevice.pm From f3d153726b5cdc966d2f6935c0c2eb5bf1decf87 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 24 Jul 2022 20:25:21 +0200 Subject: [PATCH 094/126] [fix] - uninitialized 727 --- 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 649a414..3698c2b 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - cleanup + [fix] - exists gegen defined diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 1790f6a..b5c2bca 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -707,9 +707,9 @@ sub WriteReadings { $hash, $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name}, - ($propertie->{value} eq '') ? RigReadingsValue( $hash, 'n/a') : RigReadingsValue( $hash, $propertie->{value} ) + (defined ($propertie->{value} ) eq '') ? RigReadingsValue( $hash, 'n/a') : RigReadingsValue( $hash, $propertie->{value} ) ) - if ( defined( $propertie->{value} ) + if ( exists( $propertie->{value} ) && $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name} ne 'radio-quality' && $decode_json->{abilities}[$abilities]{name} . '-' diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index d496860..6f4e17d 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-22_21:07:48 73554 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-24_20:24:56 73564 FHEM/74_GardenaSmartDevice.pm From df33172650a30448e9f32c434805c346adf20229 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 24 Jul 2022 20:29:15 +0200 Subject: [PATCH 095/126] [add] - translation pumpe filter --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 1 + controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGED b/CHANGED index 3698c2b..9fedf86 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - exists gegen defined + [fix] - uninitialized 727 diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index b5c2bca..3b83cbb 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -1238,6 +1238,7 @@ sub ReadingLangGerman { 'next watering: %s' => 'Nächste Bewässerung: %s', 'n/a' => 'nicht verfügbar', 'pump_not_filled' => 'Pumpe nicht gefüllt', + 'clean_fine_filter' => 'Filter reinigen', ); if ( diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 6f4e17d..3280213 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-24_20:24:56 73564 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-24_20:29:03 73628 FHEM/74_GardenaSmartDevice.pm From a13c42f08c644237212a1b3dd4cd5dd02076bfcb Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 27 Jul 2022 22:31:53 +0200 Subject: [PATCH 096/126] [add] - translations/commandref --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 3677 ++++++++++++++++--------------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 1928 insertions(+), 1753 deletions(-) diff --git a/CHANGED b/CHANGED index 9fedf86..af3012d 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - uninitialized 727 + [add] - translation pumpe filter diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 3b83cbb..c5fa25d 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -1,1751 +1,1926 @@ -############################################################################### -# -# Developed with VSCodium and richterger perl plugin. -# -# (c) 2017-2022 Copyright: Marko Oldenburg (fhemdevelopment at cooltux dot net) -# All rights reserved -# -# Special thanks goes to comitters: -# - Michael (mbrak) Thanks for Commandref -# - Matthias (Kenneth) Thanks for Wiki entry -# - BioS Thanks for predefined start points Code -# - fettgu Thanks for Debugging Irrigation Control data flow -# - Sebastian (BOFH) Thanks for new Auth Code after API Change -# -# -# This script is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# any later version. -# -# The GNU General Public License can be found at -# http://www.gnu.org/copyleft/gpl.html. -# A copy is found in the textfile GPL.txt and important notices to the license -# from the author is found in LICENSE.txt distributed with these scripts. -# -# This script is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# -# $Id$ -# -############################################################################### -## -## -## Das JSON Modul immer in einem eval aufrufen -# $data = eval{decode_json($data)}; -# -# if($@){ -# Log3($SELF, 2, "$TYPE ($SELF) - error while request: $@"); -# -# readingsSingleUpdate($hash, "state", "error", 1); -# -# return; -# } -# -# -###### Wichtige Notizen -# -# apt-get install libio-socket-ssl-perl -# http://www.dxsdata.com/de/2016/07/php-class-for-gardena-smart-system-api/ -# -## -## - -## unserer packagename -package FHEM::GardenaSmartDevice; -use GPUtils qw(GP_Import GP_Export); - -use strict; -use warnings; -use POSIX; -use FHEM::Meta; -use Time::Local; -use Time::Piece; -use Time::Seconds; - -# try to use JSON::MaybeXS wrapper -# for chance of better performance + open code -eval { - require JSON::MaybeXS; - import JSON::MaybeXS qw( decode_json encode_json ); - 1; -} or do { - - # try to use JSON wrapper - # for chance of better performance - eval { - # JSON preference order - local $ENV{PERL_JSON_BACKEND} = - 'Cpanel::JSON::XS,JSON::XS,JSON::PP,JSON::backportPP' - unless ( defined( $ENV{PERL_JSON_BACKEND} ) ); - - require JSON; - import JSON qw( decode_json encode_json ); - 1; - } or do { - - # In rare cases, Cpanel::JSON::XS may - # be installed but JSON|JSON::MaybeXS not ... - eval { - require Cpanel::JSON::XS; - import Cpanel::JSON::XS qw(decode_json encode_json); - 1; - } or do { - - # In rare cases, JSON::XS may - # be installed but JSON not ... - eval { - require JSON::XS; - import JSON::XS qw(decode_json encode_json); - 1; - } or do { - - # Fallback to built-in JSON which SHOULD - # be available since 5.014 ... - eval { - require JSON::PP; - import JSON::PP qw(decode_json encode_json); - 1; - } or do { - - # Fallback to JSON::backportPP in really rare cases - require JSON::backportPP; - import JSON::backportPP qw(decode_json encode_json); - 1; - }; - }; - }; - }; -}; - -## Import der FHEM Funktionen -#-- Run before package compilation -BEGIN { - - # Import from main context - GP_Import( - qw(readingsSingleUpdate - readingsBulkUpdate - readingsBulkUpdateIfChanged - readingsBeginUpdate - readingsEndUpdate - Log3 - CommandAttr - AttrVal - ReadingsVal - readingFnAttributes - AssignIoPort - modules - IOWrite - defs - makeDeviceName) - ); -} - -#-- Export to main context with different name -GP_Export( - qw( - Initialize - ) -); - -sub Initialize { - my $hash = shift; - - $hash->{Match} = '^{"id":".*'; - - $hash->{SetFn} = \&Set; - $hash->{DefFn} = \&Define; - $hash->{UndefFn} = \&Undef; - $hash->{ParseFn} = \&Parse; - - $hash->{AttrFn} = \&Attr; - $hash->{AttrList} = - "readingValueLanguage:de,en " - . "model:watering_computer,sensor,sensor2,mower,ic24,power,electronic_pressure_pump " - . "extendedState:0,1 " - . "IODev " - . $readingFnAttributes; - $hash->{parseParams} = 1; - - return FHEM::Meta::InitMod( __FILE__, $hash ); -} - -sub Define { - my $hash = shift // return; - my $aArg = shift // return; - - return $@ unless ( FHEM::Meta::SetInternals($hash) ); - use version 0.60; our $VERSION = FHEM::Meta::Get( $hash, 'version' ); - - return - "too few parameters: define GardenaSmartDevice " - if ( scalar( @{$aArg} ) < 3 ); - - my $name = $aArg->[0]; - 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} = ''; - # Electroni Pressure Pump - $hash->{helper}{operating_mode_id} = ''; - $hash->{helper}{leakage_detection_id} = ''; - $hash->{helper}{turn_on_pressure_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} = ''; - - CommandAttr( undef, - "$name IODev $modules{GardenaSmartBridge}{defptr}{BRIDGE}->{NAME}" ) - if ( AttrVal( $name, 'IODev', 'none' ) eq 'none' ); - - my $iodev = AttrVal( $name, 'IODev', 'none' ); - - AssignIoPort( $hash, $iodev ) if ( !$hash->{IODev} ); - - if ( defined( $hash->{IODev}->{NAME} ) ) { - Log3 $name, 3, "GardenaSmartDevice ($name) - I/O device is " - . $hash->{IODev}->{NAME}; - } - else { - Log3 $name, 1, "GardenaSmartDevice ($name) - no I/O device"; - } - - $iodev = $hash->{IODev}->{NAME}; - - my $d = $modules{GardenaSmartDevice}{defptr}{$deviceId}; - - return -"GardenaSmartDevice device $name on GardenaSmartBridge $iodev already defined." - if ( defined($d) - && $d->{IODev} == $hash->{IODev} - && $d->{NAME} ne $name ); - - CommandAttr( undef, $name . ' room GardenaSmart' ) - if ( AttrVal( $name, 'room', 'none' ) eq 'none' ); - - CommandAttr( undef, $name . ' model ' . $category ) - if ( AttrVal( $name, 'model', 'none' ) eq 'none' ); - - Log3 $name, 3, -"GardenaSmartDevice ($name) - defined GardenaSmartDevice with DEVICEID: $deviceId"; - readingsSingleUpdate( $hash, 'state', 'initialized', 1 ); - - $modules{GardenaSmartDevice}{defptr}{$deviceId} = $hash; - - return; -} - -sub Undef { - my $hash = shift; - my $arg = shift; - - my $name = $hash->{NAME}; - my $deviceId = $hash->{DEVICEID}; - - delete $modules{GardenaSmartDevice}{defptr}{$deviceId}; - - return; -} - -sub Attr { - - my ( $cmd, $name, $attrName, $attrVal ) = @_; - my $hash = $defs{$name}; - - return; -} - -sub Set { - my $hash = shift // return; - my $aArg = shift // return; - - my $name = shift @$aArg; - my $cmd = shift @$aArg - // return qq{"set $name" needs at least one argument}; - - my $payload; - my $abilities; - my $service_id; - my $mainboard_version = - ReadingsVal( $name, 'mower_type-mainboard_version', 0.0 ); - - my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat, - $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) = localtime(time); - - my $timezone_offset = $Sommerzeit ? 0 : ( Time::Piece->new )->tzoffset; - - #set default abilitie ... overwrite in cmd to change - $abilities = 'mower' - if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' ); - $abilities = 'watering' - if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' - || AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' ); - $abilities = 'power' - if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' ); - $abilities = 'watering' - if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' ); - - ### mower - # service_id (eco, parkuntilfurhternotice, startpoints) - if ( lc $cmd eq 'parkuntilfurthernotice' ) { - $payload = '"name":"park_until_further_notice"'; - if ( $mainboard_version > 10.30 ) { - $payload = -' "settings":{"name":"schedules_paused_until","value":"2038-01-18T00:00:00.000Z","device":"' - . $hash->{DEVICEID} . '"}'; - $abilities = 'mower_settings'; - $service_id = $hash->{helper}{schedules_paused_until_id}; - } - } - elsif ( lc $cmd eq 'parkuntilnexttimer' ) { - $payload = '"name":"park_until_next_timer"'; - if ( $mainboard_version > 10.30 ) { - $payload = '"properties":{"name":"mower_timer","value":0}'; - $abilities = 'mower_timer'; - } - } - elsif ( lc $cmd eq 'startresumeschedule' ) { - $payload = '"name":"start_resume_schedule"'; - if ( $mainboard_version > 10.30 ) { - $payload = -' "settings":{"name":"schedules_paused_until","value":"","device":"' - . $hash->{DEVICEID} . '"}'; - $abilities = 'mower_settings'; - $service_id = $hash->{helper}{schedules_paused_until_id}; - } - } - elsif ( lc $cmd eq 'startoverridetimer' ) { - $payload = '"name":"start_override_timer","parameters":{"duration":' - . $aArg->[0] * 60 . '}'; - if ( $mainboard_version > 10.30 ) { - $payload = '"properties":{"name":"mower_timer","value":' - . $aArg->[0] * 60 . '}'; - $abilities = 'mower_timer'; - } - - } - elsif ( lc $cmd eq 'startpoint' ) { - my $err; - ( $err, $payload, $abilities ) = - SetPredefinedStartPoints( $hash, $aArg ); - $service_id = $hash->{helper}{STARTINGPOINTID}; - return $err if ( defined($err) ); - } - elsif ( lc $cmd eq 'eco' ) { - $payload = - '"settings": {"name": "eco_mode", "value": ' - . $aArg->[0] - . ', "device": "' - . $hash->{DEVICEID} . '"}'; - $abilities = 'mower_settings' if ( $mainboard_version > 10.30 ); - $service_id = $hash->{helper}{eco_mode_id}; - -#$abilities['service_id'] = $hash->{helper}{SCHEDULESID} if ( $mainboard_version > 10.30 ); - } - ### electronic_pressure_pump - # elsif ( lc $cmd eq 'pumptimer' ) { - # $payload = - # '"name":"pump_manual_watering_timer","parameters":{"duration":' - # . $aArg->[0] . '}'; - # } - ### watering_computer & electronic pump - elsif ( lc $cmd eq 'manualoverride' ) { - $payload = - '"properties":{"name":"watering_timer_1' - . '","value":{"state":"manual","duration":' - . $aArg->[0] * 60 - . ',"valve_id":1}}'; - } - elsif ( lc $cmd eq 'manualbuttontime' ) { - $service_id = $hash->{helper}{button_config_time_id}; - $payload = - '"properties":{"name":"button_config_time",' - . '"value":' - . $aArg->[0] * 60 - . ',"timestamp":"2021-05-26T19:06:23.680Z"' - . ',"at_bound":null,"unit":"seconds","ability":"' - . $service_id . '"}'; - $abilities = 'watering_button_config'; - } - elsif ( $cmd =~ m{\AcancelOverride}xms ) { - - my $valve_id = 1; - - if ( $cmd =~ m{\AcancelOverrideValve(\d)\z}xms ) { - $valve_id = $1; - } - - $payload = - '"properties":{"name":"watering_timer_' - . $valve_id - . '","value":{"state":"idle","duration":' - . 0 - . ',"valve_id":' - . $valve_id . '}}'; - } - elsif ( $cmd =~ /.*Schedule$/ ) { - my $duration = ( - ( - defined( $aArg->[0] ) - ? ( - ( - ( Time::Piece->new ) + - ( ONE_HOUR * $aArg->[0] ) - - $timezone_offset - )->datetime - ) - . '.000Z' - : '2038-01-18T00:00:00.000Z' - ) - ); - - $abilities = 'wateringcomputer_settings'; - $service_id = $hash->{helper}->{'schedules_paused_until_id'}; - $payload = - '"settings":{"name":"schedules_paused_until"' - . ', "value":"' - . ( $cmd eq 'resumeSchedule' ? '' : $duration ) - . '","device":"' - . $hash->{DEVICEID} . '"}'; - } - elsif ( lc $cmd eq 'on' || lc $cmd eq 'off' || lc $cmd eq 'on-for-timer' ) { - my $val = ( - scalar( !@$aArg == 0 ) && ref($aArg) eq 'ARRAY' - ? $aArg->[0] * 60 - : lc $cmd - ); - - $payload = - '"properties":{"name":"power_timer", "value":"' . $val . '"}'; - } - ### Watering ic24 - elsif ( $cmd =~ m{\AmanualDurationValve\d\z}xms ) { - my $valve_id; - - if ( $cmd =~ m{\AmanualDurationValve(\d)\z}xms ) { - $valve_id = $1; - } - - $payload = - '"properties":{"name":"watering_timer_' - . $valve_id - . '","value":{"state":"manual","duration":' - . $aArg->[0] * 60 - . ',"valve_id":' - . $valve_id . '}}'; - } - elsif ( $cmd eq 'closeAllValves' ) { - $payload = '"name":"close_all_valves","parameters":{}'; - } - elsif ( $cmd =~ /.*ScheduleValve$/ ) { - my $valve_id = $aArg->[0]; - my $duration = ( - ( - defined( $aArg->[1] ) - ? ( - ( - ( Time::Piece->new ) + - ( ONE_HOUR * $aArg->[1] ) - - $timezone_offset - )->datetime - ) - . '.000Z' - : '2038-01-18T00:00:00.000Z' - ) - ); - - $abilities = 'irrigation_settings'; - $service_id = - $hash->{helper}->{ 'schedules_paused_until_' . $valve_id . '_id' }; - $payload = - '"settings":{"name":"schedules_paused_until_' - . $valve_id - . '", "value":"' - . ( $cmd eq 'resumeScheduleValve' ? '' : $duration ) - . '","device":"' - . $hash->{DEVICEID} . '"}'; - } - ### Watering_pressure_pump - elsif ( lc $cmd eq 'operating_mode') { - my $op_mode = $aArg->[0]; - $payload = '"settings":{"name":"operating_mode",' - .'"value":"'.$op_mode.'",' - .'"device":"' - . $hash->{DEVICEID}.'"}'; - $abilities = 'watering_pressure_pump_settings'; - $service_id = $hash->{helper}->{ 'operating_mode_id' }; - } - elsif ( lc $cmd eq 'leakage_detection') { - my $leakdetection_mode = $aArg->[0]; - $payload = '"settings":{"name":"leakage_detection",' - .'"value":"'.$leakdetection_mode.'",' - .'"device":"' - . $hash->{DEVICEID}.'"}'; - $abilities = 'watering_pressure_pump_settings'; - $service_id = $hash->{helper}->{ 'leakage_detection_id' }; - } - elsif ( lc $cmd eq 'turn_on_pressure') { - my $turnonpressure = $aArg->[0]; - $payload = '"settings":{"name":"turn_on_pressure",' - .'"value":"'.$turnonpressure.'",' - .'"device":"' - . $hash->{DEVICEID}.'"}'; - $abilities = 'watering_pressure_pump_settings'; - $service_id = $hash->{helper}->{ 'turn_on_pressure_id' }; - } - elsif ( lc $cmd eq 'resetvalveerrors') { - $payload = '"name":"reset_valve_errors",' - .' "parameters": {}'; - $abilities = 'error'; - } - - ### Sensors - elsif ( lc $cmd eq 'refresh' ) { - - my $sensname = $aArg->[0]; - if ( lc $sensname eq 'temperature' ) { - if ( ReadingsVal( $name, 'device_info-category', 'sensor' ) eq - 'sensor' ) - { - $payload = '"name":"measure_ambient_temperature"'; - $abilities = 'ambient_temperature'; - } - else { - $payload = '"name":"measure_soil_temperature"'; - $abilities = 'soil_temperature'; - } - } - elsif ( lc $sensname eq 'light' ) { - $payload = '"name":"measure_light"'; - $abilities = 'light'; - - } - elsif ( lc $sensname eq 'humidity' ) { - $payload = '"name":"measure_soil_humidity"'; - $abilities = 'humidity'; - } - } - ## winter sleep - elsif ( lc $cmd eq 'winter_mode' ) { - $payload = - '"settings":{"name":"winter_mode","value":"' - . $aArg->[0] - . '","device":"' - . $hash->{DEVICEID} . '"}'; - $abilities = 'winter_settings'; - $service_id = $hash->{helper}->{'winter_mode_id'}; - } - else { - - my $list = ''; - - $list .= -'parkUntilFurtherNotice:noArg parkUntilNextTimer:noArg startResumeSchedule:noArg startOverrideTimer:slider,0,1,240 startpoint' - if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' ); - - $list .= -'manualOverride:slider,1,1,59 cancelOverride:noArg resumeSchedule:noArg stopSchedule manualButtonTime:slider,0,2,100' - if ( AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' ); - - - $list .= 'manualOverride:slider,1,1,90 cancelOverride:noArg operating_mode:automatic,scheduled leakage_detection:watering,washing_machine,domestic_water_supply,off turn_on_pressure:slider,2,0.2,3.0,1 resetValveErrors:noArg' - if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' ); - - $list .= -'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.?/ ); - - # add light for old sensors - $list .= ',light' - if ( AttrVal( $name, 'model', 'unknown' ) eq 'sensor' - && ReadingsVal( $name, 'device_info-category', 'unknown' ) eq - 'sensor' ); - - $list .= 'on:noArg off:noArg on-for-timer:slider,0,1,720' - if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' ); - - # all devices has abilitie to fall a sleep - $list .= ' winter_mode:awake,hibernate'; - return "Unknown argument $cmd, choose one of $list"; - } - - $hash->{helper}{deviceAction} = $payload; - readingsSingleUpdate( $hash, "state", "send command to gardena cloud", 1 ); - - IOWrite( $hash, $payload, $hash->{DEVICEID}, $abilities, $service_id ); - Log3 $name, 4, -"GardenaSmartBridge ($name) - IOWrite: $payload $hash->{DEVICEID} $abilities IODevHash=$hash->{IODev}"; - - return; -} - -sub Parse { - my $io_hash = shift; - my $json = shift; - - my $name = $io_hash->{NAME}; - - my $decode_json = eval { decode_json($json) }; - if ($@) { - Log3 $name, 3, - "GardenaSmartDevice ($name) - JSON error while request: $@"; - } - - Log3 $name, 4, "GardenaSmartDevice ($name) - ParseFn was called"; - Log3 $name, 4, "GardenaSmartDevice ($name) - JSON: $json"; - - if ( defined( $decode_json->{id} ) ) { - - my $deviceId = $decode_json->{id}; - - if ( my $hash = $modules{GardenaSmartDevice}{defptr}{$deviceId} ) { - my $name = $hash->{NAME}; - - WriteReadings( $hash, $decode_json ); - Log3 $name, 4, - "GardenaSmartDevice ($name) - find logical device: $hash->{NAME}"; - - return $hash->{NAME}; - - } - else { - - Log3 $name, 3, - "GardenaSmartDevice ($name) - autocreate new device " - . makeDeviceName( $decode_json->{name} ) - . " with deviceId $decode_json->{id}, model $decode_json->{category}"; - return - "UNDEFINED " - . makeDeviceName( $decode_json->{name} ) - . " GardenaSmartDevice $decode_json->{id} $decode_json->{category}"; - } - } - - return; -} - -sub WriteReadings { - my $hash = shift; - my $decode_json = shift; - - 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); - - do { - - if ( - ref( $decode_json->{abilities}[$abilities]{properties} ) eq "ARRAY" - && scalar( @{ $decode_json->{abilities}[$abilities]{properties} } ) - > 0 ) - { - for my $propertie ( - @{ $decode_json->{abilities}[$abilities]{properties} } ) - { - if ( - exists( $decode_json->{abilities}[$abilities]{name} ) - && ( $decode_json->{abilities}[$abilities]{name} eq - 'watering' ) - ) - { - - if ( $propertie->{name} eq 'button_config_time' ) { - if ( $hash->{helper}{ $propertie->{name} . '_id' } ne - $decode_json->{abilities}[$abilities]{id} ) - { - $hash->{helper}{ $propertie->{name} . '_id' } = - $decode_json->{abilities}[$abilities]{id}; - } - readingsBulkUpdateIfChanged( - $hash, - 'manualButtonTime', - ( - RigReadingsValue( - $hash, $propertie->{value} / 60 - ) - ) - ); - next; - } - } - - readingsBulkUpdateIfChanged( - $hash, - $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name}, - (defined ($propertie->{value} ) eq '') ? RigReadingsValue( $hash, 'n/a') : RigReadingsValue( $hash, $propertie->{value} ) - ) - if ( exists( $propertie->{value} ) - && $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} ne 'radio-quality' - && $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} ne 'battery-level' - && $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} ne 'internal_temperature-temperature' - && $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} ne 'ambient_temperature-temperature' - && $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} ne 'soil_temperature-temperature' - && $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} ne 'humidity-humidity' - && $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} ne 'light-light' - && ref( $propertie->{value} ) ne "HASH" ); - - readingsBulkUpdateIfChanged( - $hash, - $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name}, - RigReadingsValue( $hash, $propertie->{value} ) - ) - if ( - defined( $propertie->{value} ) - && ( $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} eq 'radio-quality' - || $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} eq 'battery-level' - || $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} eq - 'internal_temperature-temperature' - || $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} eq - 'ambient_temperature-temperature' - || $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} eq 'soil_temperature-temperature' - || $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} eq 'humidity-humidity' - || $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} eq 'light-light' ) - ); - - readingsBulkUpdateIfChanged( - $hash, - $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} - . '_timestamp', - Time::Piece->strptime( - RigReadingsValue( $hash, $propertie->{timestamp} ), - "%Y-%m-%d %H:%M:%S" )->strftime('%s') - - ) - if ( - defined( $propertie->{value} ) - && ( $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} eq 'mower_timer-mower_timer' ) - ); - - readingsBulkUpdateIfChanged( - $hash, - $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name}, - join( ',', @{ $propertie->{value} } ) - ) - if ( defined( $propertie->{value} ) - && $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} eq 'ic24-valves_connected' ); - - readingsBulkUpdateIfChanged( - $hash, - $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name}, - join( ',', @{ $propertie->{value} } ) - ) - if ( defined( $propertie->{value} ) - && $decode_json->{abilities}[$abilities]{name} . '-' - . $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} } ) { - if ( ref( $v ) ne "HASH" ) { - readingsBulkUpdate( - $hash, - $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} . '_' - . $r, - RigReadingsValue( $hash, $v ) - ); - } else { - while ( my ( $i_r, $i_v ) = each %{ $v } ) { - readingsBulkUpdate( - $hash, - $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} . '_' - . $r . '_' . $i_r, - RigReadingsValue( $hash, $i_v ) - ); - } - } - } - } - # ic24 and other watering devices calc irrigation left in sec - readingsBulkUpdateIfChanged( - $hash, - $decode_json->{abilities}[$abilities]{name} . '-' - . $propertie->{name} - . '_irrigation_left', - ( $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) : 0 - ) - if ( defined( $propertie->{value} ) - && $decode_json->{abilities}[$abilities]{name} eq 'watering' - ); - } - } - - $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; 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 - $event_id++; # event id - - while ( my ( $r, $v ) = each %{ $event_schedules } ) { - readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_' - . $event_id - . '_valve_' - . $valve_id - . '_' - . $r, - $v) if (ref($v) ne 'HASH' ); - readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_' - . $event_id - . '_valve_' - . $valve_id - . '_' - . $v->{type}, - join(',', @ { $v->{weekdays}}) ) if (ref($v) eq 'HASH' ); - }; - }; - - }; # fi scheduled_events - - my $winter_mode; - - do { -#Log3 $name, 1, "Settings pro Device : ".$decode_json->{settings}[$settings]{name}; -#Log3 $name, 1, " - KEIN ARRAY" if ( ref( $decode_json->{settings}[$settings]{value} ) ne "ARRAY"); -#Log3 $name, 1, " - IST ARRAY" if ( ref( $decode_json->{settings}[$settings]{value} ) eq "ARRAY"); - - if ( - exists( $decode_json->{settings}[$settings]{name} ) - && ( $decode_json->{settings}[$settings]{name} =~ - /schedules_paused_until_?\d?$/ - || $decode_json->{settings}[$settings]{name} eq 'eco_mode' - || $decode_json->{settings}[$settings]{name} eq 'winter_mode' - || $decode_json->{settings}[$settings]{name} eq 'operating_mode' - || $decode_json->{settings}[$settings]{name} eq 'leakage_detection' - || $decode_json->{settings}[$settings]{name} eq 'turn_on_pressure' ) - ) - { - if ( $hash->{helper} - { $decode_json->{settings}[$settings]{name} . '_id' } ne - $decode_json->{settings}[$settings]{id} ) - { - $hash->{helper} - { $decode_json->{settings}[$settings]{name} . '_id' } = - $decode_json->{settings}[$settings]{id}; - } - # check watering controler single schedules pause until - if ( $decode_json->{settings}[$settings]{name} eq 'schedules_paused_until' ) { - 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 - # check if empty, clear scheduling-scheduled_watering_next_start_x - readingsBulkUpdateIfChanged( $hash, 'scheduling-'.$decode_json->{settings}[$settings]{name}, - $decode_json->{settings}[$settings]{value} ); - # CommandAttr( undef, $name . " scheduling-scheduled_watering_next_start_") if ($decode_json->{settings}[$settings]{value} eq '' ) - } -#TODO: Readings und Setter ?! - # save electronid pressure pump settings as readings - if ( $decode_json->{settings}[$settings]{name} eq 'operating_mode' - || $decode_json->{settings}[$settings]{name} eq 'leakage_detection' - || $decode_json->{settings}[$settings]{name} eq 'turn_on_pressure' ) { - readingsBulkUpdateIfChanged( $hash, $decode_json->{settings}[$settings]{name}, - $decode_json->{settings}[$settings]{value} ); - - } - # save winter mode as reading - if ( $decode_json->{settings}[$settings]{name} eq 'winter_mode' ) { - readingsBulkUpdateIfChanged( $hash, 'winter_mode', - $decode_json->{settings}[$settings]{value} ); - - $winter_mode = $decode_json->{settings}[$settings]{value}; - } - } - - if ( defined( $decode_json->{settings}[$settings]{name} ) - && $decode_json->{settings}[$settings]{name} eq 'valve_names' - && 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'}"; - 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' ) - { - #save the startingpointid needed to update the startingpoints - if ( $hash->{helper}{STARTINGPOINTID} ne - $decode_json->{settings}[$settings]{id} ) - { - $hash->{helper}{STARTINGPOINTID} = - $decode_json->{settings}[$settings]{id}; - } - - $hash->{helper}{STARTINGPOINTS} = - '{ "name": "starting_points", "value": ' - . encode_json( $decode_json->{settings}[$settings]{value} ) . '}'; - my $startpoint_cnt = 0; - - for my $startingpoint ( - @{ $decode_json->{settings}[$settings]{value} } ) - { - $startpoint_cnt++; - readingsBulkUpdateIfChanged( - $hash, - 'startpoint-' . $startpoint_cnt . '-enabled', - $startingpoint->{enabled} - ); - } - } - - $settings--; - } while ( $settings >= 0 ); - - if ( $winter_mode ne 'hibernate' ) { - setState($hash); - } - else { - readingsBulkUpdate( $hash, 'state', - RigReadingsValue( $hash, 'hibernate' ) ); - } - - readingsEndUpdate( $hash, 1 ); - - Log3 $name, 4, "GardenaSmartDevice ($name) - readings was written"; - - return; -} - -sub setState { - my $hash = shift; - my $name = $hash->{NAME}; - - my $online_state = - ReadingsVal( $name, 'device_info-connection_status', 'unknown' ); - - #online state mower - readingsBulkUpdate( $hash, 'state', - $online_state eq 'online' - ? ReadingsVal( $name, 'mower-status', 'readingsValError' ) - : 'offline' ) - if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' ); - - # ic24 / wc / electronic pump - - if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' - || AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' - || 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 = ''; - my $error_type = 'ok'; - 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 ); - ## set error type (pumpe required) - $error_type = ReadingsVal( $name, 'error-valve_error_'.$_.'_type', 'ok' ) if (ReadingsVal( $name, 'error-valve_error_'.$_.'_type', 'ok' ) ne 'ok'); - ## 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 ) ); - - # 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, 5, "[DEBUG] - process: $processed_item"; - Log3 $name, 5, "[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, 5, "[DEBUG] - next_start: empty "; - Log3 $name, 5, "[DEBUG] - empty pro item ".Time::Piece->strptime( $processed_item, "%Y-%m-%d %H:%M:%S"); - Log3 $name, 5, "[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:%S") - < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M:%S") - && $has_schedule - && Time::Piece->strptime( $processed_item, "%Y-%m-%d %H:%M:%S") - > Time::Piece->new - ) - } else { - $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); - } - Log3 $name, 5, "[DEBUG] - choosed nearst: $nearst_irrigation"; - - } # for - # override state 4 extendedstates - if ( AttrVal( $name, "extendedState", 0 ) == 1) { - 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)); - } # /for - } else { - $state_string .= RigReadingsValue($hash, 'closed'); - } - $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 - { - - } - ' ) - if ( AttrVal( $name, 'stateFormat', 'none' ) eq 'none' ); - } else { - Log3 $name, 5, "[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_schedule - && $nearst_irrigation ne '2999-12-12 12:00') - # zeitplan aktiv - # ? ( $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 - : (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') - ; - # state offline | override - $state_string = 'offline' if ($online_state eq 'offline'); - $state_string = ( $error_type ne 'ok' ) ? $error_type : $state_string; - - } - readingsBulkUpdate( - $hash, 'state', RigReadingsValue( $hash, $state_string ) ); - } - - # Sensor / Sensor 2 - if ( AttrVal( $name, 'model', 'unknown' ) =~ /sensor.?/ ) { - my $state_string = - ( ReadingsVal( $name, 'device_info-category', 'unknown' ) eq - 'sensor' ) - ? 'T: ' - . ReadingsVal( $name, 'ambient_temperature-temperature', - 'readingsValError' ) - . '°C, ' - : 'T: ' - . ReadingsVal( $name, 'soil_temperature-temperature', - 'readingsValError' ) - . '°C, '; - $state_string .= 'H: ' - . ReadingsVal( $name, 'humidity-humidity', 'readingsValError' ) . '%'; - $state_string .= ', L: ' - . ReadingsVal( $name, 'light-light', 'readingsValError' ) . 'lux' - if ( ReadingsVal( $name, 'device_info-category', 'unknown' ) eq - 'sensor' ); - -# if ( $online_state eq 'offline') { -# readingsBulkUpdate( $hash, 'humidity-humidity', '-1' ); -# readingsBulkUpdate( $hash, 'ambient_temperature-temperature', '-1' ) if (ReadingsVal($name, 'device_info-category', 'unknown') eq 'sensor'); -# readingsBulkUpdate( $hash, 'light-light', '-1' ) if (ReadingsVal($name, 'device_info-category', 'unknown') eq 'sensor'); -# } - #online state sensor I II - readingsBulkUpdate( $hash, 'state', - $online_state eq 'online' ? RigReadingsValue( $hash, $state_string) : RigReadingsValue( $hash, 'offline') ); - } - - readingsBulkUpdate( $hash, 'state', - ReadingsVal( $name, 'power-power_timer', 'no info from power-timer' ) ) - if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' ); - - return; -} - -################################## -################################## -#### my little helpers ########### - -sub ReadingLangGerman { - my $hash = shift; - my $readingValue = shift; - - my $name = $hash->{NAME}; - my %langGermanMapp = ( - 'ok_cutting' => 'mähen', - 'paused' => 'pausiert', - 'ok_searching' => 'suche Ladestation', - 'ok_charging' => 'lädt', - 'ok_leaving' => 'unterwegs zum Startpunkt', - 'wait_updating' => 'wird aktualisiert ...', - 'wait_power_up' => 'wird eingeschaltet ...', - 'parked_timer' => 'geparkt nach Zeitplan', - 'parked_park_selected' => 'geparkt', - 'off_disabled' => 'der Mäher ist ausgeschaltet', - 'off_hatch_open' => 'deaktiviert. Abdeckung ist offen oder PIN-Code erforderlich', - 'unknown' => 'unbekannter Status', - 'error' => 'Fehler', - 'error_at_power_up' => 'Neustart ...', - 'off_hatch_closed' => 'Deaktiviert. Manueller Start erforderlich', - 'ok_cutting_timer_overridden' => 'manuelles mähen', - 'parked_autotimer' => 'geparkt durch SensorControl', - 'parked_daily_limit_reached' => 'abgeschlossen', - 'no_message' => 'kein Fehler', - 'outside_working_area' => 'außerhalb des Arbeitsbereichs', - 'no_loop_signal' => 'kein Schleifensignal', - 'wrong_loop_signal' => 'falsches Schleifensignal', - 'loop_sensor_problem_front' => 'Problem Schleifensensor, vorne', - 'loop_sensor_problem_rear' => 'Problem Schleifensensor, hinten', - 'trapped' => 'eingeschlossen', - 'upside_down' => 'steht auf dem Kopf', - 'low_battery' => 'niedriger Batteriestand', - 'empty_battery' => 'Batterie leer', - 'no_drive' => 'fährt nicht', - 'lifted' => 'angehoben', - 'stuck_in_charging_station' => 'eingeklemmt in Ladestation', - 'charging_station_blocked' => 'Ladestation blockiert', - 'collision_sensor_problem_rear' => 'Problem Stoßsensor hinten', - 'collision_sensor_problem_front' => 'Problem Stoßsensor vorne', - 'wheel_motor_blocked_right' => 'Radmotor rechts blockiert', - 'wheel_motor_blocked_left' => 'Radmotor links blockiert', - 'wheel_drive_problem_right' => 'Problem Antrieb, rechts', - 'wheel_drive_problem_left' => 'Problem Antrieb, links', - 'cutting_system_blocked' => 'Schneidsystem blockiert', - 'invalid_sub_device_combination' => 'fehlerhafte Verbindung', - 'settings_restored' => 'Standardeinstellungen', - 'electronic_problem' => 'elektronisches Problem', - 'charging_system_problem' => 'Problem Ladesystem', - 'tilt_sensor_problem' => 'Kippsensor Problem', - 'wheel_motor_overloaded_right' => 'rechter Radmotor überlastet', - 'wheel_motor_overloaded_left' => 'linker Radmotor überlastet', - 'charging_current_too_high' => 'Ladestrom zu hoch', - 'temporary_problem' => 'vorübergehendes Problem', - 'guide_1_not_found' => 'SK 1 nicht gefunden', - 'guide_2_not_found' => 'SK 2 nicht gefunden', - 'guide_3_not_found' => 'SK 3 nicht gefunden', - 'difficult_finding_home' => 'Problem die Ladestation zu finden', - 'guide_calibration_accomplished' => 'Kalibrierung des Suchkabels beendet', - 'guide_calibration_failed' => 'Kalibrierung des Suchkabels fehlgeschlagen', - 'temporary_battery_problem' => 'kurzzeitiges Batterieproblem', - 'battery_problem' => 'Batterieproblem', - 'alarm_mower_switched_off' => 'Alarm! Mäher ausgeschalten', - 'alarm_mower_stopped' => 'Alarm! Mäher gestoppt', - 'alarm_mower_lifted' => 'Alarm! Mäher angehoben', - 'alarm_mower_tilted' => 'Alarm! Mäher gekippt', - 'connection_changed' => 'Verbindung geändert', - 'connection_not_changed' => 'Verbindung nicht geändert', - 'com_board_not_available' => 'COM Board nicht verfügbar', - 'slipped' => 'rutscht', - 'out_of_operation' => 'ausser Betrieb', - 'replace_now' => 'kritischer Batteriestand, wechseln Sie jetzt', - 'low' => 'niedrig', - 'ok' => 'ok', - 'no_source' => 'ok', - 'mower_charging' => 'Mäher wurde geladen', - 'completed_cutting_autotimer' => 'Sensor Control erreicht', - 'week_timer' => 'Wochentimer erreicht', - 'countdown_timer' => 'Stoppuhr Timer', - 'undefined' => 'unklar', - 'unknown' => 'unklar', - 'status_device_unreachable' => 'Gerät ist nicht in Reichweite', - 'status_device_alive' => 'Gerät ist in Reichweite', - 'bad' => 'schlecht', - 'poor' => 'schwach', - 'good' => 'gut', - 'undefined' => 'unklar', - 'idle' => 'nichts zu tun', - 'firmware_cancel' => 'Firmwareupload unterbrochen', - 'firmware_upload' => 'Firmwareupload', - 'unsupported' => 'nicht unterstützt', - 'up_to_date' => 'auf dem neusten Stand', - 'mower' => 'Mäher', - 'watering_computer' => 'Bewässerungscomputer', - 'no_frost' => 'kein Frost', - 'open' => 'offen', - 'closed' => 'geschlossen', - 'included' => 'inbegriffen', - 'active' => 'aktiv', - 'inactive' => 'nicht aktiv', - 'hibernate' => 'Winterschlaf', - 'awake' => 'Aufgewacht', - 'schedule permanently paused' => 'Zeitplan dauerhaft pausiert', - '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', - 'pump_not_filled' => 'Pumpe nicht gefüllt', - 'clean_fine_filter' => 'Filter reinigen', - ); - - if ( - defined( $langGermanMapp{$readingValue} ) - && ( AttrVal( 'global', 'language', 'none' ) eq 'DE' - || AttrVal( $name, 'readingValueLanguage', 'none' ) eq 'de' ) - && AttrVal( $name, 'readingValueLanguage', 'none' ) ne 'en' - ) - { - return $langGermanMapp{$readingValue}; - } - else { - return $readingValue; - } - - return; -} - -sub RigReadingsValue { - my $hash = shift; - my $readingValue = shift; - - my $rigReadingValue; - - if ( $readingValue =~ /^(\d+)-(\d\d)-(\d\d)T(\d\d)/ ) { - $rigReadingValue = Zulu2LocalString($readingValue); - } - else { - $rigReadingValue = ReadingLangGerman( $hash, $readingValue ); - } - - return $rigReadingValue; -} - -sub Zulu2LocalString { - my $t = shift; - - my ( $datehour, $datemin, $rest ) = split( /:/, $t, 3 ); - - my ( $year, $month, $day, $hour, $min ) = - $datehour =~ /(\d+)-(\d\d)-(\d\d)T(\d\d)/; - my $epoch = timegm( 0, 0, $hour, $day, $month - 1, $year ); - - my ( $lyear, $lmonth, $lday, $lhour, $isdst ) = - ( localtime($epoch) )[ 5, 4, 3, 2, -1 ]; - - $lyear += 1900; # year is 1900 based - $lmonth++; # month number is zero based - - if ( defined($rest) ) { - return ( - sprintf( - "%04d-%02d-%02d %02d:%02d:%s", - $lyear, $lmonth, $lday, - $lhour, $datemin, substr( $rest, 0, 2 ) - ) - ); - } - elsif ( $lyear < 2000 ) { - return 'temporarily unavailable'; - } - else { - return ( - sprintf( - "%04d-%02d-%02d %02d:%02d", - $lyear, $lmonth, $lday, $lhour, substr( $datemin, 0, 2 ) - ) - ); - } - - return; -} - -sub SetPredefinedStartPoints { - my $hash = shift; - my $aArg = shift; - - my ( $startpoint_state, $startpoint_num, @morestartpoints ) = @{$aArg}; - - my $name = $hash->{NAME}; - my $payload; - my $abilities; - - if ( defined($startpoint_state) && defined($startpoint_num) ) { - if ( defined( $hash->{helper}{STARTINGPOINTS} ) - && $hash->{helper}{STARTINGPOINTS} ne '' ) - { -# add needed parameters to saved settings config and change the value in request - my $decode_json_settings = - eval { decode_json( $hash->{helper}{STARTINGPOINTS} ) }; - if ($@) { - Log3 $name, 3, -"GardenaSmartBridge ($name) - JSON error while setting startpoint: $@"; - } - - $decode_json_settings->{device} = $hash->{DEVICEID}; - my $setval = $startpoint_state eq 'disable' ? \0 : \1; - $decode_json_settings->{value}[ $startpoint_num - 1 ]{enabled} = - $setval; - - #set more startpoints - if ( - defined scalar(@morestartpoints) - && ( scalar(@morestartpoints) == 2 - || scalar(@morestartpoints) == 4 ) - ) - { - if ( scalar(@morestartpoints) == 2 ) { - $setval = $morestartpoints[0] eq 'disable' ? \0 : \1; - $decode_json_settings->{value}[ $morestartpoints[1] - 1 ] - {enabled} = $setval; - - } - elsif ( scalar(@morestartpoints) == 4 ) { - $setval = $morestartpoints[0] eq 'disable' ? \0 : \1; - $decode_json_settings->{value}[ $morestartpoints[1] - 1 ] - {enabled} = $setval; - $setval = $morestartpoints[2] eq 'disable' ? \0 : \1; - $decode_json_settings->{value}[ $morestartpoints[3] - 1 ] - {enabled} = $setval; - } - } - - $payload = '"settings": ' . encode_json($decode_json_settings); - $abilities = 'mower_settings'; - - #$abilities['service_id'] = $hash->{helper}{STARTINGPOINTID}; - } - else { - return - "startingpoints not loaded yet, please wait a couple of minutes", - undef, undef; - } - } - else { - return - "startpoint usage: set " - . $hash->{NAME} - . " startpoint disable 1 [enable 2] [disable 3]", undef, undef; - } - - return undef, $payload, $abilities; -} - -1; - -=pod - -=item device -=item summary Modul to control GardenaSmart Devices -=item summary_DE Modul zur Steuerung von GardenaSmartgeräten - -=begin html - - -

GardenaSmartDevice

-
    - In combination with GardenaSmartBridge this FHEM Module controls the GardenaSmart Device using the GardenaCloud -

    - Once the Bridge device is created, the connected devices are automatically recognized and created in FHEM.
    - From now on the devices can be controlled and changes in the GardenaAPP are synchronized with the state and readings of the devices. - -


    - Readings -
      -
    • battery-charging - Indicator if the Battery is charged (0/1) or with newer Firmware (false/true)
    • -
    • battery-level - load percentage of the Battery
    • -
    • battery-rechargeable_battery_status - healthyness of the battery (out_of_operation/replace_now/low/ok)
    • -
    • device_info-category - category of device (mower/watering_computer)
    • -
    • device_info-last_time_online - timestamp of last radio contact
    • -
    • device_info-manufacturer - manufacturer
    • -
    • device_info-product - product type
    • -
    • device_info-serial_number - serial number
    • -
    • device_info-sgtin -
    • -
    • device_info-version - firmware version
    • -
    • firmware-firmware_command - firmware command (idle/firmware_cancel/firmware_upload/unsupported)
    • -
    • firmware-firmware_status - firmware status
    • -
    • firmware-firmware_update_start - indicator when a firmwareupload is started
    • -
    • firmware-firmware_upload_progress - progress indicator of firmware update
    • -
    • firmware-inclusion_status - inclusion status
    • -
    • internal_temperature-temperature - internal device temperature
    • -
    • mower-error - actual error message -
        -
      • no_message
      • -
      • outside_working_area
      • -
      • no_loop_signal
      • -
      • wrong_loop_signal
      • -
      • loop_sensor_problem_front
      • -
      • loop_sensor_problem_rear
      • -
      • trapped
      • -
      • upside_down
      • -
      • low_battery
      • -
      • empty_battery
      • -
      • no_drive
      • -
      • lifted
      • -
      • stuck_in_charging_station
      • -
      • charging_station_blocked
      • -
      • collision_sensor_problem_rear
      • -
      • collision_sensor_problem_front
      • -
      • wheel_motor_blocked_right
      • -
      • wheel_motor_blocked_left
      • -
      • wheel_drive_problem_right
      • -
      • wheel_drive_problem_left
      • -
      • cutting_system_blocked
      • -
      • invalid_sub_device_combination
      • -
      • settings_restored
      • -
      • electronic_problem
      • -
      • charging_system_problem
      • -
      • tilt_sensor_problem
      • -
      • wheel_motor_overloaded_right
      • -
      • wheel_motor_overloaded_left
      • -
      • charging_current_too_high
      • -
      • temporary_problem
      • -
      • guide_1_not_found
      • -
      • guide_2_not_found
      • -
      • guide_3_not_found
      • -
      • difficult_finding_home
      • -
      • guide_calibration_accomplished
      • -
      • guide_calibration_failed
      • -
      • temporary_battery_problem
      • -
      • battery_problem
      • -
      • alarm_mower_switched_off
      • -
      • alarm_mower_stopped
      • -
      • alarm_mower_lifted
      • -
      • alarm_mower_tilted
      • -
      • connection_changed
      • -
      • connection_not_changed
      • -
      • com_board_not_available
      • -
      • slipped
      • -
      -
    • -
    • mower-manual_operation - (0/1) or with newer Firmware (false/true)
    • -
    • mower-override_end_time - manual override end time
    • -
    • mower-source_for_next_start - source for the next start -
        -
      • no_source
      • -
      • mower_charging
      • -
      • completed_cutting_autotimer
      • -
      • week_timer
      • -
      • countdown_timer
      • -
      • undefined
      • -
      -
    • -
    • mower-status - mower state (see state)
    • -
    • mower-timestamp_next_start - timestamp of next scheduled start
    • -
    • radio-connection_status - state of connection
    • -
    • radio-quality - percentage of the radio quality
    • -
    • radio-state - radio state (bad/poor/good/undefined)
    • -
    • state - state of the mower -
        -
      • paused
      • -
      • ok_cutting
      • -
      • ok_searching
      • -
      • ok_charging
      • -
      • ok_leaving
      • -
      • wait_updating
      • -
      • wait_power_up
      • -
      • parked_timer
      • -
      • parked_park_selected
      • -
      • off_disabled
      • -
      • off_hatch_open
      • -
      • unknown
      • -
      • error
      • -
      • error_at_power_up
      • -
      • off_hatch_closed
      • -
      • ok_cutting_timer_overridden
      • -
      • parked_autotimer
      • -
      • parked_daily_limit_reached
      • -
      -
    • -
    -

    - - Attributes -
      -
    • readingValueLanguage - Change the Language of Readings (de,en/if not set the default is english and the global language is not set at german)
    • -
    • model -
    • -
    -

    - - set -
      -
    • winter_mode - awake | hibernate
    • -
    -
      -

      mower

      -
    • parkUntilFurtherNotice
    • -
    • parkUntilNextTimer
    • -
    • startOverrideTimer - (in minutes, 60 = 1h, 1440 = 24h, 4320 = 72h)
    • -
    • startResumeSchedule
    • -
    • startpoint enable|disable 1|2|3 - enables or disables one or more predefined start points
    • -
        -
      • set NAME startpoint enable 1
      • -
      • set NAME startpoint disable 3 enable 1
      • -
      -

      irrigation control

      -
    • resumeScheduleValve - start schedule irrigation on valve n
    • -
    • stopScheduleValve - stop schedule irrigation on valve n (Default: 2038-01-18T00:00:00.000Z) | optional params hours (now + hours)
    • -
    • closeAllValves - close all valves
    • -

      water control

      -
    • manualButtonTime - set manual time for button press (in minutes) 0 disable button
    • -
    • stopSchedule - stop schedule for now + n hours (Default: 2038-01-18T00:00:00.000Z)
    • -
    • resumeSchedule - resume schedule
    • -
    -
- -=end html -=begin html_DE - - -

GardenaSmartDevice

-
    - Zusammen mit dem Device GardenaSmartDevice stellt dieses FHEM Modul die Kommunikation zwischen der GardenaCloud und Fhem her. -

    - Wenn das GardenaSmartBridge Device erzeugt wurde, werden verbundene Geräte automatisch erkannt und in Fhem angelegt.
    - Von nun an können die eingebundenen Geräte gesteuert werden. Änderungen in der APP werden mit den Readings und dem Status syncronisiert. - -
-
-
    - Readings -
      -
    • battery-charging - Ladeindikator (0/1) oder mit neuerer Firmware (false/true)
    • -
    • battery-level - Ladezustand der Batterie in Prozent
    • -
    • battery-rechargeable_battery_status - Zustand der Batterie (Ausser Betrieb/Kritischer Batteriestand, wechseln Sie jetzt/Niedrig/oK)
    • -
    • device_info-category - Eigenschaft des Gerätes (Mäher/Bewässerungscomputer/Bodensensor)
    • -
    • device_info-last_time_online - Zeitpunkt der letzten Funkübertragung
    • -
    • device_info-manufacturer - Hersteller
    • -
    • device_info-product - Produkttyp
    • -
    • device_info-serial_number - Seriennummer
    • -
    • device_info-sgtin -
    • -
    • device_info-version - Firmware Version
    • -
    • firmware-firmware_command - Firmware Kommando (Nichts zu tun/Firmwareupload unterbrochen/Firmwareupload/nicht unterstützt)
    • -
    • firmware-firmware_status - Firmware Status
    • -
    • firmware-firmware_update_start - Firmwareupdate (0/1) oder mit neuerer Firmware (false/true)
    • -
    • firmware-firmware_upload_progress - Firmwareupdatestatus in Prozent
    • -
    • firmware-inclusion_status - Einbindungsstatus
    • -
    • internal_temperature-temperature - Interne Geräte Temperatur
    • -
    • mower-error - Aktuelle Fehler Meldung -
        -
      • Kein Fehler
      • -
      • Außerhalb des Arbeitsbereichs
      • -
      • Kein Schleifensignal
      • -
      • Falsches Schleifensignal
      • -
      • Problem Schleifensensor, vorne
      • -
      • Problem Schleifensensor, hinten
      • -
      • Eingeschlossen
      • -
      • Steht auf dem Kopf
      • -
      • Niedriger Batteriestand
      • -
      • Batterie ist leer
      • -
      • Kein Antrieb
      • -
      • Angehoben
      • -
      • Eingeklemmt in Ladestation
      • -
      • Ladestation blockiert
      • -
      • Problem Stoßsensor hinten
      • -
      • Problem Stoßsensor vorne
      • -
      • Radmotor rechts blockiert
      • -
      • Radmotor links blockiert
      • -
      • Problem Antrieb, rechts
      • -
      • Problem Antrieb, links
      • -
      • Schneidsystem blockiert
      • -
      • Fehlerhafte Verbindung
      • -
      • Standardeinstellungen
      • -
      • Elektronisches Problem
      • -
      • Problem Ladesystem
      • -
      • Kippsensorproblem
      • -
      • Rechter Radmotor überlastet
      • -
      • Linker Radmotor überlastet
      • -
      • Ladestrom zu hoch
      • -
      • Vorübergehendes Problem
      • -
      • SK 1 nicht gefunden
      • -
      • SK 2 nicht gefunden
      • -
      • SK 3 nicht gefunden
      • -
      • Problem die Ladestation zu finden
      • -
      • Kalibration des Suchkabels beendet
      • -
      • Kalibration des Suchkabels fehlgeschlagen
      • -
      • Kurzzeitiges Batterieproblem
      • -
      • Batterieproblem
      • -
      • Alarm! Mäher ausgeschalten
      • -
      • Alarm! Mäher gestoppt
      • -
      • Alarm! Mäher angehoben
      • -
      • Alarm! Mäher gekippt
      • -
      • Verbindung geändert
      • -
      • Verbindung nicht geändert
      • -
      • COM board nicht verfügbar
      • -
      • Rutscht
      • -
      -
    • -
    • mower-manual_operation - Manueller Betrieb (0/1) oder mit neuerer Firmware (false/true)
    • -
    • mower-override_end_time - Zeitpunkt wann der manuelle Betrieb beendet ist
    • -
    • mower-source_for_next_start - Grund für den nächsten Start -
        -
      • Kein Grund
      • -
      • Mäher wurde geladen
      • -
      • SensorControl erreicht
      • -
      • Wochentimer erreicht
      • -
      • Stoppuhr Timer
      • -
      • Undefiniert
      • -
      -
    • -
    • mower-status - Mäher Status (siehe state)
    • -
    • mower-timestamp_next_start - Zeitpunkt des nächsten geplanten Starts
    • -
    • radio-connection_status - Status der Funkverbindung
    • -
    • radio-quality - Indikator für die Funkverbindung in Prozent
    • -
    • radio-state - radio state (schlecht/schwach/gut/Undefiniert)
    • -
    • state - Staus des Mähers -
        -
      • Pausiert
      • -
      • Mähen
      • -
      • Suche Ladestation
      • -
      • Lädt
      • -
      • Mähen
      • -
      • Wird aktualisiert ...
      • -
      • Wird eingeschaltet ...
      • -
      • Geparkt nach Zeitplan
      • -
      • Geparkt
      • -
      • Der Mäher ist ausgeschaltet
      • -
      • Deaktiviert. Abdeckung ist offen oder PIN-Code erforderlich
      • -
      • Unbekannter Status
      • -
      • Fehler
      • -
      • Neustart ...
      • -
      • Deaktiviert. Manueller Start erforderlich
      • -
      • Manuelles Mähen
      • -
      • Geparkt durch SensorControl
      • -
      • Abgeschlossen
      • -
      -
    • -
    -

    - - Attribute -
      -
    • readingValueLanguage - Änderung der Sprache der Readings (de,en/wenn nichts gesetzt ist, dann Englisch es sei denn deutsch ist als globale Sprache gesetzt)
    • -
    • model -
    • -
    - - set -
      -
    • winter_mode - aufwäcken (awake)| winterschlaf (hibernate)
    • -
    -
      -

      mäher

      -
    • parkUntilFurtherNotice - Parken des Mähers unter Umgehung des Zeitplans
    • -
    • parkUntilNextTimer - Parken bis zum nächsten Zeitplan
    • -
    • startOverrideTimer - Manuelles mähen (in Minuten, 60 = 1h, 1440 = 24h, 4320 = 72h)
    • -
    • startResumeSchedule - Weiterführung des Zeitplans
    • -
    • startpoint enable|disable 1|2|3 - Aktiviert oder deaktiviert einen vordefinierten Startbereich
    • -
        -
      • set NAME startpoint enable 1
      • -
      • set NAME startpoint disable 3 enable 1
      • -
      -

      irrigation control

      -
    • resumeScheduleValve - Startet Bew&aauml;sserung am Ventil n nach Zeitplan
    • -
    • stopScheduleValve - Setzt Bew&aauml;sserung am Ventil n aus (Default: 2038-01-18T00:00:00.000Z) | Optionaler Parameter Stunden (Jetzt + Stunden)
    • -
    • closeAllValves - Stopt Bew&aauml;sserung an allen Ventilen
    • -

      water control

      -
    • manualButtonTime - setzt die Dauer für den manuellen Knopf (in Minuten) 0 Schaltet den Knopf aus
    • -
    • stopSchedule - Halte Zeitplan an für x Stunden - (Default: 2038-01-18T00:00:00.000Z)
    • -
    • resumeSchedule - Weiterführung des Zeitplans
    • -
    -
- -=end html_DE - -=for :application/json;q=META.json 74_GardenaSmartDevice.pm -{ - "abstract": "Modul to control GardenaSmart Devices", - "x_lang": { - "de": { - "abstract": "Modul zur Steuerung von Gardena Smart Geräten" - } - }, - "keywords": [ - "fhem-mod-device", - "fhem-core", - "Garden", - "Gardena", - "Smart" - ], - "release_status": "stable", - "license": "GPL_2", - "version": "v2.5.5", - "author": [ - "Marko Oldenburg " - ], - "x_fhem_maintainer": [ - "CoolTux" - ], - "x_fhem_maintainer_github": [ - "LeonGaultier" - ], - "prereqs": { - "runtime": { - "requires": { - "FHEM": 5.00918799, - "perl": 5.016, - "Meta": 0, - "JSON": 0, - "Time::Local": 0 - }, - "recommends": { - }, - "suggests": { - } - } - } -} -=end :application/json;q=META.json - -=cut +############################################################################### +# +# Developed with VSCodium and richterger perl plugin. +# +# (c) 2017-2022 Copyright: Marko Oldenburg (fhemdevelopment at cooltux dot net) +# All rights reserved +# +# Special thanks goes to comitters: +# - Michael (mbrak) Thanks for Commandref +# - Christian (zife) Thanks for Commandref +# - Matthias (Kenneth) Thanks for Wiki entry +# - BioS Thanks for predefined start points Code +# - fettgu Thanks for Debugging Irrigation Control data flow +# - Sebastian (BOFH) Thanks for new Auth Code after API Change +# +# +# This script is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# any later version. +# +# The GNU General Public License can be found at +# http://www.gnu.org/copyleft/gpl.html. +# A copy is found in the textfile GPL.txt and important notices to the license +# from the author is found in LICENSE.txt distributed with these scripts. +# +# This script is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# +# $Id$ +# +############################################################################### +## +## +## Das JSON Modul immer in einem eval aufrufen +# $data = eval{decode_json($data)}; +# +# if($@){ +# Log3($SELF, 2, "$TYPE ($SELF) - error while request: $@"); +# +# readingsSingleUpdate($hash, "state", "error", 1); +# +# return; +# } +# +# +###### Wichtige Notizen +# +# apt-get install libio-socket-ssl-perl +# http://www.dxsdata.com/de/2016/07/php-class-for-gardena-smart-system-api/ +# +## +## + +## unserer packagename +package FHEM::GardenaSmartDevice; +use GPUtils qw(GP_Import GP_Export); + +use strict; +use warnings; +use POSIX; +use FHEM::Meta; +use Time::Local; +use Time::Piece; +use Time::Seconds; + +# try to use JSON::MaybeXS wrapper +# for chance of better performance + open code +eval { + require JSON::MaybeXS; + import JSON::MaybeXS qw( decode_json encode_json ); + 1; +} or do { + + # try to use JSON wrapper + # for chance of better performance + eval { + # JSON preference order + local $ENV{PERL_JSON_BACKEND} = + 'Cpanel::JSON::XS,JSON::XS,JSON::PP,JSON::backportPP' + unless ( defined( $ENV{PERL_JSON_BACKEND} ) ); + + require JSON; + import JSON qw( decode_json encode_json ); + 1; + } or do { + + # In rare cases, Cpanel::JSON::XS may + # be installed but JSON|JSON::MaybeXS not ... + eval { + require Cpanel::JSON::XS; + import Cpanel::JSON::XS qw(decode_json encode_json); + 1; + } or do { + + # In rare cases, JSON::XS may + # be installed but JSON not ... + eval { + require JSON::XS; + import JSON::XS qw(decode_json encode_json); + 1; + } or do { + + # Fallback to built-in JSON which SHOULD + # be available since 5.014 ... + eval { + require JSON::PP; + import JSON::PP qw(decode_json encode_json); + 1; + } or do { + + # Fallback to JSON::backportPP in really rare cases + require JSON::backportPP; + import JSON::backportPP qw(decode_json encode_json); + 1; + }; + }; + }; + }; +}; + +## Import der FHEM Funktionen +#-- Run before package compilation +BEGIN { + + # Import from main context + GP_Import( + qw(readingsSingleUpdate + readingsBulkUpdate + readingsBulkUpdateIfChanged + readingsBeginUpdate + readingsEndUpdate + Log3 + CommandAttr + AttrVal + ReadingsVal + readingFnAttributes + AssignIoPort + modules + IOWrite + defs + makeDeviceName) + ); +} + +#-- Export to main context with different name +GP_Export( + qw( + Initialize + ) +); + +sub Initialize { + my $hash = shift; + + $hash->{Match} = '^{"id":".*'; + + $hash->{SetFn} = \&Set; + $hash->{DefFn} = \&Define; + $hash->{UndefFn} = \&Undef; + $hash->{ParseFn} = \&Parse; + + $hash->{AttrFn} = \&Attr; + $hash->{AttrList} = + "readingValueLanguage:de,en " + . "model:watering_computer,sensor,sensor2,mower,ic24,power,electronic_pressure_pump " + . "extendedState:0,1 " + . "IODev " + . $readingFnAttributes; + $hash->{parseParams} = 1; + + return FHEM::Meta::InitMod( __FILE__, $hash ); +} + +sub Define { + my $hash = shift // return; + my $aArg = shift // return; + + return $@ unless ( FHEM::Meta::SetInternals($hash) ); + use version 0.60; our $VERSION = FHEM::Meta::Get( $hash, 'version' ); + + return + "too few parameters: define GardenaSmartDevice " + if ( scalar( @{$aArg} ) < 3 ); + + my $name = $aArg->[0]; + 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} = ''; + # Electroni Pressure Pump + $hash->{helper}{operating_mode_id} = ''; + $hash->{helper}{leakage_detection_id} = ''; + $hash->{helper}{turn_on_pressure_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} = ''; + + CommandAttr( undef, + "$name IODev $modules{GardenaSmartBridge}{defptr}{BRIDGE}->{NAME}" ) + if ( AttrVal( $name, 'IODev', 'none' ) eq 'none' ); + + my $iodev = AttrVal( $name, 'IODev', 'none' ); + + AssignIoPort( $hash, $iodev ) if ( !$hash->{IODev} ); + + if ( defined( $hash->{IODev}->{NAME} ) ) { + Log3 $name, 3, "GardenaSmartDevice ($name) - I/O device is " + . $hash->{IODev}->{NAME}; + } + else { + Log3 $name, 1, "GardenaSmartDevice ($name) - no I/O device"; + } + + $iodev = $hash->{IODev}->{NAME}; + + my $d = $modules{GardenaSmartDevice}{defptr}{$deviceId}; + + return +"GardenaSmartDevice device $name on GardenaSmartBridge $iodev already defined." + if ( defined($d) + && $d->{IODev} == $hash->{IODev} + && $d->{NAME} ne $name ); + + CommandAttr( undef, $name . ' room GardenaSmart' ) + if ( AttrVal( $name, 'room', 'none' ) eq 'none' ); + + CommandAttr( undef, $name . ' model ' . $category ) + if ( AttrVal( $name, 'model', 'none' ) eq 'none' ); + + Log3 $name, 3, +"GardenaSmartDevice ($name) - defined GardenaSmartDevice with DEVICEID: $deviceId"; + readingsSingleUpdate( $hash, 'state', 'initialized', 1 ); + + $modules{GardenaSmartDevice}{defptr}{$deviceId} = $hash; + + return; +} + +sub Undef { + my $hash = shift; + my $arg = shift; + + my $name = $hash->{NAME}; + my $deviceId = $hash->{DEVICEID}; + + delete $modules{GardenaSmartDevice}{defptr}{$deviceId}; + + return; +} + +sub Attr { + + my ( $cmd, $name, $attrName, $attrVal ) = @_; + my $hash = $defs{$name}; + + return; +} + +sub Set { + my $hash = shift // return; + my $aArg = shift // return; + + my $name = shift @$aArg; + my $cmd = shift @$aArg + // return qq{"set $name" needs at least one argument}; + + my $payload; + my $abilities; + my $service_id; + my $mainboard_version = + ReadingsVal( $name, 'mower_type-mainboard_version', 0.0 ); + + my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat, + $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) = localtime(time); + + my $timezone_offset = $Sommerzeit ? 0 : ( Time::Piece->new )->tzoffset; + + #set default abilitie ... overwrite in cmd to change + $abilities = 'mower' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' ); + $abilities = 'watering' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' + || AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' ); + $abilities = 'power' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' ); + $abilities = 'watering' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' ); + + ### mower + # service_id (eco, parkuntilfurhternotice, startpoints) + if ( lc $cmd eq 'parkuntilfurthernotice' ) { + $payload = '"name":"park_until_further_notice"'; + if ( $mainboard_version > 10.30 ) { + $payload = +' "settings":{"name":"schedules_paused_until","value":"2038-01-18T00:00:00.000Z","device":"' + . $hash->{DEVICEID} . '"}'; + $abilities = 'mower_settings'; + $service_id = $hash->{helper}{schedules_paused_until_id}; + } + } + elsif ( lc $cmd eq 'parkuntilnexttimer' ) { + $payload = '"name":"park_until_next_timer"'; + if ( $mainboard_version > 10.30 ) { + $payload = '"properties":{"name":"mower_timer","value":0}'; + $abilities = 'mower_timer'; + } + } + elsif ( lc $cmd eq 'startresumeschedule' ) { + $payload = '"name":"start_resume_schedule"'; + if ( $mainboard_version > 10.30 ) { + $payload = +' "settings":{"name":"schedules_paused_until","value":"","device":"' + . $hash->{DEVICEID} . '"}'; + $abilities = 'mower_settings'; + $service_id = $hash->{helper}{schedules_paused_until_id}; + } + } + elsif ( lc $cmd eq 'startoverridetimer' ) { + $payload = '"name":"start_override_timer","parameters":{"duration":' + . $aArg->[0] * 60 . '}'; + if ( $mainboard_version > 10.30 ) { + $payload = '"properties":{"name":"mower_timer","value":' + . $aArg->[0] * 60 . '}'; + $abilities = 'mower_timer'; + } + + } + elsif ( lc $cmd eq 'startpoint' ) { + my $err; + ( $err, $payload, $abilities ) = + SetPredefinedStartPoints( $hash, $aArg ); + $service_id = $hash->{helper}{STARTINGPOINTID}; + return $err if ( defined($err) ); + } + elsif ( lc $cmd eq 'eco' ) { + $payload = + '"settings": {"name": "eco_mode", "value": ' + . $aArg->[0] + . ', "device": "' + . $hash->{DEVICEID} . '"}'; + $abilities = 'mower_settings' if ( $mainboard_version > 10.30 ); + $service_id = $hash->{helper}{eco_mode_id}; + +#$abilities['service_id'] = $hash->{helper}{SCHEDULESID} if ( $mainboard_version > 10.30 ); + } + ### electronic_pressure_pump + # elsif ( lc $cmd eq 'pumptimer' ) { + # $payload = + # '"name":"pump_manual_watering_timer","parameters":{"duration":' + # . $aArg->[0] . '}'; + # } + ### watering_computer & electronic pump + elsif ( lc $cmd eq 'manualoverride' ) { + $payload = + '"properties":{"name":"watering_timer_1' + . '","value":{"state":"manual","duration":' + . $aArg->[0] * 60 + . ',"valve_id":1}}'; + } + elsif ( lc $cmd eq 'manualbuttontime' ) { + $service_id = $hash->{helper}{button_config_time_id}; + $payload = + '"properties":{"name":"button_config_time",' + . '"value":' + . $aArg->[0] * 60 + . ',"timestamp":"2021-05-26T19:06:23.680Z"' + . ',"at_bound":null,"unit":"seconds","ability":"' + . $service_id . '"}'; + $abilities = 'watering_button_config'; + } + elsif ( $cmd =~ m{\AcancelOverride}xms ) { + + my $valve_id = 1; + + if ( $cmd =~ m{\AcancelOverrideValve(\d)\z}xms ) { + $valve_id = $1; + } + + $payload = + '"properties":{"name":"watering_timer_' + . $valve_id + . '","value":{"state":"idle","duration":' + . 0 + . ',"valve_id":' + . $valve_id . '}}'; + } + elsif ( $cmd =~ /.*Schedule$/ ) { + my $duration = ( + ( + defined( $aArg->[0] ) + ? ( + ( + ( Time::Piece->new ) + + ( ONE_HOUR * $aArg->[0] ) - + $timezone_offset + )->datetime + ) + . '.000Z' + : '2038-01-18T00:00:00.000Z' + ) + ); + + $abilities = 'wateringcomputer_settings'; + $service_id = $hash->{helper}->{'schedules_paused_until_id'}; + $payload = + '"settings":{"name":"schedules_paused_until"' + . ', "value":"' + . ( $cmd eq 'resumeSchedule' ? '' : $duration ) + . '","device":"' + . $hash->{DEVICEID} . '"}'; + } + elsif ( lc $cmd eq 'on' || lc $cmd eq 'off' || lc $cmd eq 'on-for-timer' ) { + my $val = ( + scalar( !@$aArg == 0 ) && ref($aArg) eq 'ARRAY' + ? $aArg->[0] * 60 + : lc $cmd + ); + + $payload = + '"properties":{"name":"power_timer", "value":"' . $val . '"}'; + } + ### Watering ic24 + elsif ( $cmd =~ m{\AmanualDurationValve\d\z}xms ) { + my $valve_id; + + if ( $cmd =~ m{\AmanualDurationValve(\d)\z}xms ) { + $valve_id = $1; + } + + $payload = + '"properties":{"name":"watering_timer_' + . $valve_id + . '","value":{"state":"manual","duration":' + . $aArg->[0] * 60 + . ',"valve_id":' + . $valve_id . '}}'; + } + elsif ( $cmd eq 'closeAllValves' ) { + $payload = '"name":"close_all_valves","parameters":{}'; + } + elsif ( $cmd =~ /.*ScheduleValve$/ ) { + my $valve_id = $aArg->[0]; + my $duration = ( + ( + defined( $aArg->[1] ) + ? ( + ( + ( Time::Piece->new ) + + ( ONE_HOUR * $aArg->[1] ) - + $timezone_offset + )->datetime + ) + . '.000Z' + : '2038-01-18T00:00:00.000Z' + ) + ); + + $abilities = 'irrigation_settings'; + $service_id = + $hash->{helper}->{ 'schedules_paused_until_' . $valve_id . '_id' }; + $payload = + '"settings":{"name":"schedules_paused_until_' + . $valve_id + . '", "value":"' + . ( $cmd eq 'resumeScheduleValve' ? '' : $duration ) + . '","device":"' + . $hash->{DEVICEID} . '"}'; + } + ### Watering_pressure_pump + elsif ( lc $cmd eq 'operating_mode') { + my $op_mode = $aArg->[0]; + $payload = '"settings":{"name":"operating_mode",' + .'"value":"'.$op_mode.'",' + .'"device":"' + . $hash->{DEVICEID}.'"}'; + $abilities = 'watering_pressure_pump_settings'; + $service_id = $hash->{helper}->{ 'operating_mode_id' }; + } + elsif ( lc $cmd eq 'leakage_detection') { + my $leakdetection_mode = $aArg->[0]; + $payload = '"settings":{"name":"leakage_detection",' + .'"value":"'.$leakdetection_mode.'",' + .'"device":"' + . $hash->{DEVICEID}.'"}'; + $abilities = 'watering_pressure_pump_settings'; + $service_id = $hash->{helper}->{ 'leakage_detection_id' }; + } + elsif ( lc $cmd eq 'turn_on_pressure') { + my $turnonpressure = $aArg->[0]; + $payload = '"settings":{"name":"turn_on_pressure",' + .'"value":"'.$turnonpressure.'",' + .'"device":"' + . $hash->{DEVICEID}.'"}'; + $abilities = 'watering_pressure_pump_settings'; + $service_id = $hash->{helper}->{ 'turn_on_pressure_id' }; + } + elsif ( lc $cmd eq 'resetvalveerrors') { + $payload = '"name":"reset_valve_errors",' + .' "parameters": {}'; + $abilities = 'error'; + } + + ### Sensors + elsif ( lc $cmd eq 'refresh' ) { + + my $sensname = $aArg->[0]; + if ( lc $sensname eq 'temperature' ) { + if ( ReadingsVal( $name, 'device_info-category', 'sensor' ) eq + 'sensor' ) + { + $payload = '"name":"measure_ambient_temperature"'; + $abilities = 'ambient_temperature'; + } + else { + $payload = '"name":"measure_soil_temperature"'; + $abilities = 'soil_temperature'; + } + } + elsif ( lc $sensname eq 'light' ) { + $payload = '"name":"measure_light"'; + $abilities = 'light'; + + } + elsif ( lc $sensname eq 'humidity' ) { + $payload = '"name":"measure_soil_humidity"'; + $abilities = 'humidity'; + } + } + ## winter sleep + elsif ( lc $cmd eq 'winter_mode' ) { + $payload = + '"settings":{"name":"winter_mode","value":"' + . $aArg->[0] + . '","device":"' + . $hash->{DEVICEID} . '"}'; + $abilities = 'winter_settings'; + $service_id = $hash->{helper}->{'winter_mode_id'}; + } + else { + + my $list = ''; + + $list .= +'parkUntilFurtherNotice:noArg parkUntilNextTimer:noArg startResumeSchedule:noArg startOverrideTimer:slider,0,1,240 startpoint' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' ); + + $list .= +'manualOverride:slider,1,1,59 cancelOverride:noArg resumeSchedule:noArg stopSchedule manualButtonTime:slider,0,2,100' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' ); + + + $list .= 'manualOverride:slider,1,1,90 cancelOverride:noArg operating_mode:automatic,scheduled leakage_detection:watering,washing_machine,domestic_water_supply,off turn_on_pressure:slider,2,0.2,3.0,1 resetValveErrors:noArg' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' ); + + $list .= +'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.?/ ); + + # add light for old sensors + $list .= ',light' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'sensor' + && ReadingsVal( $name, 'device_info-category', 'unknown' ) eq + 'sensor' ); + + $list .= 'on:noArg off:noArg on-for-timer:slider,0,1,720' + if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' ); + + # all devices has abilitie to fall a sleep + $list .= ' winter_mode:awake,hibernate'; + return "Unknown argument $cmd, choose one of $list"; + } + + $hash->{helper}{deviceAction} = $payload; + readingsSingleUpdate( $hash, "state", "send command to gardena cloud", 1 ); + + IOWrite( $hash, $payload, $hash->{DEVICEID}, $abilities, $service_id ); + Log3 $name, 4, +"GardenaSmartBridge ($name) - IOWrite: $payload $hash->{DEVICEID} $abilities IODevHash=$hash->{IODev}"; + + return; +} + +sub Parse { + my $io_hash = shift; + my $json = shift; + + my $name = $io_hash->{NAME}; + + my $decode_json = eval { decode_json($json) }; + if ($@) { + Log3 $name, 3, + "GardenaSmartDevice ($name) - JSON error while request: $@"; + } + + Log3 $name, 4, "GardenaSmartDevice ($name) - ParseFn was called"; + Log3 $name, 4, "GardenaSmartDevice ($name) - JSON: $json"; + + if ( defined( $decode_json->{id} ) ) { + + my $deviceId = $decode_json->{id}; + + if ( my $hash = $modules{GardenaSmartDevice}{defptr}{$deviceId} ) { + my $name = $hash->{NAME}; + + WriteReadings( $hash, $decode_json ); + Log3 $name, 4, + "GardenaSmartDevice ($name) - find logical device: $hash->{NAME}"; + + return $hash->{NAME}; + + } + else { + + Log3 $name, 3, + "GardenaSmartDevice ($name) - autocreate new device " + . makeDeviceName( $decode_json->{name} ) + . " with deviceId $decode_json->{id}, model $decode_json->{category}"; + return + "UNDEFINED " + . makeDeviceName( $decode_json->{name} ) + . " GardenaSmartDevice $decode_json->{id} $decode_json->{category}"; + } + } + + return; +} + +sub WriteReadings { + my $hash = shift; + my $decode_json = shift; + + 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); + + do { + + if ( + ref( $decode_json->{abilities}[$abilities]{properties} ) eq "ARRAY" + && scalar( @{ $decode_json->{abilities}[$abilities]{properties} } ) + > 0 ) + { + for my $propertie ( + @{ $decode_json->{abilities}[$abilities]{properties} } ) + { + if ( + exists( $decode_json->{abilities}[$abilities]{name} ) + && ( $decode_json->{abilities}[$abilities]{name} eq + 'watering' ) + ) + { + + if ( $propertie->{name} eq 'button_config_time' ) { + if ( $hash->{helper}{ $propertie->{name} . '_id' } ne + $decode_json->{abilities}[$abilities]{id} ) + { + $hash->{helper}{ $propertie->{name} . '_id' } = + $decode_json->{abilities}[$abilities]{id}; + } + readingsBulkUpdateIfChanged( + $hash, + 'manualButtonTime', + ( + RigReadingsValue( + $hash, $propertie->{value} / 60 + ) + ) + ); + next; + } + } + + readingsBulkUpdateIfChanged( + $hash, + $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name}, + (defined ($propertie->{value} ) eq '') ? RigReadingsValue( $hash, 'n/a') : RigReadingsValue( $hash, $propertie->{value} ) + ) + if ( exists( $propertie->{value} ) + && $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} ne 'radio-quality' + && $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} ne 'battery-level' + && $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} ne 'internal_temperature-temperature' + && $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} ne 'ambient_temperature-temperature' + && $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} ne 'soil_temperature-temperature' + && $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} ne 'humidity-humidity' + && $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} ne 'light-light' + && ref( $propertie->{value} ) ne "HASH" ); + + readingsBulkUpdateIfChanged( + $hash, + $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name}, + RigReadingsValue( $hash, $propertie->{value} ) + ) + if ( + defined( $propertie->{value} ) + && ( $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} eq 'radio-quality' + || $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} eq 'battery-level' + || $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} eq + 'internal_temperature-temperature' + || $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} eq + 'ambient_temperature-temperature' + || $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} eq 'soil_temperature-temperature' + || $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} eq 'humidity-humidity' + || $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} eq 'light-light' ) + ); + + readingsBulkUpdateIfChanged( + $hash, + $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} + . '_timestamp', + Time::Piece->strptime( + RigReadingsValue( $hash, $propertie->{timestamp} ), + "%Y-%m-%d %H:%M:%S" )->strftime('%s') + + ) + if ( + defined( $propertie->{value} ) + && ( $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} eq 'mower_timer-mower_timer' ) + ); + + readingsBulkUpdateIfChanged( + $hash, + $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name}, + join( ',', @{ $propertie->{value} } ) + ) + if ( defined( $propertie->{value} ) + && $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} eq 'ic24-valves_connected' ); + + readingsBulkUpdateIfChanged( + $hash, + $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name}, + join( ',', @{ $propertie->{value} } ) + ) + if ( defined( $propertie->{value} ) + && $decode_json->{abilities}[$abilities]{name} . '-' + . $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} } ) { + if ( ref( $v ) ne "HASH" ) { + readingsBulkUpdate( + $hash, + $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} . '_' + . $r, + RigReadingsValue( $hash, $v ) + ); + } else { + while ( my ( $i_r, $i_v ) = each %{ $v } ) { + readingsBulkUpdate( + $hash, + $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} . '_' + . $r . '_' . $i_r, + RigReadingsValue( $hash, $i_v ) + ); + } + } + } + } + # ic24 and other watering devices calc irrigation left in sec + readingsBulkUpdateIfChanged( + $hash, + $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} + . '_irrigation_left', + ( $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) : 0 + ) + if ( defined( $propertie->{value} ) + && $decode_json->{abilities}[$abilities]{name} eq 'watering' + ); + } + } + + $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; 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 + $event_id++; # event id + + while ( my ( $r, $v ) = each %{ $event_schedules } ) { + readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_' + . $event_id + . '_valve_' + . $valve_id + . '_' + . $r, + $v) if (ref($v) ne 'HASH' ); + readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_' + . $event_id + . '_valve_' + . $valve_id + . '_' + . $v->{type}, + join(',', @ { $v->{weekdays}}) ) if (ref($v) eq 'HASH' ); + }; + }; + + }; # fi scheduled_events + + my $winter_mode; + + do { +#Log3 $name, 1, "Settings pro Device : ".$decode_json->{settings}[$settings]{name}; +#Log3 $name, 1, " - KEIN ARRAY" if ( ref( $decode_json->{settings}[$settings]{value} ) ne "ARRAY"); +#Log3 $name, 1, " - IST ARRAY" if ( ref( $decode_json->{settings}[$settings]{value} ) eq "ARRAY"); + + if ( + exists( $decode_json->{settings}[$settings]{name} ) + && ( $decode_json->{settings}[$settings]{name} =~ + /schedules_paused_until_?\d?$/ + || $decode_json->{settings}[$settings]{name} eq 'eco_mode' + || $decode_json->{settings}[$settings]{name} eq 'winter_mode' + || $decode_json->{settings}[$settings]{name} eq 'operating_mode' + || $decode_json->{settings}[$settings]{name} eq 'leakage_detection' + || $decode_json->{settings}[$settings]{name} eq 'turn_on_pressure' ) + ) + { + if ( $hash->{helper} + { $decode_json->{settings}[$settings]{name} . '_id' } ne + $decode_json->{settings}[$settings]{id} ) + { + $hash->{helper} + { $decode_json->{settings}[$settings]{name} . '_id' } = + $decode_json->{settings}[$settings]{id}; + } + # check watering controler single schedules pause until + if ( $decode_json->{settings}[$settings]{name} eq 'schedules_paused_until' ) { + 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 + # check if empty, clear scheduling-scheduled_watering_next_start_x + readingsBulkUpdateIfChanged( $hash, 'scheduling-'.$decode_json->{settings}[$settings]{name}, + $decode_json->{settings}[$settings]{value} ); + # CommandAttr( undef, $name . " scheduling-scheduled_watering_next_start_") if ($decode_json->{settings}[$settings]{value} eq '' ) + } +#TODO: Readings und Setter ?! + # save electronid pressure pump settings as readings + if ( $decode_json->{settings}[$settings]{name} eq 'operating_mode' + || $decode_json->{settings}[$settings]{name} eq 'leakage_detection' + || $decode_json->{settings}[$settings]{name} eq 'turn_on_pressure' ) { + readingsBulkUpdateIfChanged( $hash, $decode_json->{settings}[$settings]{name}, + $decode_json->{settings}[$settings]{value} ); + + } + # save winter mode as reading + if ( $decode_json->{settings}[$settings]{name} eq 'winter_mode' ) { + readingsBulkUpdateIfChanged( $hash, 'winter_mode', + $decode_json->{settings}[$settings]{value} ); + + $winter_mode = $decode_json->{settings}[$settings]{value}; + } + } + + if ( defined( $decode_json->{settings}[$settings]{name} ) + && $decode_json->{settings}[$settings]{name} eq 'valve_names' + && 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'}"; + 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' ) + { + #save the startingpointid needed to update the startingpoints + if ( $hash->{helper}{STARTINGPOINTID} ne + $decode_json->{settings}[$settings]{id} ) + { + $hash->{helper}{STARTINGPOINTID} = + $decode_json->{settings}[$settings]{id}; + } + + $hash->{helper}{STARTINGPOINTS} = + '{ "name": "starting_points", "value": ' + . encode_json( $decode_json->{settings}[$settings]{value} ) . '}'; + my $startpoint_cnt = 0; + + for my $startingpoint ( + @{ $decode_json->{settings}[$settings]{value} } ) + { + $startpoint_cnt++; + readingsBulkUpdateIfChanged( + $hash, + 'startpoint-' . $startpoint_cnt . '-enabled', + $startingpoint->{enabled} + ); + } + } + + $settings--; + } while ( $settings >= 0 ); + + if ( $winter_mode ne 'hibernate' ) { + setState($hash); + } + else { + readingsBulkUpdate( $hash, 'state', + RigReadingsValue( $hash, 'hibernate' ) ); + } + + readingsEndUpdate( $hash, 1 ); + + Log3 $name, 4, "GardenaSmartDevice ($name) - readings was written"; + + return; +} + +sub setState { + my $hash = shift; + my $name = $hash->{NAME}; + + my $online_state = + ReadingsVal( $name, 'device_info-connection_status', 'unknown' ); + + #online state mower + readingsBulkUpdate( $hash, 'state', + $online_state eq 'online' + ? ReadingsVal( $name, 'mower-status', 'readingsValError' ) + : 'offline' ) + if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' ); + + # ic24 / wc / electronic pump + + if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' + || AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' + || 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 = ''; + my $error_type = 'ok'; + 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 ); + ## set error type (pumpe required) + $error_type = ReadingsVal( $name, 'error-valve_error_'.$_.'_type', 'ok' ) if (ReadingsVal( $name, 'error-valve_error_'.$_.'_type', 'ok' ) ne 'ok'); + ## 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 ) ); + + # 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, 5, "[DEBUG] - process: $processed_item"; + Log3 $name, 5, "[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, 5, "[DEBUG] - next_start: empty "; + Log3 $name, 5, "[DEBUG] - empty pro item ".Time::Piece->strptime( $processed_item, "%Y-%m-%d %H:%M:%S"); + Log3 $name, 5, "[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:%S") + < Time::Piece->strptime( $nearst_irrigation, "%Y-%m-%d %H:%M:%S") + && $has_schedule + && Time::Piece->strptime( $processed_item, "%Y-%m-%d %H:%M:%S") + > Time::Piece->new + ) + } else { + $nearst_irrigation = ReadingsVal($name, 'scheduling-scheduled_watering_next_start', ''); + } + Log3 $name, 5, "[DEBUG] - choosed nearst: $nearst_irrigation"; + + } # for + # override state 4 extendedstates + if ( AttrVal( $name, "extendedState", 0 ) == 1) { + 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)); + } # /for + } else { + $state_string .= RigReadingsValue($hash, 'closed'); + } + $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 + { + + } + ' ) + if ( AttrVal( $name, 'stateFormat', 'none' ) eq 'none' ); + } else { + Log3 $name, 5, "[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_schedule + && $nearst_irrigation ne '2999-12-12 12:00') + # zeitplan aktiv + # ? ( $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 + : (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') + ; + # state offline | override + $state_string = 'offline' if ($online_state eq 'offline'); + $state_string = ( $error_type ne 'ok' ) ? $error_type : $state_string; + + } + readingsBulkUpdate( + $hash, 'state', RigReadingsValue( $hash, $state_string ) ); + } + + # Sensor / Sensor 2 + if ( AttrVal( $name, 'model', 'unknown' ) =~ /sensor.?/ ) { + my $state_string = + ( ReadingsVal( $name, 'device_info-category', 'unknown' ) eq + 'sensor' ) + ? 'T: ' + . ReadingsVal( $name, 'ambient_temperature-temperature', + 'readingsValError' ) + . '°C, ' + : 'T: ' + . ReadingsVal( $name, 'soil_temperature-temperature', + 'readingsValError' ) + . '°C, '; + $state_string .= 'H: ' + . ReadingsVal( $name, 'humidity-humidity', 'readingsValError' ) . '%'; + $state_string .= ', L: ' + . ReadingsVal( $name, 'light-light', 'readingsValError' ) . 'lux' + if ( ReadingsVal( $name, 'device_info-category', 'unknown' ) eq + 'sensor' ); + +# if ( $online_state eq 'offline') { +# readingsBulkUpdate( $hash, 'humidity-humidity', '-1' ); +# readingsBulkUpdate( $hash, 'ambient_temperature-temperature', '-1' ) if (ReadingsVal($name, 'device_info-category', 'unknown') eq 'sensor'); +# readingsBulkUpdate( $hash, 'light-light', '-1' ) if (ReadingsVal($name, 'device_info-category', 'unknown') eq 'sensor'); +# } + #online state sensor I II + readingsBulkUpdate( $hash, 'state', + $online_state eq 'online' ? RigReadingsValue( $hash, $state_string) : RigReadingsValue( $hash, 'offline') ); + } + + readingsBulkUpdate( $hash, 'state', + ReadingsVal( $name, 'power-power_timer', 'no info from power-timer' ) ) + if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' ); + + return; +} + +################################## +################################## +#### my little helpers ########### + +sub ReadingLangGerman { + my $hash = shift; + my $readingValue = shift; + + my $name = $hash->{NAME}; + my %langGermanMapp = ( + 'ok_cutting' => 'mähen', + 'paused' => 'pausiert', + 'ok_searching' => 'suche Ladestation', + 'ok_charging' => 'lädt', + 'ok_leaving' => 'unterwegs zum Startpunkt', + 'wait_updating' => 'wird aktualisiert ...', + 'wait_power_up' => 'wird eingeschaltet ...', + 'parked_timer' => 'geparkt nach Zeitplan', + 'parked_park_selected' => 'geparkt', + 'off_disabled' => 'der Mäher ist ausgeschaltet', + 'off_hatch_open' => 'deaktiviert. Abdeckung ist offen oder PIN-Code erforderlich', + 'unknown' => 'unbekannter Status', + 'error' => 'Fehler', + 'error_at_power_up' => 'Neustart ...', + 'off_hatch_closed' => 'Deaktiviert. Manueller Start erforderlich', + 'ok_cutting_timer_overridden' => 'manuelles mähen', + 'parked_autotimer' => 'geparkt durch SensorControl', + 'parked_daily_limit_reached' => 'abgeschlossen', + 'no_message' => 'kein Fehler', + 'outside_working_area' => 'außerhalb des Arbeitsbereichs', + 'no_loop_signal' => 'kein Schleifensignal', + 'wrong_loop_signal' => 'falsches Schleifensignal', + 'loop_sensor_problem_front' => 'Problem Schleifensensor, vorne', + 'loop_sensor_problem_rear' => 'Problem Schleifensensor, hinten', + 'trapped' => 'eingeschlossen', + 'upside_down' => 'steht auf dem Kopf', + 'low_battery' => 'niedriger Batteriestand', + 'empty_battery' => 'Batterie leer', + 'no_drive' => 'fährt nicht', + 'lifted' => 'angehoben', + 'stuck_in_charging_station' => 'eingeklemmt in Ladestation', + 'charging_station_blocked' => 'Ladestation blockiert', + 'collision_sensor_problem_rear' => 'Problem Stoßsensor hinten', + 'collision_sensor_problem_front' => 'Problem Stoßsensor vorne', + 'wheel_motor_blocked_right' => 'Radmotor rechts blockiert', + 'wheel_motor_blocked_left' => 'Radmotor links blockiert', + 'wheel_drive_problem_right' => 'Problem Antrieb, rechts', + 'wheel_drive_problem_left' => 'Problem Antrieb, links', + 'cutting_system_blocked' => 'Schneidsystem blockiert', + 'invalid_sub_device_combination' => 'fehlerhafte Verbindung', + 'settings_restored' => 'Standardeinstellungen', + 'electronic_problem' => 'elektronisches Problem', + 'charging_system_problem' => 'Problem Ladesystem', + 'tilt_sensor_problem' => 'Kippsensor Problem', + 'wheel_motor_overloaded_right' => 'rechter Radmotor überlastet', + 'wheel_motor_overloaded_left' => 'linker Radmotor überlastet', + 'charging_current_too_high' => 'Ladestrom zu hoch', + 'temporary_problem' => 'vorübergehendes Problem', + 'guide_1_not_found' => 'SK 1 nicht gefunden', + 'guide_2_not_found' => 'SK 2 nicht gefunden', + 'guide_3_not_found' => 'SK 3 nicht gefunden', + 'difficult_finding_home' => 'Problem die Ladestation zu finden', + 'guide_calibration_accomplished' => 'Kalibrierung des Suchkabels beendet', + 'guide_calibration_failed' => 'Kalibrierung des Suchkabels fehlgeschlagen', + 'temporary_battery_problem' => 'kurzzeitiges Batterieproblem', + 'battery_problem' => 'Batterieproblem', + 'alarm_mower_switched_off' => 'Alarm! Mäher ausgeschalten', + 'alarm_mower_stopped' => 'Alarm! Mäher gestoppt', + 'alarm_mower_lifted' => 'Alarm! Mäher angehoben', + 'alarm_mower_tilted' => 'Alarm! Mäher gekippt', + 'connection_changed' => 'Verbindung geändert', + 'connection_not_changed' => 'Verbindung nicht geändert', + 'com_board_not_available' => 'COM Board nicht verfügbar', + 'slipped' => 'rutscht', + 'out_of_operation' => 'ausser Betrieb', + 'replace_now' => 'kritischer Batteriestand, wechseln Sie jetzt', + 'low' => 'niedrig', + 'ok' => 'ok', + 'no_source' => 'ok', + 'mower_charging' => 'Mäher wurde geladen', + 'completed_cutting_autotimer' => 'Sensor Control erreicht', + 'week_timer' => 'Wochentimer erreicht', + 'countdown_timer' => 'Stoppuhr Timer', + 'undefined' => 'unklar', + 'unknown' => 'unklar', + 'status_device_unreachable' => 'Gerät ist nicht in Reichweite', + 'status_device_alive' => 'Gerät ist in Reichweite', + 'bad' => 'schlecht', + 'poor' => 'schwach', + 'good' => 'gut', + 'undefined' => 'unklar', + 'idle' => 'nichts zu tun', + 'firmware_cancel' => 'Firmwareupload unterbrochen', + 'firmware_upload' => 'Firmwareupload', + 'unsupported' => 'nicht unterstützt', + 'up_to_date' => 'auf dem neusten Stand', + 'mower' => 'Mäher', + 'watering_computer' => 'Bewässerungscomputer', + 'no_frost' => 'kein Frost', + 'open' => 'offen', + 'closed' => 'geschlossen', + 'included' => 'inbegriffen', + 'active' => 'aktiv', + 'inactive' => 'nicht aktiv', + 'hibernate' => 'Winterschlaf', + 'awake' => 'Aufgewacht', + 'schedule permanently paused' => 'Zeitplan dauerhaft pausiert', + 'paused until %s' => 'pausiert bis %s', + 'watering. %.f minutes left' => 'Wird bewässert. %.f Minuten verbleibend.', + 'next watering: %s' => 'Nächste Bewässerung: %s', + 'n/a' => 'nicht verfügbar', + 'pump_not_filled' => 'Pumpe nicht gefüllt', + 'clean_fine_filter' => 'Filter reinigen', + ); + + if ( + defined( $langGermanMapp{$readingValue} ) + && ( AttrVal( 'global', 'language', 'none' ) eq 'DE' + || AttrVal( $name, 'readingValueLanguage', 'none' ) eq 'de' ) + && AttrVal( $name, 'readingValueLanguage', 'none' ) ne 'en' + ) + { + return $langGermanMapp{$readingValue}; + } + else { + return $readingValue; + } + + return; +} + +sub RigReadingsValue { + my $hash = shift; + my $readingValue = shift; + + my $rigReadingValue; + + if ( $readingValue =~ /^(\d+)-(\d\d)-(\d\d)T(\d\d)/ ) { + $rigReadingValue = Zulu2LocalString($readingValue); + } + else { + $rigReadingValue = ReadingLangGerman( $hash, $readingValue ); + } + + return $rigReadingValue; +} + +sub Zulu2LocalString { + my $t = shift; + + my ( $datehour, $datemin, $rest ) = split( /:/, $t, 3 ); + + my ( $year, $month, $day, $hour, $min ) = + $datehour =~ /(\d+)-(\d\d)-(\d\d)T(\d\d)/; + my $epoch = timegm( 0, 0, $hour, $day, $month - 1, $year ); + + my ( $lyear, $lmonth, $lday, $lhour, $isdst ) = + ( localtime($epoch) )[ 5, 4, 3, 2, -1 ]; + + $lyear += 1900; # year is 1900 based + $lmonth++; # month number is zero based + + if ( defined($rest) ) { + return ( + sprintf( + "%04d-%02d-%02d %02d:%02d:%s", + $lyear, $lmonth, $lday, + $lhour, $datemin, substr( $rest, 0, 2 ) + ) + ); + } + elsif ( $lyear < 2000 ) { + return 'temporarily unavailable'; + } + else { + return ( + sprintf( + "%04d-%02d-%02d %02d:%02d", + $lyear, $lmonth, $lday, $lhour, substr( $datemin, 0, 2 ) + ) + ); + } + + return; +} + +sub SetPredefinedStartPoints { + my $hash = shift; + my $aArg = shift; + + my ( $startpoint_state, $startpoint_num, @morestartpoints ) = @{$aArg}; + + my $name = $hash->{NAME}; + my $payload; + my $abilities; + + if ( defined($startpoint_state) && defined($startpoint_num) ) { + if ( defined( $hash->{helper}{STARTINGPOINTS} ) + && $hash->{helper}{STARTINGPOINTS} ne '' ) + { +# add needed parameters to saved settings config and change the value in request + my $decode_json_settings = + eval { decode_json( $hash->{helper}{STARTINGPOINTS} ) }; + if ($@) { + Log3 $name, 3, +"GardenaSmartBridge ($name) - JSON error while setting startpoint: $@"; + } + + $decode_json_settings->{device} = $hash->{DEVICEID}; + my $setval = $startpoint_state eq 'disable' ? \0 : \1; + $decode_json_settings->{value}[ $startpoint_num - 1 ]{enabled} = + $setval; + + #set more startpoints + if ( + defined scalar(@morestartpoints) + && ( scalar(@morestartpoints) == 2 + || scalar(@morestartpoints) == 4 ) + ) + { + if ( scalar(@morestartpoints) == 2 ) { + $setval = $morestartpoints[0] eq 'disable' ? \0 : \1; + $decode_json_settings->{value}[ $morestartpoints[1] - 1 ] + {enabled} = $setval; + + } + elsif ( scalar(@morestartpoints) == 4 ) { + $setval = $morestartpoints[0] eq 'disable' ? \0 : \1; + $decode_json_settings->{value}[ $morestartpoints[1] - 1 ] + {enabled} = $setval; + $setval = $morestartpoints[2] eq 'disable' ? \0 : \1; + $decode_json_settings->{value}[ $morestartpoints[3] - 1 ] + {enabled} = $setval; + } + } + + $payload = '"settings": ' . encode_json($decode_json_settings); + $abilities = 'mower_settings'; + + #$abilities['service_id'] = $hash->{helper}{STARTINGPOINTID}; + } + else { + return + "startingpoints not loaded yet, please wait a couple of minutes", + undef, undef; + } + } + else { + return + "startpoint usage: set " + . $hash->{NAME} + . " startpoint disable 1 [enable 2] [disable 3]", undef, undef; + } + + return undef, $payload, $abilities; +} + +1; + +=pod + +=item device +=item summary Modul to control GardenaSmart Devices +=item summary_DE Modul zur Steuerung von GardenaSmartgeräten +=begin html + + +

GardenaSmartDevice

+
    + In combination with Fhem device GardenaSmartBridge this Fhem module enables communication between GardenaCloud and + fhem. +

    + Once the bridge device is created, the connected Gardena devices will be recognized and created in Fhem + automatically.
    + From now on these devices can be controlled via Fhem. Changes in the Gardena App are synchronized with state and + redings of the devices. +

    + So far, known devices are mower, smart water control, irrigation control, smart sensors, power plug and pressure + pump. Schedules can be disabled/enabled via fhem, defining or deleting them must be done via the Gardena App.
    + +
+
+
    + Readings (model = mower) +
      +
    • battery-charging - Indicator if the Battery is charged (0/1) or with newer Firmware (false/true)
    • +
    • battery-level - load percentage of the Battery
    • +
    • battery-rechargeable_battery_status - healthyness of the battery (out_of_operation/replace_now/low/ok)
    • +
    • device_info-category - category of device (mower/watering_computer)
    • +
    • device_info-last_time_online - timestamp of last radio contact
    • +
    • device_info-manufacturer - manufacturer
    • +
    • device_info-product - product type
    • +
    • device_info-serial_number - serial number
    • +
    • device_info-sgtin -
    • +
    • device_info-version - firmware version
    • +
    • firmware-firmware_command - firmware command (idle/firmware_cancel/firmware_upload/unsupported)
    • +
    • firmware-firmware_status - firmware status
    • +
    • firmware-firmware_update_start - indicator when a firmwareupload is started
    • +
    • firmware-firmware_upload_progress - progress indicator of firmware update
    • +
    • firmware-inclusion_status - inclusion status
    • +
    • internal_temperature-temperature - internal device temperature
    • +
    • mower-error - actual error message +
        +
      • no_message
      • +
      • outside_working_area
      • +
      • no_loop_signal
      • +
      • wrong_loop_signal
      • +
      • loop_sensor_problem_front
      • +
      • loop_sensor_problem_rear
      • +
      • trapped
      • +
      • upside_down
      • +
      • low_battery
      • +
      • empty_battery
      • +
      • no_drive
      • +
      • lifted
      • +
      • stuck_in_charging_station
      • +
      • charging_station_blocked
      • +
      • collision_sensor_problem_rear
      • +
      • collision_sensor_problem_front
      • +
      • wheel_motor_blocked_right
      • +
      • wheel_motor_blocked_left
      • +
      • wheel_drive_problem_right
      • +
      • wheel_drive_problem_left
      • +
      • cutting_system_blocked
      • +
      • invalid_sub_device_combination
      • +
      • settings_restored
      • +
      • electronic_problem
      • +
      • charging_system_problem
      • +
      • tilt_sensor_problem
      • +
      • wheel_motor_overloaded_right
      • +
      • wheel_motor_overloaded_left
      • +
      • charging_current_too_high
      • +
      • temporary_problem
      • +
      • guide_1_not_found
      • +
      • guide_2_not_found
      • +
      • guide_3_not_found
      • +
      • difficult_finding_home
      • +
      • guide_calibration_accomplished
      • +
      • guide_calibration_failed
      • +
      • temporary_battery_problem
      • +
      • battery_problem
      • +
      • alarm_mower_switched_off
      • +
      • alarm_mower_stopped
      • +
      • alarm_mower_lifted
      • +
      • alarm_mower_tilted
      • +
      • connection_changed
      • +
      • connection_not_changed
      • +
      • com_board_not_available
      • +
      • slipped
      • +
      +
    • +
    • mower-manual_operation - (0/1) or with newer Firmware (false/true)
    • +
    • mower-override_end_time - manual override end time
    • +
    • mower-source_for_next_start - source for the next start +
        +
      • no_source
      • +
      • mower_charging
      • +
      • completed_cutting_autotimer
      • +
      • week_timer
      • +
      • countdown_timer
      • +
      • undefined
      • +
      +
    • +
    • mower-status - mower state (see state)
    • +
    • mower-timestamp_next_start - timestamp of next scheduled start
    • +
    • radio-connection_status - state of connection
    • +
    • radio-quality - percentage of the radio quality
    • +
    • radio-state - radio state (bad/poor/good/undefined)
    • +
    • state - state of the mower +
        +
      • paused
      • +
      • ok_cutting
      • +
      • ok_searching
      • +
      • ok_charging
      • +
      • ok_leaving
      • +
      • wait_updating
      • +
      • wait_power_up
      • +
      • parked_timer
      • +
      • parked_park_selected
      • +
      • off_disabled
      • +
      • off_hatch_open
      • +
      • unknown
      • +
      • error
      • +
      • error_at_power_up
      • +
      • off_hatch_closed
      • +
      • ok_cutting_timer_overridden
      • +
      • parked_autotimer
      • +
      • parked_daily_limit_reached
      • +
      +
    • +
    +

    + Readings (model = watering_computer) +
      +
    • [tbd.]
    • +
    +

    + Readings (model = ic24) +
      +
    • [tbd.]
    • +
    +

    + Readings (model = sensor) +
      +
    • [tbd.]
    • +
    +

    + Readings (model = sensor2) +
      +
    • [tbd.]
    • +
    +

    + Readings (model = power) +
      +
    • [tbd.]
    • +
    +

    + Readings (model = electronic_pressure_pump) +
      +
    • [tbd.]
    • +
    +

    + + Attribute +
      +
    • IODev - Name of GardenaSmartBridge device
    • +
    • extendedState 0|1 - [tbd.]
    • +
    • model watering_computer|sensor|sensor2|mower|ic24|power|electronic_pressure_pump - model of + GardenaSmartDevice
    • +
    • readingValueLanguage en|de - Reading language enlish or german (default: english, if global language is not + set to german)
    • +
    +

    + + set (model = mower) +
      +
    • parkUntilFurtherNotice - park mower and disable schedule
    • +
    • parkUntilNextTimer - park mower until next schedule
    • +
    • startOverrideTimer n - manual mowing for n minutes (e.g. 60 = 1h, 1440 = 24h, 4320 = 72h)
    • +
    • startResumeSchedule - enable schedule
    • +
    • startPoint enable|disable 1|2|3 - enable or disable pre-defined starting points
    • +
        +
      • set NAME startpoint enable 1
      • +
      • set NAME startpoint disable 3 enable 1
      • +
      +
    • winter_mode awake|hibernate - Disable or enable winter mode
    • +
    +

    + set (model = watering_computer) +
      +
    • cancelOverride - stop (manual) watering
    • +
    • manualButtonTime n - set watering time for manual button (0 disables button)
    • +
    • manualOverride n - manual watering for n minutes
    • +
    • resumeSchedule - enable schedule
    • +
    • stopSchedule n - disable schedule for n hours (Default: 2038-01-18T00:00:00.000Z, Gardena App reads it as + "permanently")
    • +
    • winter_mode awake|hibernate - Disable or enable winter mode
    • +
    +

    + set (model = ic24) +
      +
    • cancelOverrideValve1 - stop (manual) watering for valve 1
    • +
    • cancelOverrideValve2 - stop (manual) watering for valve 2
    • +
    • cancelOverrideValve3 - stop (manual) watering for valve 3
    • +
    • cancelOverrideValve4 - stop (manual) watering for valve 4
    • +
    • cancelOverrideValve5 - stop (manual) watering for valve 5
    • +
    • cancelOverrideValve6 - stop (manual) watering for valve 6
    • +
    • closeAllValves - close all valves
    • +
    • manualDurationValve1 n - open valve 1 for n minutes
    • +
    • manualDurationValve2 n - open valve 2 for n minutes
    • +
    • manualDurationValve3 n - open valve 3 for n minutes
    • +
    • manualDurationValve4 n - open valve 4 for n minutes
    • +
    • manualDurationValve5 n - open valve 5 for n minutes
    • +
    • manualDurationValve6 n - open valve 6 for n minutes
    • +
    • resumeScheduleValve n - enable schedule for valve n
    • +
    • stopScheduleValve n m - disable schedule for valve n for m hours (Default: 2038-01-18T00:00:00.000Z, Gardena + App reads it as "permanently")
    • +
    • winter_mode awake|hibernate - Disable or enable winter mode
    • +
    +

    + set (model = sensor) +
      +
    • refresh temperature|humidity|light - refresh sensor reading for temperature, humidity or daylight
    • +
    • winter_mode awake|hibernate - Disable or enable winter mode
    • +
    +

    + set (model = sensor2) +
      +
    • refresh temperature|humidity - refresh sensor reading for temperature or humidity
    • +
    • winter_mode awake|hibernate - Disable or enable winter mode
    • +
    +

    + set (model = power) +
      +
    • [tbd.]
    • +
    +

    + set (model = electronic_pressure_pump) +
      +
    • [tbd.]
    • +
    +
+ +=end html + +=begin html_DE + + +

GardenaSmartDevice

+
    + Zusammen mit dem Device GardenaSmartBridge stellt dieses Fhem-Modul die Kommunikation zwischen der GardenaCloud und + Fhem her. +

    + Wenn das GardenaSmartBridge Device erzeugt wurde, werden verbundene Geräte automatisch erkannt und in Fhem angelegt. +
    + Von nun an können die eingebundenen Geräte gesteuert werden. Änderungen in der App werden mit den Readings und dem + Status synchronisiert. +

    + Bekannte Gardena-Geräte umfassen Rasenmäher, Smart Water Control, Irrigation Control, Smart Sensoren, + Steckdosen-Adapter und Pumpe. Zeitpläne können über fhem pausiert/aktiviert werden, das Anlegen oder Löschen erfolgt + derzeit nur über die App. + +
+
+
    + Readings (model = mower) +
      +
    • battery-charging - Ladeindikator (0/1) oder mit neuerer Firmware (false/true)
    • +
    • battery-level - Ladezustand der Batterie in Prozent
    • +
    • battery-rechargeable_battery_status - Zustand der Batterie (Ausser Betrieb/Kritischer Batteriestand, + wechseln Sie jetzt/Niedrig/oK)
    • +
    • device_info-category - Eigenschaft des Gerätes (Mäher/Bewässerungscomputer/Bodensensor)
    • +
    • device_info-last_time_online - Zeitpunkt der letzten Funkübertragung
    • +
    • device_info-manufacturer - Hersteller
    • +
    • device_info-product - Produkttyp
    • +
    • device_info-serial_number - Seriennummer
    • +
    • device_info-sgtin -
    • +
    • device_info-version - Firmware Version
    • +
    • firmware-firmware_command - Firmware Kommando (Nichts zu tun/Firmwareupload + unterbrochen/Firmwareupload/nicht unterstützt)
    • +
    • firmware-firmware_status - Firmware Status
    • +
    • firmware-firmware_update_start - Firmwareupdate (0/1) oder mit neuerer Firmware (false/true)
    • +
    • firmware-firmware_upload_progress - Firmwareupdatestatus in Prozent
    • +
    • firmware-inclusion_status - Einbindungsstatus
    • +
    • internal_temperature-temperature - Interne Geräte Temperatur
    • +
    • mower-error - Aktuelle Fehler Meldung +
        +
      • Kein Fehler
      • +
      • Außerhalb des Arbeitsbereichs
      • +
      • Kein Schleifensignal
      • +
      • Falsches Schleifensignal
      • +
      • Problem Schleifensensor, vorne
      • +
      • Problem Schleifensensor, hinten
      • +
      • Eingeschlossen
      • +
      • Steht auf dem Kopf
      • +
      • Niedriger Batteriestand
      • +
      • Batterie ist leer
      • +
      • Kein Antrieb
      • +
      • Angehoben
      • +
      • Eingeklemmt in Ladestation
      • +
      • Ladestation blockiert
      • +
      • Problem Stoßsensor hinten
      • +
      • Problem Stoßsensor vorne
      • +
      • Radmotor rechts blockiert
      • +
      • Radmotor links blockiert
      • +
      • Problem Antrieb, rechts
      • +
      • Problem Antrieb, links
      • +
      • Schneidsystem blockiert
      • +
      • Fehlerhafte Verbindung
      • +
      • Standardeinstellungen
      • +
      • Elektronisches Problem
      • +
      • Problem Ladesystem
      • +
      • Kippsensorproblem
      • +
      • Rechter Radmotor überlastet
      • +
      • Linker Radmotor überlastet
      • +
      • Ladestrom zu hoch
      • +
      • Vorübergehendes Problem
      • +
      • SK 1 nicht gefunden
      • +
      • SK 2 nicht gefunden
      • +
      • SK 3 nicht gefunden
      • +
      • Problem die Ladestation zu finden
      • +
      • Kalibration des Suchkabels beendet
      • +
      • Kalibration des Suchkabels fehlgeschlagen
      • +
      • Kurzzeitiges Batterieproblem
      • +
      • Batterieproblem
      • +
      • Alarm! Mäher ausgeschalten
      • +
      • Alarm! Mäher gestoppt
      • +
      • Alarm! Mäher angehoben
      • +
      • Alarm! Mäher gekippt
      • +
      • Verbindung geändert
      • +
      • Verbindung nicht geändert
      • +
      • COM board nicht verfügbar
      • +
      • Rutscht
      • +
      +
    • +
    • mower-manual_operation - Manueller Betrieb (0/1) oder mit neuerer Firmware (false/true)
    • +
    • mower-override_end_time - Zeitpunkt wann der manuelle Betrieb beendet ist
    • +
    • mower-source_for_next_start - Grund für den nächsten Start +
        +
      • Kein Grund
      • +
      • Mäher wurde geladen
      • +
      • SensorControl erreicht
      • +
      • Wochentimer erreicht
      • +
      • Stoppuhr Timer
      • +
      • Undefiniert
      • +
      +
    • +
    • mower-status - Mäher Status (siehe state)
    • +
    • mower-timestamp_next_start - Zeitpunkt des nächsten geplanten Starts
    • +
    • radio-connection_status - Status der Funkverbindung
    • +
    • radio-quality - Indikator für die Funkverbindung in Prozent
    • +
    • radio-state - radio state (schlecht/schwach/gut/Undefiniert)
    • +
    • state - Staus des Mähers +
        +
      • Pausiert
      • +
      • Mähen
      • +
      • Suche Ladestation
      • +
      • Lädt
      • +
      • Mähen
      • +
      • Wird aktualisiert ...
      • +
      • Wird eingeschaltet ...
      • +
      • Geparkt nach Zeitplan
      • +
      • Geparkt
      • +
      • Der Mäher ist ausgeschaltet
      • +
      • Deaktiviert. Abdeckung ist offen oder PIN-Code erforderlich
      • +
      • Unbekannter Status
      • +
      • Fehler
      • +
      • Neustart ...
      • +
      • Deaktiviert. Manueller Start erforderlich
      • +
      • Manuelles Mähen
      • +
      • Geparkt durch SensorControl
      • +
      • Abgeschlossen
      • +
      +
    • +
    +

    + Readings (model = watering_computer) +
      +
    • [tbd.]
    • +
    +

    + Readings (model = ic24) +
      +
    • [tbd.]
    • +
    +

    + Readings (model = sensor) +
      +
    • [tbd.]
    • +
    +

    + Readings (model = sensor2) +
      +
    • [tbd.]
    • +
    +

    + Readings (model = power) +
      +
    • [tbd.]
    • +
    +

    + Readings (model = electronic_pressure_pump) +
      +
    • [tbd.]
    • +
    +

    + + Attribute +
      +
    • IODev - Name des GardenaSmartBridge Devices
    • +
    • extendedState 0|1 - [tbd.]
    • +
    • model watering_computer|sensor|sensor2|mower|ic24|power|electronic_pressure_pump - Modell des + GardenaSmartDevice
    • +
    • readingValueLanguage en|de - Sprache der Readings englisch oder deutsch (default: englisch, es sei denn, + Deutsch ist als globale Sprache gesetzt)
    • +
    +

    + + set (model = mower) +
      +
    • parkUntilFurtherNotice - Parken des Mähers und Aussetzen des Zeitplans
    • +
    • parkUntilNextTimer - Parken bis zum nächsten Start nach Zeitplan
    • +
    • startOverrideTimer n - Manuelles Mähen für n Minuten (z.B. 60 = 1h, 1440 = 24h, 4320 = 72h)
    • +
    • startResumeSchedule - Zeitplan wieder aktivieren
    • +
    • startPoint enable|disable 1|2|3 - Aktiviert oder deaktiviert einen vordefinierten Startbereich
    • +
        +
      • set NAME startpoint enable 1
      • +
      • set NAME startpoint disable 3 enable 1
      • +
      +
    • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
    • +
    +

    + set (model = watering_computer) +
      +
    • cancelOverride - (Manuelle) Bewässerung stoppen
    • +
    • manualButtonTime n - Bewässerungsdauer für manuellen Knopf auf n Minuten setzen (0 schaltet den Knopf aus) +
    • +
    • manualOverride n - Manuelle Bewässerung für n Minuten
    • +
    • resumeSchedule - Zeitplan wieder aktivieren
    • +
    • stopSchedule n - Zeitplan anhalten für n Stunden (Default: 2038-01-18T00:00:00.000Z, durch Gardena-App als + "dauerhaft" interpretiert)
    • +
    • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
    • +
    +

    + set (model = ic24) +
      +
    • cancelOverrideValve1 - (Manuelle) Bewässerung an Ventil 1 stoppen
    • +
    • cancelOverrideValve2 - (Manuelle) Bewässerung an Ventil 2 stoppen
    • +
    • cancelOverrideValve3 - (Manuelle) Bewässerung an Ventil 3 stoppen
    • +
    • cancelOverrideValve4 - (Manuelle) Bewässerung an Ventil 4 stoppen
    • +
    • cancelOverrideValve5 - (Manuelle) Bewässerung an Ventil 5 stoppen
    • +
    • cancelOverrideValve6 - (Manuelle) Bewässerung an Ventil 6 stoppen
    • +
    • closeAllValves - Alle Ventile schließen
    • +
    • manualDurationValve1 n - Ventil 1 für n Minuten öffnen
    • +
    • manualDurationValve2 n - Ventil 2 für n Minuten öffnen
    • +
    • manualDurationValve3 n - Ventil 3 für n Minuten öffnen
    • +
    • manualDurationValve4 n - Ventil 4 für n Minuten öffnen
    • +
    • manualDurationValve5 n - Ventil 5 für n Minuten öffnen
    • +
    • manualDurationValve6 n - Ventil 6 für n Minuten öffnen
    • +
    • resumeScheduleValve n - Zeitplan für Ventil n wieder aktivieren
    • +
    • stopScheduleValve n m - Zeitplan für Ventil n anhalten für m Stunden (Default: 2038-01-18T00:00:00.000Z, + durch Gardena-App als "dauerhaft" interpretiert)
    • +
    • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
    • +
    +

    + set (model = sensor) +
      +
    • refresh temperature|humidity|light - Sensorwert für Temperatur, Feuchtigkeit oder Helligkeit aktualisieren +
    • +
    • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
    • +
    +

    + set (model = sensor2) +
      +
    • refresh temperature|humidity - Sensorwert für Temperatur oder Feuchtigkeit aktualisieren
    • +
    • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
    • +
    +

    + set (model = power) +
      +
    • [tbd.]
    • +
    +

    + set (model = electronic_pressure_pump) +
      +
    • [tbd.]
    • +
    +
+ +=end html_DE + +=for :application/json;q=META.json 74_GardenaSmartDevice.pm +{ + "abstract": "Modul to control GardenaSmart Devices", + "x_lang": { + "de": { + "abstract": "Modul zur Steuerung von Gardena Smart Geräten" + } + }, + "keywords": [ + "fhem-mod-device", + "fhem-core", + "Garden", + "Gardena", + "Smart" + ], + "release_status": "stable", + "license": "GPL_2", + "version": "v2.5.6", + "author": [ + "Marko Oldenburg " + ], + "x_fhem_maintainer": [ + "CoolTux" + ], + "x_fhem_maintainer_github": [ + "LeonGaultier" + ], + "prereqs": { + "runtime": { + "requires": { + "FHEM": 5.00918799, + "perl": 5.016, + "Meta": 0, + "JSON": 0, + "Time::Local": 0 + }, + "recommends": { + }, + "suggests": { + } + } + } +} +=end :application/json;q=META.json + +=cut diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 3280213..e713269 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-24_20:29:03 73628 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-27_22:30:06 78954 FHEM/74_GardenaSmartDevice.pm From e108afda5a92be43d775b66c0c4c8638baeb157e Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 29 Jul 2022 12:49:27 +0200 Subject: [PATCH 097/126] add translation --- 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 af3012d..7a4cc7a 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [add] - translation pumpe filter + [add] - translations/commandref diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index c5fa25d..8ead950 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -1601,8 +1601,8 @@ sub SetPredefinedStartPoints {
  • manualDurationValve4 n - open valve 4 for n minutes
  • manualDurationValve5 n - open valve 5 for n minutes
  • manualDurationValve6 n - open valve 6 for n minutes
  • -
  • resumeScheduleValve n - enable schedule for valve n
  • -
  • stopScheduleValve n m - disable schedule for valve n for m hours (Default: 2038-01-18T00:00:00.000Z, Gardena +
  • resumeScheduleValve n - (re)start irrigation schedule for valve n
  • +
  • stopScheduleValve n m - stop irrigation schedule for valve n (Default: 2038-01-18T00:00:00.000Z, Gardena App reads it as "permanently")
  • winter_mode awake|hibernate - Disable or enable winter mode
  • diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index e713269..b80a8f0 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-27_22:30:06 78954 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-29_12:49:22 78965 FHEM/74_GardenaSmartDevice.pm From 7f6c7bc265642f08e65f26bcb6ce99e192aa791b Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 30 Jul 2022 20:31:59 +0200 Subject: [PATCH 098/126] [log] - removed valve_names log line --- 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 7a4cc7a..1bd692d 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [add] - translations/commandref + add translation diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 8ead950..180630c 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -928,7 +928,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 b80a8f0..bafc0bd 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-29_12:49:22 78965 FHEM/74_GardenaSmartDevice.pm +UPD 2022-07-30_20:31:34 78966 FHEM/74_GardenaSmartDevice.pm From 4b998d19ab6bf373ed679771b8a65eb8f9631672 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 2 Aug 2022 14:52:52 +0200 Subject: [PATCH 099/126] [fix] - show schedules_events_count fot non sensor devices [fix] - remove _valve_ in non valve devices fpr schedules --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 9 ++++----- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/CHANGED b/CHANGED index 1bd692d..bf024b8 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - add translation + [log] - removed valve_names log line diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 180630c..784eeaf 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -836,7 +836,8 @@ sub WriteReadings { if ( exists( $decode_json->{scheduled_events} ) # && scalar ($decode_json->{scheduled_events} ) > 0 - && ref ($decode_json->{scheduled_events}) eq 'ARRAY' ) { + && ref ($decode_json->{scheduled_events}) eq 'ARRAY' + && AttrVal( $name, 'model', 'unknown' ) !~ /sensor.?/ ) { 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] @@ -848,15 +849,13 @@ sub WriteReadings { while ( my ( $r, $v ) = each %{ $event_schedules } ) { readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_' . $event_id - . '_valve_' - . $valve_id + . ( ReadingsVal($name,'error-valve_error_1_valve_id','') ne '' ? "_valve_$valve_id" : '') . '_' . $r, $v) if (ref($v) ne 'HASH' ); readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_' . $event_id - . '_valve_' - . $valve_id + . ( ReadingsVal($name,'error-valve_error_1_valve_id','') ne '' ? "_valve_$valve_id" : '') . '_' . $v->{type}, join(',', @ { $v->{weekdays}}) ) if (ref($v) eq 'HASH' ); diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index bafc0bd..626551b 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-07-30_20:31:34 78966 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-02_14:51:12 79067 FHEM/74_GardenaSmartDevice.pm From 11c5e6650dbbba90f4e08c5c0a0c26add98bcb63 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 2 Aug 2022 14:58:59 +0200 Subject: [PATCH 100/126] [fix] - update event handled --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 9 ++------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/CHANGED b/CHANGED index bf024b8..d5effd0 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [log] - removed valve_names log line + [fix] - remove _valve_ in non valve devices fpr schedules diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 784eeaf..ca65089 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -793,7 +793,7 @@ sub WriteReadings { my $sub_state = 0; my $sub_value = 0; while ( my ( $r, $v ) = each %{ $propertie->{value} } ) { if ( ref( $v ) ne "HASH" ) { - readingsBulkUpdate( + readingsBulkUpdateIfChanged( $hash, $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name} . '_' @@ -802,7 +802,7 @@ sub WriteReadings { ); } else { while ( my ( $i_r, $i_v ) = each %{ $v } ) { - readingsBulkUpdate( + readingsBulkUpdateIfChanged( $hash, $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name} . '_' @@ -1109,11 +1109,6 @@ sub setState { if ( ReadingsVal( $name, 'device_info-category', 'unknown' ) eq 'sensor' ); -# if ( $online_state eq 'offline') { -# readingsBulkUpdate( $hash, 'humidity-humidity', '-1' ); -# readingsBulkUpdate( $hash, 'ambient_temperature-temperature', '-1' ) if (ReadingsVal($name, 'device_info-category', 'unknown') eq 'sensor'); -# readingsBulkUpdate( $hash, 'light-light', '-1' ) if (ReadingsVal($name, 'device_info-category', 'unknown') eq 'sensor'); -# } #online state sensor I II readingsBulkUpdate( $hash, 'state', $online_state eq 'online' ? RigReadingsValue( $hash, $state_string) : RigReadingsValue( $hash, 'offline') ); diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 626551b..3dc18d2 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-02_14:51:12 79067 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-02_14:58:44 78714 FHEM/74_GardenaSmartDevice.pm From e363b4586242388f661a9b9dffad66761946a615 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 4 Aug 2022 10:31:11 +0200 Subject: [PATCH 101/126] [fix] - eventhandler ic24 --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 4 ++++ controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGED b/CHANGED index d5effd0..fd24b06 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - remove _valve_ in non valve devices fpr schedules + [fix] - update event handled diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index ca65089..e327630 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -725,6 +725,10 @@ sub WriteReadings { . $propertie->{name} ne 'humidity-humidity' && $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name} ne 'light-light' + && $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} ne 'ic24-valves_connected' + && $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} ne 'ic24-valves_master_config' && ref( $propertie->{value} ) ne "HASH" ); readingsBulkUpdateIfChanged( diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 3dc18d2..3cc2108 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-02_14:58:44 78714 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-04_10:30:59 79000 FHEM/74_GardenaSmartDevice.pm From 1c7097e476a11eb514135fed56991a9e8a6165e8 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 4 Aug 2022 10:34:48 +0200 Subject: [PATCH 102/126] [fix] - schedules_event incrementation --- 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 fd24b06..c935054 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - update event handled + [fix] - eventhandler ic24 diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index e327630..390144d 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -844,7 +844,7 @@ sub WriteReadings { && AttrVal( $name, 'model', 'unknown' ) !~ /sensor.?/ ) { 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] + my $valve_id =1; my $event_id = 0; # 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 3cc2108..0ae6bb6 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-04_10:30:59 79000 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-04_10:33:44 79000 FHEM/74_GardenaSmartDevice.pm From 658f40e97998a04c3d573b6c65a8bcb6d9f5ca11 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 4 Aug 2022 14:39:44 +0200 Subject: [PATCH 103/126] [enhancemend] - commandref --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 528 +++++++++++++++++++++++++++----- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 448 insertions(+), 84 deletions(-) diff --git a/CHANGED b/CHANGED index c935054..7862540 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - eventhandler ic24 + [fix] - schedules_event incrementation diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 390144d..b029290 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -845,7 +845,12 @@ sub WriteReadings { readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_events_count', scalar( @{$decode_json->{scheduled_events} } ) ); my $valve_id =1; my $event_id = 0; # ic24 [1..6] | wc, pump [1] - + ## valcid zahlen. readings mit valvid aber + for my $event_schedules ( @{ $decode_json->{scheduled_events} } ) { + while ( my ( $r, $v ) = each %{ $event_schedules } ) { + push $cloud $v; # cloud hat SOLL + } + } for my $event_schedules ( @{ $decode_json->{scheduled_events} } ) { $valve_id = $event_schedules->{valve_id} if ( exists($event_schedules->{valve_id} ) ); #ic24 $event_id++; # event id @@ -1394,38 +1399,40 @@ sub SetPredefinedStartPoints {

    GardenaSmartDevice

      - In combination with Fhem device GardenaSmartBridge this Fhem module enables communication between GardenaCloud and + In combination with Fhem device GardenaSmartBridge this Fhem module enables communication between GardenaCloud and fhem.

      Once the bridge device is created, the connected Gardena devices will be recognized and created in Fhem automatically.
      From now on these devices can be controlled via Fhem. Changes in the Gardena App are synchronized with state and - redings of the devices. + readings of the devices.

      So far, known devices are mower, smart water control, irrigation control, smart sensors, power plug and pressure - pump. Schedules can be disabled/enabled via fhem, defining or deleting them must be done via the Gardena App.
      + pump. Schedules can be disabled/enabled via fhem, defining or deleting them must be done via Gardena App or its web interface.

      Readings (model = mower)
        -
      • battery-charging - Indicator if the Battery is charged (0/1) or with newer Firmware (false/true)
      • -
      • battery-level - load percentage of the Battery
      • -
      • battery-rechargeable_battery_status - healthyness of the battery (out_of_operation/replace_now/low/ok)
      • +
      • Readings are based on Sileno, other models might have different/additional readings depending on their functions (tbd.)
      • +
        +
      • battery-charging - Indicator if battery is charged (0/1)
      • +
      • battery-level - load percentage of battery
      • +
      • battery-rechargeable_battery_status - healthyness of the battery (out_of_operation/replace_now/low/ok), not all models
      • device_info-category - category of device (mower/watering_computer)
      • +
      • device_info-connection_status - connection status (online/offline/unknown)
      • device_info-last_time_online - timestamp of last radio contact
      • device_info-manufacturer - manufacturer
      • device_info-product - product type
      • device_info-serial_number - serial number
      • -
      • device_info-sgtin -
      • +
      • device_info-sgtin - (tbd.)
      • device_info-version - firmware version
      • firmware-firmware_command - firmware command (idle/firmware_cancel/firmware_upload/unsupported)
      • firmware-firmware_status - firmware status
      • -
      • firmware-firmware_update_start - indicator when a firmwareupload is started
      • firmware-firmware_upload_progress - progress indicator of firmware update
      • firmware-inclusion_status - inclusion status
      • -
      • internal_temperature-temperature - internal device temperature
      • +
      • internal_temperature-temperature - internal device temperature, not all models
      • mower-error - actual error message
        • no_message
        • @@ -1476,8 +1483,7 @@ sub SetPredefinedStartPoints {
        • slipped
      • -
      • mower-manual_operation - (0/1) or with newer Firmware (false/true)
      • -
      • mower-override_end_time - manual override end time
      • +
      • mower-last_error_code - code of last error
      • mower-source_for_next_start - source for the next start
        • no_source
        • @@ -1488,11 +1494,31 @@ sub SetPredefinedStartPoints {
        • undefined
      • -
      • mower-status - mower state (see state)
      • +
      • mower-status - mower status (see state reading)
      • +
      • mower-timestamp_last_error_code - timestamp of last error
      • mower-timestamp_next_start - timestamp of next scheduled start
      • -
      • radio-connection_status - state of connection
      • +
      • mower_stats-charging_cycles - number of charging cycles
      • +
      • mower_stats-collisions - number of collisions
      • +
      • mower_stats-cutting_time - cutting time in hours
      • +
      • mower_stats-running_time - running time in hours (including cutting time)
      • +
      • mower_timer-mower_timer - (tbd.)
      • +
      • mower_timer-mower_timer_timestamp - (tbd.)
      • +
      • mower_type-base_software_up_to_date - latest software (0/1)
      • +
      • mower_type-device_type - device type
      • +
      • mower_type-device_variant - device variant
      • +
      • mower_type-mainboard_version - mainboard version
      • +
      • mower_type-mmi_version - mmi version
      • +
      • mower_type-serial_number - serial number
      • radio-quality - percentage of the radio quality
      • radio-state - radio state (bad/poor/good/undefined)
      • +
      • scheduling-schedules_event_1_end_at - ending time of schedule 1
      • +
      • scheduling-schedules_event_1_id - ID of schedule 1
      • +
      • scheduling-schedules_event_1_start_at - starting time of schedule 1
      • +
      • scheduling-schedules_event_1_weekly - weekdays of schedule 1(comma-separated)
      • +
      • ...more readings for additional schedules (if defined)
      • +
      • scheduling-schedules_events_count - number of pre-defined schedules
      • +
      • startpoint-1-enabled - starpoint 1 enabled (0/1)
      • +
      • ...more readings for additional startpoints
      • state - state of the mower
        • paused
        • @@ -1513,45 +1539,216 @@ sub SetPredefinedStartPoints {
        • ok_cutting_timer_overridden
        • parked_autotimer
        • parked_daily_limit_reached
        • +
        • hibernate - winter mode)
      • +
      • winter_mode - status of winter mode (awake/hibernate)


      Readings (model = watering_computer)
        -
      • [tbd.]
      • +
      • ambient_temperature-temperature - ambient temperature in Celsius
      • +
      • battery-disposable_battery_status - healthyness of the battery (ok/low/replace_now/out_of_operation/no_battery/unknown)
      • +
      • battery-level - energy level of battery in percent
      • +
      • device_info-category - category of device (mower/watering_computer/sensor/etc.)
      • +
      • device_info-connection_status - connection status (online/offline/unknown)
      • +
      • device_info-last_time_online - timestamp of last radio contact
      • +
      • device_info-manufacturer - manufacturer
      • +
      • device_info-product - product type
      • +
      • device_info-serial_number - serial number
      • +
      • device_info-sgtin - tbd.
      • +
      • device_info-version - firmware version
      • +
      • error-error - error message (tbd.)
      • +
      • error-valve_error_1_severity - (tbd.)
      • +
      • error-valve_error_1_type - (tbd.)
      • +
      • error-valve_error_1_valve_id - id of valve with error
      • +
      • firmware-firmware_available_version - new available firmware (only if available)
      • +
      • firmware-firmware_command - firmware command (idle/firmware_cancel/firmware_upload/unsupported)
      • +
      • firmware-firmware_status - firmware status
      • +
      • firmware-firmware_upload_progress - progress indicator of firmware update
      • +
      • firmware-inclusion_status - inclusion status
      • +
      • manualButtonTime - watering time for manual button on device in minutes
      • +
      • radio-quality - percentage of the radio quality
      • +
      • radio-state - radio state (bad/poor/good/undefined)
      • +
      • scheduling-scheduled_watering_end - next schedule ending time
      • +
      • scheduling-scheduled_watering_next_start - next schedule starting time
      • +
      • scheduling-schedules_event_1_valve_1_end_at - ending time of schedule 1
      • +
      • scheduling-schedules_event_1_valve_1_id - ID of schedule 1
      • +
      • scheduling-schedules_event_1_valve_1_start_at - starting time of schedule 1
      • +
      • scheduling-schedules_event_1_valve_1_weekly - weekdays of schedule 1
      • +
      • scheduling-schedules_events_count - number of pre-defined schedules
      • +
      • scheduling-schedules_paused_until - date/time until schedule is paused (2038-01-18T00:00:00.000Z is defined as permanently by Gardena cloud)
      • +
      • state - state of device
      • +
          +
        • closed - valve closed, no schedules available
        • +
        • closed. schedule permanently paused - valve closed, schedule disabled
        • +
        • closed. next watering: YYYY-MM-DD HH:MM - valve closed, next scheduled start at YYYY-MM-DDTHH:MM:00.000Z
        • +
        • watering. n minutes remaining. - watering, n minutes remaining (depending on manual button time or on pre-defined schedule)
        • +
        • offline - device is disabled/not connected
        • +
        • hibernate - winter mode)
        • +
        +
      • watering-watering_timer_1_duration - duration of current watering in seconds
      • +
      • watering-watering_timer_1_irrigation_left - remaining watering time in minutes
      • +
      • watering-watering_timer_1_state - state of schedule
      • +
      • watering-watering_timer_1_valve_id - valve id of schedule
      • +
      • winter_mode - status of winter mode (awake/hibernate)


      Readings (model = ic24) +
    • device_info-category - category of device (mower/watering_computer/sensor/etc.)
    • +
    • device_info-connection_status - connection status (online/offline/unknown)
    • +
    • device_info-last_time_online - timestamp of last radio contact
    • +
    • device_info-manufacturer - manufacturer
    • +
    • device_info-product - product type
    • +
    • device_info-serial_number - serial number
    • +
    • device_info-sgtin - tbd.
    • +
    • device_info-version - firmware version
    • +
    • error-error - error message (tbd.)
    • +
    • error-valve_error_0_severity - (tbd.)
    • +
    • error-valve_error_0_type - (tbd.)
    • +
    • error-valve_error_0_valve_id - id of valve with error
    • +
    • ...more error readings
    • +
    • firmware-firmware_available_version - new available firmware (only if available)
    • +
    • firmware-firmware_command - firmware command (idle/firmware_cancel/firmware_upload/unsupported)
    • +
    • firmware-firmware_status - firmware status
    • +
    • firmware-firmware_upload_progress - progress indicator of firmware update
    • +
    • firmware-inclusion_status - inclusion status
    • +
    • ic24-valves_connected - connected valves (comma separated)
    • +
    • ic24-valves_master_config - master valve (only if defined in Gardena app)
    • +
    • radio-quality - percentage of the radio quality
    • +
    • radio-state - radio state (bad/poor/good/undefined)
    • +
    • scheduling-scheduled_watering_end - next schedule ending time
    • +
    • scheduling-scheduled_watering_end_1 - next schedule ending time for valve 1
    • +
    • ...more readings for valves 2-6
    • +
    • scheduling-scheduled_watering_next_start - next schedule starting time
    • +
    • scheduling-scheduled_watering_next_start_1 - next schedule starting time for valve 1
    • +
    • ...more readings for valves 2-6
    • +
    • scheduling-schedules_event_1_valve_1_end_at - ending time of schedule 1
    • +
    • scheduling-schedules_event_1_valve_1_id - ID of schedule 1
    • +
    • scheduling-schedules_event_1_valve_1_start_at - starting time of schedule 1
    • +
    • scheduling-schedules_event_1_valve_1_weekly - weekdays of schedule 1
    • +
    • scheduling-schedules_events_count - number of pre-defined schedules
    • +
    • ...more readings for further schedules/valves
    • +
    • scheduling-schedules_paused_until_1 - date/time until schedule is paused (2038-01-18T00:00:00.000Z is defined as permanently by Gardena cloud)
    • +
    • ...more readings for valves 2-6
    • +
    • state - state of device
    • +
        +
      • closed - valve closed, no schedules available
      • +
      • closed. schedule permanently paused - valve closed, all schedules disabled/paused
      • +
      • closed. next watering: YYYY-MM-DD HH:MM - valve closed, next scheduled start at YYYY-MM-DDTHH:MM:00.000Z
      • +
      • watering. n minutes remaining. - watering, n minutes remaining. If more than one schedule is active, the longer remaining time is shown.
      • +
      • offline - device is disabled/not connected
      • +
      +
    • valve-valve_name_1 - individual name for valve 1
    • +
    • ...more readings for valves 2-6 (if installed)
    • +
    • watering-watering_timer_1_duration - duration of current watering in seconds
    • +
    • watering-watering_timer_1_irrigation_left - remaining watering time in minutes
    • +
    • watering-watering_timer_1_state - state of schedule
    • +
    • watering-watering_timer_1_valve_id - valve id of schedule
    • +
    • ...more readings for further valves/schedules
    • +
    • winter_mode - status of winter mode (awake/hibernate)
    • +

      + Readings (model = sensor)
        -
      • [tbd.]
      • +
      • ambient_temperature-frost_warning - frost warning
      • +
      • ambient_temperature-temperature - ambient temperature in Celsius
      • +
      • battery-disposable_battery_status - healthyness of the battery (ok/low/replace_now/out_of_operation/no_battery/unknown)
      • +
      • battery-level - energy level of battery in percent
      • +
      • device_info-category - category of device (mower/watering_computer/sensor/etc.)
      • +
      • device_info-connection_status - connection status (online/offline/unknown)
      • +
      • device_info-last_time_online - timestamp of last radio contact
      • +
      • device_info-manufacturer - manufacturer
      • +
      • device_info-product - product type
      • +
      • device_info-serial_number - serial number
      • +
      • device_info-sgtin - tbd.
      • +
      • device_info-version - firmware version
      • +
      • firmware-firmware_available_version - new available firmware (only if available)
      • +
      • firmware-firmware_command - firmware command (idle/firmware_cancel/firmware_upload/unsupported)
      • +
      • firmware-firmware_status - firmware status
      • +
      • firmware-firmware_upload_progress - progress indicator of firmware update
      • +
      • firmware-inclusion_status - inclusion status
      • +
      • humidity-humidity - humidity in percent
      • +
      • light-light - brightness in lux
      • +
      • radio-quality - percentage of the radio quality
      • +
      • radio-state - radio state (bad/poor/good/undefined)
      • +
      • soil_temperature-temperature - soil temperature in Celsius
      • +
      • state - state of sensor (temperature (T:), humidity (H:), brightness/light (L:)
      • +
      • winter_mode - status of winter mode (awake/hibernate)


      Readings (model = sensor)
        -
      • [tbd.]
      • +
      • ambient_temperature-frost_warning - frost warning
      • +
      • ambient_temperature-temperature - ambient temperature in Celsius
      • +
      • battery-disposable_battery_status - healthyness of the battery (ok/low/replace_now/out_of_operation/no_battery/unknown)
      • +
      • battery-level - energy level of battery in percent
      • +
      • device_info-category - category of device (mower/watering_computer/sensor/etc.)
      • +
      • device_info-connection_status - connection status (online/offline/unknown)
      • +
      • device_info-last_time_online - timestamp of last radio contact
      • +
      • device_info-manufacturer - manufacturer
      • +
      • device_info-product - product type
      • +
      • device_info-serial_number - serial number
      • +
      • device_info-sgtin - tbd.
      • +
      • device_info-version - firmware version
      • +
      • firmware-firmware_available_version - new available firmware (only if available)
      • +
      • firmware-firmware_command - firmware command (idle/firmware_cancel/firmware_upload/unsupported)
      • +
      • firmware-firmware_status - firmware status
      • +
      • firmware-firmware_upload_progress - progress indicator of firmware update
      • +
      • firmware-inclusion_status - inclusion status
      • +
      • humidity-humidity - humidity in percent
      • +
      • light-light - brightness in lux
      • +
      • radio-quality - percentage of the radio quality
      • +
      • radio-state - radio state (bad/poor/good/undefined)
      • +
      • soil_temperature-temperature - soil temperature in Celsius
      • +
      • state - state of sensor (temperature (T:), humidity (H:), brightness/light (L:)|offline|hibernate)
      • +
      • winter_mode - status of winter mode (awake/hibernate)


      Readings (model = sensor2)
        -
      • [tbd.]
      • +
      • "sensor2" does not measure brightness or ambient temperature, and it has another reading for frost warning. Other than that, it seems to be more or less identical to "sensor".
      • +
        +
      • battery-disposable_battery_status - healthyness of the battery (ok/low/replace_now/out_of_operation/no_battery/unknown)
      • +
      • battery-level - energy level of battery in percent
      • +
      • device_info-category - category of device (mower/watering_computer/sensor/etc.)
      • +
      • device_info-connection_status - connection status (online/offline/unknown)
      • +
      • device_info-last_time_online - timestamp of last radio contact
      • +
      • device_info-manufacturer - manufacturer
      • +
      • device_info-product - product type
      • +
      • device_info-serial_number - serial number
      • +
      • device_info-sgtin - tbd.
      • +
      • device_info-version - firmware version
      • +
      • firmware-firmware_available_version - new available firmware (only if available)
      • +
      • firmware-firmware_command - firmware command (idle/firmware_cancel/firmware_upload/unsupported)
      • +
      • firmware-firmware_status - firmware status
      • +
      • firmware-firmware_upload_progress - progress indicator of firmware update
      • +
      • firmware-inclusion_status - inclusion status
      • +
      • humidity-humidity - humidity in percent
      • +
      • radio-quality - percentage of the radio quality
      • +
      • radio-state - radio state (bad/poor/good/undefined)
      • +
      • soil_model-model_definition - tbd.
      • +
      • soil_model-model_status - tbd.
      • +
      • soil_temperature-frost-warning - frost warning
      • +
      • soil_temperature-temperature - soil temperature in Celsius
      • +
      • state - state of sensor (temperature (T:), humidity (H:)|offline|hibernate)
      • +
      • winter_mode - status of winter mode (awake/hibernate)


      Readings (model = power)
        -
      • [tbd.]
      • +
      • (tbd.)


      Readings (model = electronic_pressure_pump)
        -
      • [tbd.]
      • +
      • (tbd.)


      Attribute
      • IODev - Name of GardenaSmartBridge device
      • -
      • extendedState 0|1 - [tbd.]
      • +
      • extendedState 0|1 - (tbd.)
      • model watering_computer|sensor|sensor2|mower|ic24|power|electronic_pressure_pump - model of GardenaSmartDevice
      • readingValueLanguage en|de - Reading language enlish or german (default: english, if global language is not @@ -1619,12 +1816,12 @@ sub SetPredefinedStartPoints {

        set (model = power)
          -
        • [tbd.]
        • +
        • (tbd.)


        set (model = electronic_pressure_pump)
          -
        • [tbd.]
        • +
        • (tbd.)
      @@ -1638,42 +1835,44 @@ sub SetPredefinedStartPoints { Zusammen mit dem Device GardenaSmartBridge stellt dieses Fhem-Modul die Kommunikation zwischen der GardenaCloud und Fhem her.

      - Wenn das GardenaSmartBridge Device erzeugt wurde, werden verbundene Geräte automatisch erkannt und in Fhem angelegt. + Wenn das GardenaSmartBridge Device erzeugt wurde, werden verbundene Geräte automatisch erkannt und in Fhem angelegt.
      - Von nun an können die eingebundenen Geräte gesteuert werden. Änderungen in der App werden mit den Readings und dem + Von nun an können die eingebundenen Geräte gesteuert werden. änderungen in der App werden mit den Readings und dem Status synchronisiert.

      - Bekannte Gardena-Geräte umfassen Rasenmäher, Smart Water Control, Irrigation Control, Smart Sensoren, - Steckdosen-Adapter und Pumpe. Zeitpläne können über fhem pausiert/aktiviert werden, das Anlegen oder Löschen erfolgt - derzeit nur über die App. + Bekannte Gardena-Geräte umfassen Rasenmäher, Smart Water Control, Irrigation Control, Smart Sensoren, + Steckdosen-Adapter und Pumpe. Zeitpläne können über fhem pausiert/aktiviert werden, das Anlegen oder Löschen erfolgt + derzeit nur über die App oder deren Web-Frontend.

      - Readings (model = mower) + Readings (model = mower/Mäher)
        -
      • battery-charging - Ladeindikator (0/1) oder mit neuerer Firmware (false/true)
      • +
      • Readings basieren auf dem Modell Sileno, andere Modelle haben abweichende/zusätzliche Readings abhängig von ihren Funktionen (tbd.)
      • +
        +
      • battery-charging - Ladeindikator (0/1)
      • battery-level - Ladezustand der Batterie in Prozent
      • battery-rechargeable_battery_status - Zustand der Batterie (Ausser Betrieb/Kritischer Batteriestand, - wechseln Sie jetzt/Niedrig/oK)
      • + wechseln Sie jetzt/Niedrig/oK), nicht bei allen Modellen +
      • device_info-connection_status - Verbindungs-Status (online/offline/unknown)
      • device_info-category - Eigenschaft des Gerätes (Mäher/Bewässerungscomputer/Bodensensor)
      • device_info-last_time_online - Zeitpunkt der letzten Funkübertragung
      • device_info-manufacturer - Hersteller
      • device_info-product - Produkttyp
      • device_info-serial_number - Seriennummer
      • -
      • device_info-sgtin -
      • +
      • device_info-sgtin - (tbd.)
      • device_info-version - Firmware Version
      • firmware-firmware_command - Firmware Kommando (Nichts zu tun/Firmwareupload unterbrochen/Firmwareupload/nicht unterstützt)
      • firmware-firmware_status - Firmware Status
      • -
      • firmware-firmware_update_start - Firmwareupdate (0/1) oder mit neuerer Firmware (false/true)
      • firmware-firmware_upload_progress - Firmwareupdatestatus in Prozent
      • firmware-inclusion_status - Einbindungsstatus
      • -
      • internal_temperature-temperature - Interne Geräte Temperatur
      • +
      • internal_temperature-temperature - Interne Geräte Temperatur, nicht bei allen Modellen
      • mower-error - Aktuelle Fehler Meldung
        • Kein Fehler
        • -
        • Außerhalb des Arbeitsbereichs
        • +
        • Ausserhalb des Arbeitsbereichs
        • Kein Schleifensignal
        • Falsches Schleifensignal
        • Problem Schleifensensor, vorne
        • @@ -1686,8 +1885,8 @@ sub SetPredefinedStartPoints {
        • Angehoben
        • Eingeklemmt in Ladestation
        • Ladestation blockiert
        • -
        • Problem Stoßsensor hinten
        • -
        • Problem Stoßsensor vorne
        • +
        • Problem Stosssensor hinten
        • +
        • Problem Stosssensor vorne
        • Radmotor rechts blockiert
        • Radmotor links blockiert
        • Problem Antrieb, rechts
        • @@ -1714,13 +1913,12 @@ sub SetPredefinedStartPoints {
        • Alarm! Mäher gestoppt
        • Alarm! Mäher angehoben
        • Alarm! Mäher gekippt
        • -
        • Verbindung geändert
        • +
        • Verbindung geändert
        • Verbindung nicht geändert
        • COM board nicht verfügbar
        • Rutscht
      • -
      • mower-manual_operation - Manueller Betrieb (0/1) oder mit neuerer Firmware (false/true)
      • mower-override_end_time - Zeitpunkt wann der manuelle Betrieb beendet ist
      • mower-source_for_next_start - Grund für den nächsten Start
          @@ -1733,11 +1931,31 @@ sub SetPredefinedStartPoints {
      • mower-status - Mäher Status (siehe state)
      • +
      • mower-timestamp_last_error_code - Zeitpunkt des letzten Fehlers
      • mower-timestamp_next_start - Zeitpunkt des nächsten geplanten Starts
      • -
      • radio-connection_status - Status der Funkverbindung
      • +
      • mower_stats-charging_cycles - Anzahl Ladezyklen
      • +
      • mower_stats-collisions - Anzahl Zusammenstösse
      • +
      • mower_stats-cutting_time - Schnittzeit in Stunden
      • +
      • mower_stats-running_time - Laufzeit in Stunden (inkl. Schnittzeit)
      • +
      • mower_timer-mower_timer - (tbd.)
      • +
      • mower_timer-mower_timer_timestamp - (tbd.)
      • +
      • mower_type-base_software_up_to_date - Software aktuell (0/1)
      • +
      • mower_type-device_type - Gerätetyp
      • +
      • mower_type-device_variant - Gerätevariante
      • +
      • mower_type-mainboard_version - Mainboard-Version
      • +
      • mower_type-mmi_version - MMI-Version
      • +
      • mower_type-serial_number - Seriennummer
      • radio-quality - Indikator für die Funkverbindung in Prozent
      • -
      • radio-state - radio state (schlecht/schwach/gut/Undefiniert)
      • -
      • state - Staus des Mähers +
      • radio-state - Verbindungsqualität (schlecht/schwach/gut/Undefiniert)
      • +
      • scheduling-schedules_event_1_end_at - Endzeit des Zeitplans 1
      • +
      • scheduling-schedules_event_1_id - ID des Zeitplans 1
      • +
      • scheduling-schedules_event_1_start_at - Startzeit des Zeitplans 1
      • +
      • scheduling-schedules_event_1_weekly - Wochentage des Zeitplans 1 (kommagetrennt)
      • +
      • ...weitere Readings für zusätzliche Zeitpläne (falls angelegt)
      • +
      • scheduling-schedules_events_count - Anzahl angelegter Zeitpläne
      • +
      • startpoint-1-enabled - starpoint 1 enabled (0/1)
      • +
      • ...weitere Readings für zusätzliche Startpunkte (falls angelegt)
      • +
      • state - Status des Mähers
        • Pausiert
        • Mähen
        • @@ -1757,38 +1975,183 @@ sub SetPredefinedStartPoints {
        • Manuelles Mähen
        • Geparkt durch SensorControl
        • Abgeschlossen
        • +
        • Winterschlaf - Gerät ist im Winterschlaf
        -
      • +
      • winter_mode - Status Winterschlaf (awake/hibernate)


      - Readings (model = watering_computer) + Readings (model = watering_computer/Bewässerungscomputer)
        -
      • [tbd.]
      • +
      • ambient_temperature-temperature - Umgebungstemperatur in Celsius
      • +
      • battery-disposable_battery_status - Batteriezustand
      • +
      • battery-level - Ladezustand der Batterie in Prozent
      • +
      • device_info-category - Art des Geräts
      • +
      • device_info-connection_status - Verbindungsstatus (online/offline/unknown)
      • +
      • device_info-last_time_online - Zeitpunkt der letzten Funkübertragung
      • +
      • device_info-manufacturer - Hersteller
      • +
      • device_info-product - Produkttyp
      • +
      • device_info-serial_number - Seriennummer
      • +
      • device_info-sgtin - (tbd.)
      • +
      • device_info-version - Firmware Version
      • +
      • error-error - Fehlermeldung (tbd.)
      • +
      • error-valve_error_1_severity - (tbd.)
      • +
      • error-valve_error_1_type - (tbd.)
      • +
      • error-valve_error_1_valve_id - ID des fehlerhaften Ventils
      • +
      • firmware-firmware_available_version - Neue Firmware (nur wenn verfügbar)
      • +
      • firmware-firmware_command - Firmware-Kommando (idle/firmware_cancel/firmware_upload/unsupported)
      • +
      • firmware-firmware_status - Firmware Status
      • +
      • firmware-firmware_upload_progress - Firmwareupdatestatus in Prozent
      • +
      • firmware-inclusion_status - Einbindungsstatus
      • +
      • manualButtonTime - Bewässerungszeit für den Geräte-Knopf in Minuten
      • +
      • radio-quality - Indikator für die Funkverbindung in Prozent
      • +
      • radio-state - Verbindungsqualität (schlecht/schwach/gut/Undefiniert)
      • +
      • scheduling-scheduled_watering_end - Endzeit des nächsten Zeitplans
      • +
      • scheduling-scheduled_watering_next_start - Startzeit des nächsten Zeitplans
      • +
      • scheduling-schedules_event_1_valve_1_end_at - Endzeit von Zeitplan 1
      • +
      • scheduling-schedules_event_1_valve_1_id - ID von Zeitplan 1
      • +
      • scheduling-schedules_event_1_valve_1_start_at - Startzeit von Zeitplan 1
      • +
      • scheduling-schedules_event_1_valve_1_weekly - Wochentage von Zeitplan 1
      • +
      • scheduling-schedules_events_count - Anzahl angelegter Zeitpläne
      • +
      • scheduling-schedules_paused_until - Datum/Uhrzeit, bis wann Zeitplan pausiert ist (2038-01-18T00:00:00.000Z wird von Gardena-Cloud als dauerhaft angesehen)
      • +
      • state - Status des Geräts
      • +
          +
        • geschossen - Ventil geschlossen, keine Zeitpläne definiert
        • +
        • geschlossen. Zeitplan dauerhaft pausiert - Ventil geschlossen, Zeitplan dauerhaft pausiert
        • +
        • geschlossen. Nächste Bewässerung: YYYY-MM-DD HH:MM - Ventil geschlossen, nächster Zeitplan-Start YYYY-MM-DDTHH:MM:00.000Z
        • +
        • will be irrigated n minutes remaining. - watering, n minutes remaining (depending on manual button time or on pre-defined schedule)
        • +
        • offline - Gerät ist ausgeschaltet/hat keine Verbindung
        • +
        • Winterschlaf - Gerät ist im Winterschlaf
        • +
        +
      • watering-watering_timer_1_duration - Gesamt-Dauer der aktuellen Bewässerung in Sekunden
      • +
      • watering-watering_timer_1_irrigation_left - Verbleibende Bewässerungszeit in Minuten
      • +
      • watering-watering_timer_1_state - Status des Zeitplans
      • +
      • watering-watering_timer_1_valve_id - Ventil-ID des Zeitplans
      • +
      • winter_mode - Status Winterschlaf (awake/hibernate)


      Readings (model = ic24) -
        -
      • [tbd.]
      • +
          +
        • device_info-category - Art des Geräts
        • +
        • device_info-connection_status - Verbindungsstatus (online/offline/unknown)
        • +
        • device_info-last_time_online - Zeitpunkt der letzten Funkübertragung
        • +
        • device_info-manufacturer - Hersteller
        • +
        • device_info-product - Produkttyp
        • +
        • device_info-serial_number - Seriennummer
        • +
        • device_info-sgtin - (tbd.)
        • +
        • device_info-version - Firmware Version
        • +
        • error-error - Fehlermeldung (tbd.)
        • +
        • error-valve_error_0_severity - (tbd.)
        • +
        • error-valve_error_0_type - (tbd.)
        • +
        • error-valve_error_0_valve_id - ID des fehlerhaften Ventils
        • +
        • ...ggf. weitere Error-Readings
        • +
        • firmware-firmware_available_version - Neue Firmware (nur wenn verfügbar)
        • +
        • firmware-firmware_command - Firmware-Kommando (idle/firmware_cancel/firmware_upload/unsupported)
        • +
        • firmware-firmware_status - Firmware Status
        • +
        • firmware-firmware_upload_progress - Firmwareupdatestatus in Prozent
        • +
        • firmware-inclusion_status - Einbindungsstatus
        • +
        • ic24-valves_connected - Verbundene Ventile (ID, kommagetrennt)
        • +
        • ic24-valves_master_config - Masterventil (nur, wenn in Gardena-App definiert)
        • +
        • radio-quality - Indikator für die Funkverbindung in Prozent
        • +
        • radio-state - Verbindungsqualität (schlecht/schwach/gut/Undefiniert)
        • +
        • scheduling-scheduled_watering_end - Endzeit des nächsten Zeitplans
        • +
        • scheduling-scheduled_watering_end_1 - Endzeit des nächsten Zeitplans für Ventil 1
        • +
        • ...weitere Readings für Ventile 2-6
        • +
        • scheduling-scheduled_watering_next_start - Startzeit des nächsten Zeitplans
        • +
        • scheduling-scheduled_watering_next_start_1 - Startzeit des nächsten Zeitplans für Ventil 1
        • +
        • ...weitere Readings für Ventile 2-6
        • +
        • scheduling-schedules_event_1_valve_n_end_at - Endzeit des ersten definierten Zeitplans für Ventil n
        • +
        • scheduling-schedules_event_1_valve_n_id - ID des ersten definierten Zeitplans für Ventil n
        • +
        • scheduling-schedules_event_1_valve_n_start_at - Startzeit des ersten definierten Zeitplans für Ventil n
        • +
        • scheduling-schedules_event_1_valve_n_weekly - Wochentage des ersten definierten Zeitplans für Ventil n
        • +
        • scheduling-schedules_events_count - Anzahl angelegter Zeitpläne
        • +
        • ...weitere Readings für zusätzliche Zeitpläne/Ventile
        • +
        • scheduling-schedules_paused_until_1 - Datum/Uhrzeit, bis wann Zeitplan pausiert ist (2038-01-18T00:00:00.000Z wird von Gardena-Cloud als dauerhaft angesehen)
        • +
        • ...weitere Readings für Ventile 2-6
        • +
        • state - Status des Geräts
        • +
            +
          • geschossen - Ventil geschlossen, keine Zeitpläne definiert
          • +
          • geschlossen. Zeitplan dauerhaft pausiert - Ventil geschlossen, Zeitplan dauerhaft pausiert
          • +
          • geschlossen. Nächste Bewässerung: YYYY-MM-DD HH:MM - Ventil geschlossen, nächster Zeitplan-Start YYYY-MM-DDTHH:MM:00.000Z
          • +
          • wird bewässert. n Minuten verbleibend - Bewässerung aktiv, n Minuten verbleibend (wenn 2 Ventile geöffnet sind, wird die längere Dauer angezeigt)
          • +
          • offline - Gerät ist ausgeschaltet/hat keine Verbindung
          • +
          • Winterschlaf - Gerät ist im Winterschlaf
          • +
          +
        • valve-valve_name_1 - Eigener Name für Ventil 1
        • +
        • ...weitere Readings für Ventile 2-6 (if installed)
        • +
        • watering-watering_timer_1_duration - Gesamt-Dauer der aktuellen Bewässerung in Sekunden
        • +
        • watering-watering_timer_1_irrigation_left - Verbleibende Dauer der aktuellen Bewässerung in Minuten
        • +
        • watering-watering_timer_1_state - Status des Timers
        • +
        • watering-watering_timer_1_valve_id - Ventil-ID des Timers
        • +
        • ...weitere Readings für weitere Ventile/Zeitpläne
        • +
        • winter_mode - Status Winterschlaf (awake/hibernate)


        Readings (model = sensor)
          -
        • [tbd.]
        • +
        • ambient_temperature-frost_warning - Frostwarnung
        • +
        • ambient_temperature-temperature - Umgebungstemperatur in Celsius
        • +
        • battery-disposable_battery_status - Batteriezustand
        • +
        • battery-level - Ladezustand der Batterie in Prozent
        • +
        • device_info-category - Art des Geräts
        • +
        • device_info-connection_status - Verbindungsstatus (online/offline/unknown)
        • +
        • device_info-last_time_online - Zeitpunkt der letzten Funkübertragung
        • +
        • device_info-manufacturer - Hersteller
        • +
        • device_info-product - Produkttyp
        • +
        • device_info-serial_number - Seriennummer
        • +
        • device_info-sgtin - (tbd.)
        • +
        • device_info-version - Firmware Version
        • +
        • firmware-firmware_available_version - Neue Firmware (nur wenn verfügbar)
        • +
        • firmware-firmware_command - Firmware-Kommando (idle/firmware_cancel/firmware_upload/unsupported)
        • +
        • firmware-firmware_status - Firmware Status
        • +
        • firmware-firmware_upload_progress - Firmwareupdatestatus in Prozent
        • +
        • firmware-inclusion_status - Einbindungsstatus
        • +
        • humidity-humidity - Feuchtigkeit in Prozent
        • +
        • light-light - Helligkeit in Lux
        • +
        • radio-quality - Indikator für die Funkverbindung in Prozent
        • +
        • radio-state - Verbindungsqualität (schlecht/schwach/gut/Undefiniert)
        • +
        • soil_temperature-temperature - Erd-Temperatur in Celsius
        • +
        • state - Status (Temperatur (T:), Feuchtigkeit (H:), Helligkeit (L:)|offline|Winterschlaf)
        • +
        • winter_mode - Status Winterschlaf (awake/hibernate)


        Readings (model = sensor2)
          -
        • [tbd.]
        • +
        • "sensor2" hat keine Helligkeitsmessung oder Umgebungstemperatur, und es legt die Frost-Warnung in einem anderen Reading ab. Ansonsten ist er mehr oder weniger identisch zum "sensor".
        • +
          +
        • battery-disposable_battery_status - Batteriezustand
        • +
        • battery-level - Ladezustand der Batterie in Prozent
        • +
        • device_info-category - Art des Geräts
        • +
        • device_info-connection_status - Verbindungsstatus (online/offline/unknown)
        • +
        • device_info-last_time_online - Zeitpunkt der letzten Funkübertragung
        • +
        • device_info-manufacturer - Hersteller
        • +
        • device_info-product - Produkttyp
        • +
        • device_info-serial_number - Seriennummer
        • +
        • device_info-sgtin - (tbd.)
        • +
        • device_info-version - Firmware Version
        • +
        • firmware-firmware_available_version - Neue Firmware (nur wenn verfügbar)
        • +
        • firmware-firmware_command - Firmware-Kommando (idle/firmware_cancel/firmware_upload/unsupported)
        • +
        • firmware-firmware_status - Firmware Status
        • +
        • firmware-firmware_upload_progress - Firmwareupdatestatus in Prozent
        • +
        • firmware-inclusion_status - Einbindungsstatus
        • +
        • humidity-humidity - Feuchtigkeit in Prozent
        • +
        • radio-quality - Indikator für die Funkverbindung in Prozent
        • +
        • radio-state - Verbindungsqualität (schlecht/schwach/gut/Undefiniert)
        • +
        • soil_model-model_definition - (tbd.)
        • +
        • soil_model-model_status - (tbd.)
        • +
        • soil_temperature-frost-warning - Frostwarnung
        • +
        • soil_temperature-temperature - Erd-Temperatur in Celsius
        • +
        • state - Status (Temperatur (T:), Feuchtigkeit (H:), Helligkeit (L:)|offline|Winterschlaf)
        • +
        • winter_mode - Status Winterschlaf (awake/hibernate)


        Readings (model = power)
          -
        • [tbd.]
        • +
        • (tbd.)


        Readings (model = electronic_pressure_pump)
          -
        • [tbd.]
        • +
        • (tbd.)


        @@ -1805,77 +2168,78 @@ sub SetPredefinedStartPoints { set (model = mower)
          -
        • parkUntilFurtherNotice - Parken des Mähers und Aussetzen des Zeitplans
        • -
        • parkUntilNextTimer - Parken bis zum nächsten Start nach Zeitplan
        • -
        • startOverrideTimer n - Manuelles Mähen für n Minuten (z.B. 60 = 1h, 1440 = 24h, 4320 = 72h)
        • +
        • parkUntilFurtherNotice - Parken des Mähers und Aussetzen des Zeitplans
        • +
        • parkUntilNextTimer - Parken bis zum nächsten Start nach Zeitplan
        • +
        • startOverrideTimer n - Manuelles Mähen für n Minuten (z.B. 60 = 1h, 1440 = 24h, 4320 = 72h)
        • startResumeSchedule - Zeitplan wieder aktivieren
        • startPoint enable|disable 1|2|3 - Aktiviert oder deaktiviert einen vordefinierten Startbereich
          • set NAME startpoint enable 1
          • set NAME startpoint disable 3 enable 1
          -
        • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
        • +
        • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken


        set (model = watering_computer)
          -
        • cancelOverride - (Manuelle) Bewässerung stoppen
        • -
        • manualButtonTime n - Bewässerungsdauer für manuellen Knopf auf n Minuten setzen (0 schaltet den Knopf aus) +
        • cancelOverride - (Manuelle) Bewässerung stoppen
        • +
        • manualButtonTime n - Bewässerungsdauer für manuellen Knopf auf n Minuten setzen (0 schaltet den Knopf aus)
        • -
        • manualOverride n - Manuelle Bewässerung für n Minuten
        • +
        • manualOverride n - Manuelle Bewässerung für n Minuten
        • resumeSchedule - Zeitplan wieder aktivieren
        • -
        • stopSchedule n - Zeitplan anhalten für n Stunden (Default: 2038-01-18T00:00:00.000Z, durch Gardena-App als +
        • stopSchedule n - Zeitplan anhalten für n Stunden (Default: 2038-01-18T00:00:00.000Z, durch Gardena-App als "dauerhaft" interpretiert)
        • -
        • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
        • +
        • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken


        set (model = ic24)
          -
        • cancelOverrideValve1 - (Manuelle) Bewässerung an Ventil 1 stoppen
        • -
        • cancelOverrideValve2 - (Manuelle) Bewässerung an Ventil 2 stoppen
        • -
        • cancelOverrideValve3 - (Manuelle) Bewässerung an Ventil 3 stoppen
        • -
        • cancelOverrideValve4 - (Manuelle) Bewässerung an Ventil 4 stoppen
        • -
        • cancelOverrideValve5 - (Manuelle) Bewässerung an Ventil 5 stoppen
        • -
        • cancelOverrideValve6 - (Manuelle) Bewässerung an Ventil 6 stoppen
        • -
        • closeAllValves - Alle Ventile schließen
        • -
        • manualDurationValve1 n - Ventil 1 für n Minuten öffnen
        • -
        • manualDurationValve2 n - Ventil 2 für n Minuten öffnen
        • -
        • manualDurationValve3 n - Ventil 3 für n Minuten öffnen
        • -
        • manualDurationValve4 n - Ventil 4 für n Minuten öffnen
        • -
        • manualDurationValve5 n - Ventil 5 für n Minuten öffnen
        • -
        • manualDurationValve6 n - Ventil 6 für n Minuten öffnen
        • -
        • resumeScheduleValve n - Zeitplan für Ventil n wieder aktivieren
        • -
        • stopScheduleValve n m - Zeitplan für Ventil n anhalten für m Stunden (Default: 2038-01-18T00:00:00.000Z, +
        • cancelOverrideValve1 - (Manuelle) Bewässerung an Ventil 1 stoppen
        • +
        • cancelOverrideValve2 - (Manuelle) Bewässerung an Ventil 2 stoppen
        • +
        • cancelOverrideValve3 - (Manuelle) Bewässerung an Ventil 3 stoppen
        • +
        • cancelOverrideValve4 - (Manuelle) Bewässerung an Ventil 4 stoppen
        • +
        • cancelOverrideValve5 - (Manuelle) Bewässerung an Ventil 5 stoppen
        • +
        • cancelOverrideValve6 - (Manuelle) Bewässerung an Ventil 6 stoppen
        • +
        • closeAllValves - Alle Ventile schliessen
        • +
        • manualDurationValve1 n - Ventil 1 für n Minuten öffnen
        • +
        • manualDurationValve2 n - Ventil 2 für n Minuten öffnen
        • +
        • manualDurationValve3 n - Ventil 3 für n Minuten öffnen
        • +
        • manualDurationValve4 n - Ventil 4 für n Minuten öffnen
        • +
        • manualDurationValve5 n - Ventil 5 für n Minuten öffnen
        • +
        • manualDurationValve6 n - Ventil 6 für n Minuten öffnen
        • +
        • resumeScheduleValve n - Zeitplan für Ventil n wieder aktivieren
        • +
        • stopScheduleValve n m - Zeitplan für Ventil n anhalten für m Stunden (Default: 2038-01-18T00:00:00.000Z, durch Gardena-App als "dauerhaft" interpretiert)
        • -
        • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
        • +
        • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken


        set (model = sensor)
          -
        • refresh temperature|humidity|light - Sensorwert für Temperatur, Feuchtigkeit oder Helligkeit aktualisieren +
        • refresh temperature|humidity|light - Sensorwert für Temperatur, Feuchtigkeit oder Helligkeit aktualisieren
        • -
        • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
        • +
        • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken


        set (model = sensor2)
          -
        • refresh temperature|humidity - Sensorwert für Temperatur oder Feuchtigkeit aktualisieren
        • -
        • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
        • +
        • refresh temperature|humidity - Sensorwert für Temperatur oder Feuchtigkeit aktualisieren
        • +
        • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken


        set (model = power)
          -
        • [tbd.]
        • +
        • (tbd.)


        set (model = electronic_pressure_pump)
          -
        • [tbd.]
        • +
        • (tbd.)
      =end html_DE + =for :application/json;q=META.json 74_GardenaSmartDevice.pm { "abstract": "Modul to control GardenaSmart Devices", diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 0ae6bb6..5f78179 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-04_10:33:44 79000 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-04_14:38:54 107236 FHEM/74_GardenaSmartDevice.pm From ada7e2875c8dfc4dc075fcd62646793aaf3e5fa0 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 4 Aug 2022 14:44:35 +0200 Subject: [PATCH 104/126] [fix] - 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 7862540..6883ea6 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - schedules_event incrementation + [enhancemend] - commandref diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index b029290..331d9df 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -846,11 +846,12 @@ sub WriteReadings { scalar( @{$decode_json->{scheduled_events} } ) ); my $valve_id =1; my $event_id = 0; # ic24 [1..6] | wc, pump [1] ## valcid zahlen. readings mit valvid aber - for my $event_schedules ( @{ $decode_json->{scheduled_events} } ) { - while ( my ( $r, $v ) = each %{ $event_schedules } ) { - push $cloud $v; # cloud hat SOLL - } - } + # my @soll = (); + # for my $event_schedules ( @{ $decode_json->{scheduled_events} } ) { + # while ( my ( $r, $v ) = each %{ $event_schedules } ) { + # push @soll, $v; # cloud hat SOLL + # } + # } for my $event_schedules ( @{ $decode_json->{scheduled_events} } ) { $valve_id = $event_schedules->{valve_id} if ( exists($event_schedules->{valve_id} ) ); #ic24 $event_id++; # event id diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 5f78179..917fe46 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-04_14:38:54 107236 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-04_14:44:27 107271 FHEM/74_GardenaSmartDevice.pm From 6a7083f6eaa60e6aacf67f522383525a6c298f03 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 4 Aug 2022 14:54:44 +0200 Subject: [PATCH 105/126] [fix] - translation --- 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 6883ea6..7646245 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [enhancemend] - commandref + [fix] - fix diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 331d9df..23c33a1 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -846,12 +846,13 @@ sub WriteReadings { scalar( @{$decode_json->{scheduled_events} } ) ); my $valve_id =1; my $event_id = 0; # ic24 [1..6] | wc, pump [1] ## valcid zahlen. readings mit valvid aber - # my @soll = (); - # for my $event_schedules ( @{ $decode_json->{scheduled_events} } ) { - # while ( my ( $r, $v ) = each %{ $event_schedules } ) { - # push @soll, $v; # cloud hat SOLL - # } - # } + my @soll = (); + for my $event_schedules ( @{ $decode_json->{scheduled_events} } ) { + while ( my ( $r, $v ) = each %{ $event_schedules } ) { + push @soll, $v if $r eq 'id'; # cloud hat SOLL + } + } + for my $event_schedules ( @{ $decode_json->{scheduled_events} } ) { $valve_id = $event_schedules->{valve_id} if ( exists($event_schedules->{valve_id} ) ); #ic24 $event_id++; # event id @@ -1056,7 +1057,7 @@ sub setState { 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)); + $state_string .= sprintf(RigReadingsValue($hash,'valve').' '.$_.' '.(RigReadingsValue($hash, 'watering. %.f minutes left') .'
      '), (ReadingsVal( $name, 'watering-watering_timer_'.$_.'_duration', 0 )/60)); } # /for } else { $state_string .= RigReadingsValue($hash, 'closed'); @@ -1073,7 +1074,7 @@ sub setState { Log3 $name, 5, "[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) + ? sprintf( (RigReadingsValue($hash, 'watering. %.f minutes left')), $longest_duration/60) # zu : ( $has_schedule diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 917fe46..70c4d7e 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-04_14:44:27 107271 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-04_14:54:35 107246 FHEM/74_GardenaSmartDevice.pm From 47804c996b63fe7f11ad72dacdd1fd0e9ca0e46e Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 4 Aug 2022 15:47:10 +0200 Subject: [PATCH 106/126] [enhancement] - commandref --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 85 +++++++++++++-------------------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 36 insertions(+), 53 deletions(-) diff --git a/CHANGED b/CHANGED index 7646245..bf176ba 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - fix + [fix] - translation diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 23c33a1..492aefe 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -1416,14 +1416,15 @@ sub SetPredefinedStartPoints {
        Readings (model = mower) +

        + Readings are based on Sileno, other models might have different/additional readings depending on their functions (tbd.) +

          -
        • Readings are based on Sileno, other models might have different/additional readings depending on their functions (tbd.)
        • -
        • battery-charging - Indicator if battery is charged (0/1)
        • battery-level - load percentage of battery
        • battery-rechargeable_battery_status - healthyness of the battery (out_of_operation/replace_now/low/ok), not all models
        • device_info-category - category of device (mower/watering_computer)
        • -
        • device_info-connection_status - connection status (online/offline/unknown) +
        • device_info-connection_status - connection status (online/offline/unknown)
        • device_info-last_time_online - timestamp of last radio contact
        • device_info-manufacturer - manufacturer
        • device_info-product - product type
        • @@ -1558,7 +1559,7 @@ sub SetPredefinedStartPoints {
        • device_info-manufacturer - manufacturer
        • device_info-product - product type
        • device_info-serial_number - serial number
        • -
        • device_info-sgtin - tbd.
        • +
        • device_info-sgtin - (tbd.)
        • device_info-version - firmware version
        • error-error - error message (tbd.)
        • error-valve_error_1_severity - (tbd.)
        • @@ -1580,15 +1581,16 @@ sub SetPredefinedStartPoints {
        • scheduling-schedules_event_1_valve_1_weekly - weekdays of schedule 1
        • scheduling-schedules_events_count - number of pre-defined schedules
        • scheduling-schedules_paused_until - date/time until schedule is paused (2038-01-18T00:00:00.000Z is defined as permanently by Gardena cloud)
        • -
        • state - state of device
        • +
        • state - state of device
          • closed - valve closed, no schedules available
          • closed. schedule permanently paused - valve closed, schedule disabled
          • closed. next watering: YYYY-MM-DD HH:MM - valve closed, next scheduled start at YYYY-MM-DDTHH:MM:00.000Z
          • -
          • watering. n minutes remaining. - watering, n minutes remaining (depending on manual button time or on pre-defined schedule)
          • +
          • watering. n minutes left. - watering, n minutes remaining (depending on manual button time or on pre-defined schedule)
          • offline - device is disabled/not connected
          • hibernate - winter mode)
          +
        • watering-watering_timer_1_duration - duration of current watering in seconds
        • watering-watering_timer_1_irrigation_left - remaining watering time in minutes
        • watering-watering_timer_1_state - state of schedule
        • @@ -1597,6 +1599,7 @@ sub SetPredefinedStartPoints {


        Readings (model = ic24) +
        • device_info-category - category of device (mower/watering_computer/sensor/etc.)
        • device_info-connection_status - connection status (online/offline/unknown)
        • device_info-last_time_online - timestamp of last radio contact
        • @@ -1633,14 +1636,15 @@ sub SetPredefinedStartPoints {
        • ...more readings for further schedules/valves
        • scheduling-schedules_paused_until_1 - date/time until schedule is paused (2038-01-18T00:00:00.000Z is defined as permanently by Gardena cloud)
        • ...more readings for valves 2-6
        • -
        • state - state of device
        • +
        • state - state of device
          • closed - valve closed, no schedules available
          • closed. schedule permanently paused - valve closed, all schedules disabled/paused
          • closed. next watering: YYYY-MM-DD HH:MM - valve closed, next scheduled start at YYYY-MM-DDTHH:MM:00.000Z
          • -
          • watering. n minutes remaining. - watering, n minutes remaining. If more than one schedule is active, the longer remaining time is shown.
          • +
          • watering. n minutes left. - watering, n minutes remaining. If more than one schedule is active, the longer remaining time is shown.
          • offline - device is disabled/not connected
          +
        • valve-valve_name_1 - individual name for valve 1
        • ...more readings for valves 2-6 (if installed)
        • watering-watering_timer_1_duration - duration of current watering in seconds
        • @@ -1648,35 +1652,8 @@ sub SetPredefinedStartPoints {
        • watering-watering_timer_1_state - state of schedule
        • watering-watering_timer_1_valve_id - valve id of schedule
        • ...more readings for further valves/schedules
        • -
        • winter_mode - status of winter mode (awake/hibernate)
        • -

          - Readings (model = sensor) -
            -
          • ambient_temperature-frost_warning - frost warning
          • -
          • ambient_temperature-temperature - ambient temperature in Celsius
          • -
          • battery-disposable_battery_status - healthyness of the battery (ok/low/replace_now/out_of_operation/no_battery/unknown)
          • -
          • battery-level - energy level of battery in percent
          • -
          • device_info-category - category of device (mower/watering_computer/sensor/etc.)
          • -
          • device_info-connection_status - connection status (online/offline/unknown)
          • -
          • device_info-last_time_online - timestamp of last radio contact
          • -
          • device_info-manufacturer - manufacturer
          • -
          • device_info-product - product type
          • -
          • device_info-serial_number - serial number
          • -
          • device_info-sgtin - tbd.
          • -
          • device_info-version - firmware version
          • -
          • firmware-firmware_available_version - new available firmware (only if available)
          • -
          • firmware-firmware_command - firmware command (idle/firmware_cancel/firmware_upload/unsupported)
          • -
          • firmware-firmware_status - firmware status
          • -
          • firmware-firmware_upload_progress - progress indicator of firmware update
          • -
          • firmware-inclusion_status - inclusion status
          • -
          • humidity-humidity - humidity in percent
          • -
          • light-light - brightness in lux
          • -
          • radio-quality - percentage of the radio quality
          • -
          • radio-state - radio state (bad/poor/good/undefined)
          • -
          • soil_temperature-temperature - soil temperature in Celsius
          • -
          • state - state of sensor (temperature (T:), humidity (H:), brightness/light (L:)
          • winter_mode - status of winter mode (awake/hibernate)
          • -
          +


        Readings (model = sensor)
          @@ -1707,9 +1684,10 @@ sub SetPredefinedStartPoints {


        Readings (model = sensor2) +

        + "sensor2" does not measure brightness or ambient temperature, and it has another reading for frost warning. Other than that, it seems to be more or less identical to "sensor". +

          -
        • "sensor2" does not measure brightness or ambient temperature, and it has another reading for frost warning. Other than that, it seems to be more or less identical to "sensor".
        • -
        • battery-disposable_battery_status - healthyness of the battery (ok/low/replace_now/out_of_operation/no_battery/unknown)
        • battery-level - energy level of battery in percent
        • device_info-category - category of device (mower/watering_computer/sensor/etc.)
        • @@ -1745,9 +1723,9 @@ sub SetPredefinedStartPoints {
          • (tbd.)
          -

          +


          - Attribute + Attribute (all models)
          • IODev - Name of GardenaSmartBridge device
          • extendedState 0|1 - (tbd.)
          • @@ -1756,7 +1734,7 @@ sub SetPredefinedStartPoints {
          • readingValueLanguage en|de - Reading language enlish or german (default: english, if global language is not set to german)
          -

          +


          set (model = mower)
            @@ -1850,9 +1828,10 @@ sub SetPredefinedStartPoints {
              Readings (model = mower/Mäher) +

              + Readings basieren auf dem Modell Sileno, andere Modelle haben abweichende/zusätzliche Readings abhängig von ihren Funktionen (tbd.) +

                -
              • Readings basieren auf dem Modell Sileno, andere Modelle haben abweichende/zusätzliche Readings abhängig von ihren Funktionen (tbd.)
              • -
              • battery-charging - Ladeindikator (0/1)
              • battery-level - Ladezustand der Batterie in Prozent
              • battery-rechargeable_battery_status - Zustand der Batterie (Ausser Betrieb/Kritischer Batteriestand, @@ -1979,6 +1958,7 @@ sub SetPredefinedStartPoints {
              • Abgeschlossen
              • Winterschlaf - Gerät ist im Winterschlaf
              +
            • winter_mode - Status Winterschlaf (awake/hibernate)


            @@ -2015,7 +1995,7 @@ sub SetPredefinedStartPoints {
          • scheduling-schedules_event_1_valve_1_weekly - Wochentage von Zeitplan 1
          • scheduling-schedules_events_count - Anzahl angelegter Zeitpläne
          • scheduling-schedules_paused_until - Datum/Uhrzeit, bis wann Zeitplan pausiert ist (2038-01-18T00:00:00.000Z wird von Gardena-Cloud als dauerhaft angesehen)
          • -
          • state - Status des Geräts
          • +
          • state - Status des Geräts
            • geschossen - Ventil geschlossen, keine Zeitpläne definiert
            • geschlossen. Zeitplan dauerhaft pausiert - Ventil geschlossen, Zeitplan dauerhaft pausiert
            • @@ -2024,6 +2004,7 @@ sub SetPredefinedStartPoints {
            • offline - Gerät ist ausgeschaltet/hat keine Verbindung
            • Winterschlaf - Gerät ist im Winterschlaf
            +
          • watering-watering_timer_1_duration - Gesamt-Dauer der aktuellen Bewässerung in Sekunden
          • watering-watering_timer_1_irrigation_left - Verbleibende Bewässerungszeit in Minuten
          • watering-watering_timer_1_state - Status des Zeitplans
          • @@ -2045,7 +2026,7 @@ sub SetPredefinedStartPoints {
          • error-valve_error_0_severity - (tbd.)
          • error-valve_error_0_type - (tbd.)
          • error-valve_error_0_valve_id - ID des fehlerhaften Ventils
          • -
          • ...ggf. weitere Error-Readings
          • +
          • ...ggf. weitere Error-Readings
          • firmware-firmware_available_version - Neue Firmware (nur wenn verfügbar)
          • firmware-firmware_command - Firmware-Kommando (idle/firmware_cancel/firmware_upload/unsupported)
          • firmware-firmware_status - Firmware Status
          • @@ -2069,7 +2050,7 @@ sub SetPredefinedStartPoints {
          • ...weitere Readings für zusätzliche Zeitpläne/Ventile
          • scheduling-schedules_paused_until_1 - Datum/Uhrzeit, bis wann Zeitplan pausiert ist (2038-01-18T00:00:00.000Z wird von Gardena-Cloud als dauerhaft angesehen)
          • ...weitere Readings für Ventile 2-6
          • -
          • state - Status des Geräts
          • +
          • state - Status des Geräts
            • geschossen - Ventil geschlossen, keine Zeitpläne definiert
            • geschlossen. Zeitplan dauerhaft pausiert - Ventil geschlossen, Zeitplan dauerhaft pausiert
            • @@ -2078,6 +2059,7 @@ sub SetPredefinedStartPoints {
            • offline - Gerät ist ausgeschaltet/hat keine Verbindung
            • Winterschlaf - Gerät ist im Winterschlaf
            +
          • valve-valve_name_1 - Eigener Name für Ventil 1
          • ...weitere Readings für Ventile 2-6 (if installed)
          • watering-watering_timer_1_duration - Gesamt-Dauer der aktuellen Bewässerung in Sekunden
          • @@ -2117,9 +2099,10 @@ sub SetPredefinedStartPoints {


          Readings (model = sensor2) +

          + "sensor2" hat keine Helligkeitsmessung oder Umgebungstemperatur, und es legt die Frost-Warnung in einem anderen Reading ab. Ansonsten ist er mehr oder weniger identisch zum "sensor". +

            -
          • "sensor2" hat keine Helligkeitsmessung oder Umgebungstemperatur, und es legt die Frost-Warnung in einem anderen Reading ab. Ansonsten ist er mehr oder weniger identisch zum "sensor".
          • -
          • battery-disposable_battery_status - Batteriezustand
          • battery-level - Ladezustand der Batterie in Prozent
          • device_info-category - Art des Geräts
          • @@ -2155,9 +2138,9 @@ sub SetPredefinedStartPoints {
            • (tbd.)
            -

            +


            - Attribute + Attribute (alle Modelle)
            • IODev - Name des GardenaSmartBridge Devices
            • extendedState 0|1 - [tbd.]
            • @@ -2166,7 +2149,7 @@ sub SetPredefinedStartPoints {
            • readingValueLanguage en|de - Sprache der Readings englisch oder deutsch (default: englisch, es sei denn, Deutsch ist als globale Sprache gesetzt)
            -

            +


            set (model = mower)
              diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 70c4d7e..d576ed3 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-04_14:54:35 107246 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-04_15:46:35 105511 FHEM/74_GardenaSmartDevice.pm From bae27c39c12afd90417a619c0b2cc405d21ac059 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 6 Aug 2022 13:13:43 +0200 Subject: [PATCH 107/126] [enhancement] - delete unused scheuldes from readings --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 55 ++++++++++++++++++++++++++++++--- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 53 insertions(+), 6 deletions(-) diff --git a/CHANGED b/CHANGED index bf176ba..2de9fa3 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - translation + [enhancement] - commandref diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 492aefe..c85ac36 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -845,14 +845,61 @@ sub WriteReadings { readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_events_count', scalar( @{$decode_json->{scheduled_events} } ) ); my $valve_id =1; my $event_id = 0; # ic24 [1..6] | wc, pump [1] - ## valcid zahlen. readings mit valvid aber - my @soll = (); - for my $event_schedules ( @{ $decode_json->{scheduled_events} } ) { - while ( my ( $r, $v ) = each %{ $event_schedules } ) { + + ## + # validiere schedules + my @soll = ();my @ist=(); + for my $cloud_schedules ( @{ $decode_json->{scheduled_events} } ) { + while ( my ( $r, $v ) = each %{ $cloud_schedules } ) { push @soll, $v if $r eq 'id'; # cloud hat SOLL } } + +use Data::Dumper; + foreach my $dev_schedules ( sort keys %{ $hash->{READINGS} } ) { + my $dev_reading = ReadingsVal( $name, $dev_schedules, "error" ); + push @ist, $dev_reading if $dev_schedules =~ /.*_id/; # push reading _id + push @ist, $1 if $dev_schedules =~ /.*_(\d)_id/; # push readigs d from x_id + + Log3 $name, 5, "[DEBUG] - Key ist : $dev_schedules "; + Log3 $name, 5, "[DDDDD] - ID FOUND $dev_reading" if $dev_schedules =~ /.*_id/; # cloud hat SOLL + } + Log3 $name, 5, "[OOOU] Cloud ".Dumper(@soll) . "- Ist:". Dumper(@ist); + + ## delete only if cloud != (ist/2) + if (scalar(@soll) != scalar(@ist/2) + && scalar(@soll) > 0 + && scalar(@ist) > 0){ + + while(my $element = shift(@soll)) { + my $schedule_step_int = 0; + + foreach my $sist (@ist) { + my $step = scalar(@ist) > 1 ? 2:1; + if ($element eq $sist){ + # splice(@ist, $schedule_step_int, 1); # more than 2 items del them, otherwise 1 + splice(@ist, $schedule_step_int, $step); # more than 2 items del them, otherwise 1 + #$schedule_step_int++; + } + # $schedule_step_int++; + $schedule_step_int += $step; + } + } + } + Log3 $name, 5, "[REST] ". Dumper(@ist); + if (scalar(@ist) > 0){ + while (my $old_schedule_id = shift(@ist)) { + if (length($old_schedule_id) == 1) { + foreach (keys %{$hash->{READINGS}}) { + delete $hash->{READINGS}->{$_} if($_ =~ /scheduling-schedules_event_$old_schedule_id.*/); + } + }# fi + Log3 $name, 5, "[DEBUG] - $name : deletereading scheduling-schedules_event_$old_schedule_id.*" if length($old_schedule_id) == 1; + } + } + #### /validiere schedules + for my $event_schedules ( @{ $decode_json->{scheduled_events} } ) { $valve_id = $event_schedules->{valve_id} if ( exists($event_schedules->{valve_id} ) ); #ic24 $event_id++; # event id diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index d576ed3..84761da 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-04_15:46:35 105511 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-06_13:11:33 107424 FHEM/74_GardenaSmartDevice.pm From 0ee95be7be4831e2d98d1e3024acd3d4cf56a33f Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 6 Aug 2022 20:20:04 +0200 Subject: [PATCH 108/126] [fix] - delete unused schedules --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 22 +++++++++++++--------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CHANGED b/CHANGED index 2de9fa3..10ab08b 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [enhancement] - commandref + [enhancement] - delete unused scheuldes from readings diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index c85ac36..79db63f 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -848,7 +848,7 @@ sub WriteReadings { ## # validiere schedules - my @soll = ();my @ist=(); + my @soll = ();my @ist=(); my @tmp_ist=(); for my $cloud_schedules ( @{ $decode_json->{scheduled_events} } ) { while ( my ( $r, $v ) = each %{ $cloud_schedules } ) { push @soll, $v if $r eq 'id'; # cloud hat SOLL @@ -862,27 +862,31 @@ use Data::Dumper; push @ist, $dev_reading if $dev_schedules =~ /.*_id/; # push reading _id push @ist, $1 if $dev_schedules =~ /.*_(\d)_id/; # push readigs d from x_id - Log3 $name, 5, "[DEBUG] - Key ist : $dev_schedules "; - Log3 $name, 5, "[DDDDD] - ID FOUND $dev_reading" if $dev_schedules =~ /.*_id/; # cloud hat SOLL + Log3 $name, 5, "[DEBUG] $name - Key ist : $dev_schedules "; + Log3 $name, 5, "[DDDDD] $name - ID FOUND $dev_reading" if $dev_schedules =~ /.*_id/; # cloud hat SOLL } Log3 $name, 5, "[OOOU] Cloud ".Dumper(@soll) . "- Ist:". Dumper(@ist); ## delete only if cloud != (ist/2) - if (scalar(@soll) != scalar(@ist/2) + if ((scalar(@soll) != scalar(@ist/2) && scalar(@soll) > 0 - && scalar(@ist) > 0){ - + && scalar(@ist) > 0) + || (scalar(@ist) eq 2 && scalar(@soll) eq 1 )){ + @tmp_ist = @ist; while(my $element = shift(@soll)) { my $schedule_step_int = 0; - foreach my $sist (@ist) { + foreach my $sist (@tmp_ist) { my $step = scalar(@ist) > 1 ? 2:1; + #print "step laenge $step \n"; + + print "check $element = $sist\n"; if ($element eq $sist){ - # splice(@ist, $schedule_step_int, 1); # more than 2 items del them, otherwise 1 + #splice(@ist, $schedule_step_int, 1); # more than 2 items del them, otherwise 1 splice(@ist, $schedule_step_int, $step); # more than 2 items del them, otherwise 1 #$schedule_step_int++; } - # $schedule_step_int++; + #$schedule_step_int++; $schedule_step_int += $step; } } diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 84761da..041545f 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-06_13:11:33 107424 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-06_20:17:48 107633 FHEM/74_GardenaSmartDevice.pm From 78b5731bbf4f97c79bc868ff781f851232f8da5b Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 7 Aug 2022 20:20:17 +0200 Subject: [PATCH 109/126] [fix] - cast all propertie as string - fixed bulkupdateifchanged --- 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 10ab08b..a171be1 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [enhancement] - delete unused scheuldes from readings + [fix] - delete unused schedules diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 79db63f..8e15369 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -708,7 +708,7 @@ sub WriteReadings { $hash, $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name}, - (defined ($propertie->{value} ) eq '') ? RigReadingsValue( $hash, 'n/a') : RigReadingsValue( $hash, $propertie->{value} ) + (defined ($propertie->{value} ) eq '') ? RigReadingsValue( $hash, 'n/a') : "".RigReadingsValue( $hash, $propertie->{value} ) # cast all data to string with "" ) if ( exists( $propertie->{value} ) && $decode_json->{abilities}[$abilities]{name} . '-' @@ -735,7 +735,7 @@ sub WriteReadings { $hash, $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name}, - RigReadingsValue( $hash, $propertie->{value} ) + "".RigReadingsValue( $hash, $propertie->{value} ) # cast all data to string with "" ) if ( defined( $propertie->{value} ) @@ -762,7 +762,7 @@ sub WriteReadings { $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name} . '_timestamp', - Time::Piece->strptime( + "".Time::Piece->strptime( RigReadingsValue( $hash, $propertie->{timestamp} ), "%Y-%m-%d %H:%M:%S" )->strftime('%s') diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 041545f..843e6c1 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-06_20:17:48 107633 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-07_20:12:20 107711 FHEM/74_GardenaSmartDevice.pm From 8a32c9f21522f9154ed10f5a1eb4d1cae5ca5b78 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 8 Aug 2022 20:47:19 +0200 Subject: [PATCH 110/126] [fix] - removed "valveid" from reading --- 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 a171be1..5b8f37a 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - delete unused schedules + [fix] - cast all propertie as string - fixed bulkupdateifchanged diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 8e15369..5f209bf 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -877,7 +877,7 @@ use Data::Dumper; my $schedule_step_int = 0; foreach my $sist (@tmp_ist) { - my $step = scalar(@ist) > 1 ? 2:1; + my $step = scalar(@tmp_ist) > 1 ? 2:1; #print "step laenge $step \n"; print "check $element = $sist\n"; @@ -911,13 +911,13 @@ use Data::Dumper; while ( my ( $r, $v ) = each %{ $event_schedules } ) { readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_' . $event_id - . ( ReadingsVal($name,'error-valve_error_1_valve_id','') ne '' ? "_valve_$valve_id" : '') + #. ( ReadingsVal($name,'error-valve_error_1_valve_id','') ne '' ? "_valve_$valve_id" : '') . '_' . $r, $v) if (ref($v) ne 'HASH' ); readingsBulkUpdateIfChanged( $hash, 'scheduling-schedules_event_' . $event_id - . ( ReadingsVal($name,'error-valve_error_1_valve_id','') ne '' ? "_valve_$valve_id" : '') + #. ( ReadingsVal($name,'error-valve_error_1_valve_id','') ne '' ? "_valve_$valve_id" : '') . '_' . $v->{type}, join(',', @ { $v->{weekdays}}) ) if (ref($v) eq 'HASH' ); diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 843e6c1..9b94dbc 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-07_20:12:20 107711 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-08_20:47:00 107717 FHEM/74_GardenaSmartDevice.pm From ade45510ac4ee91df053d91116d892468d7e0317 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 8 Aug 2022 20:59:57 +0200 Subject: [PATCH 111/126] [fix] - checkmethode delete reading if ist = soll --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 8 +++++--- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGED b/CHANGED index 5b8f37a..3e6c01a 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - cast all propertie as string - fixed bulkupdateifchanged + [fix] - removed "valveid" from reading diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 5f209bf..ce17c8b 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -859,8 +859,8 @@ sub WriteReadings { use Data::Dumper; foreach my $dev_schedules ( sort keys %{ $hash->{READINGS} } ) { my $dev_reading = ReadingsVal( $name, $dev_schedules, "error" ); - push @ist, $dev_reading if $dev_schedules =~ /.*_id/; # push reading _id - push @ist, $1 if $dev_schedules =~ /.*_(\d)_id/; # push readigs d from x_id + push @ist, $dev_reading if $dev_schedules =~ /schedule.*_id/; # push reading _id + push @ist, $1 if $dev_schedules =~ /schedule.*_(\d)_id/; # push readigs d from x_id Log3 $name, 5, "[DEBUG] $name - Key ist : $dev_schedules "; Log3 $name, 5, "[DDDDD] $name - ID FOUND $dev_reading" if $dev_schedules =~ /.*_id/; # cloud hat SOLL @@ -892,7 +892,9 @@ use Data::Dumper; } } Log3 $name, 5, "[REST] ". Dumper(@ist); - if (scalar(@ist) > 0){ + # delete only if count soll != count ist. cos the will be overwritten + if (scalar(@ist) > 0 + && scalar(@soll) != scalar(@ist/2) ){ while (my $old_schedule_id = shift(@ist)) { if (length($old_schedule_id) == 1) { foreach (keys %{$hash->{READINGS}}) { diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 9b94dbc..a015f49 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-08_20:47:00 107717 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-08_20:59:37 107858 FHEM/74_GardenaSmartDevice.pm From 0d2972111168797260e13e630e44d17e2e70571a Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 8 Aug 2022 21:03:29 +0200 Subject: [PATCH 112/126] [fix] - commandref --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 4 +--- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CHANGED b/CHANGED index 3e6c01a..29d1171 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - removed "valveid" from reading + [fix] - checkmethode delete reading if ist = soll diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index ce17c8b..7d4ea97 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -1781,7 +1781,6 @@ sub SetPredefinedStartPoints { Attribute (all models)
              • IODev - Name of GardenaSmartBridge device
              • -
              • extendedState 0|1 - (tbd.)
              • model watering_computer|sensor|sensor2|mower|ic24|power|electronic_pressure_pump - model of GardenaSmartDevice
              • readingValueLanguage en|de - Reading language enlish or german (default: english, if global language is not @@ -2196,7 +2195,6 @@ sub SetPredefinedStartPoints { Attribute (alle Modelle)
                • IODev - Name des GardenaSmartBridge Devices
                • -
                • extendedState 0|1 - [tbd.]
                • model watering_computer|sensor|sensor2|mower|ic24|power|electronic_pressure_pump - Modell des GardenaSmartDevice
                • readingValueLanguage en|de - Sprache der Readings englisch oder deutsch (default: englisch, es sei denn, @@ -2295,7 +2293,7 @@ sub SetPredefinedStartPoints { ], "release_status": "stable", "license": "GPL_2", - "version": "v2.5.6", + "version": "v2.5.7", "author": [ "Marko Oldenburg " ], diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index a015f49..47fd397 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-08_20:59:37 107858 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-08_21:03:14 107770 FHEM/74_GardenaSmartDevice.pm From 8ce29803563c436dc798993062c7a862ffcd12d2 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 9 Aug 2022 10:04:43 +0200 Subject: [PATCH 113/126] [fix] - corret debug output --- 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 29d1171..bb0e9f3 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - checkmethode delete reading if ist = soll + [fix] - commandref diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 7d4ea97..7eed766 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -863,7 +863,7 @@ use Data::Dumper; push @ist, $1 if $dev_schedules =~ /schedule.*_(\d)_id/; # push readigs d from x_id Log3 $name, 5, "[DEBUG] $name - Key ist : $dev_schedules "; - Log3 $name, 5, "[DDDDD] $name - ID FOUND $dev_reading" if $dev_schedules =~ /.*_id/; # cloud hat SOLL + Log3 $name, 5, "[DDDDD] $name - ID FOUND $dev_reading" if $dev_schedules =~ /schedule.*_id/; # cloud hat SOLL } Log3 $name, 5, "[OOOU] Cloud ".Dumper(@soll) . "- Ist:". Dumper(@ist); diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 47fd397..82bcffe 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-08_21:03:14 107770 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-09_09:51:51 107778 FHEM/74_GardenaSmartDevice.pm From c86cae74e69c54e00c11574378531ed1d8f8b886 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 9 Aug 2022 10:13:57 +0200 Subject: [PATCH 114/126] [fix] - debug output --- 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 bb0e9f3..c6c6e24 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - commandref + [fix] - corret debug output diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 7eed766..3e52112 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -863,7 +863,7 @@ use Data::Dumper; push @ist, $1 if $dev_schedules =~ /schedule.*_(\d)_id/; # push readigs d from x_id Log3 $name, 5, "[DEBUG] $name - Key ist : $dev_schedules "; - Log3 $name, 5, "[DDDDD] $name - ID FOUND $dev_reading" if $dev_schedules =~ /schedule.*_id/; # cloud hat SOLL + Log3 $name, 5, "[DDDDD] $name - ID FOUND $dev_reading" if $dev_schedules =~ /schedule.*_\d_id/; # cloud hat SOLL } Log3 $name, 5, "[OOOU] Cloud ".Dumper(@soll) . "- Ist:". Dumper(@ist); diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 82bcffe..498a408 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-09_09:51:51 107778 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-09_10:13:50 107781 FHEM/74_GardenaSmartDevice.pm From 71b435d90b7ee3effef5cd236cde0872409fd982 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 9 Aug 2022 10:34:04 +0200 Subject: [PATCH 115/126] [fix] - schedules + debug --- 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 c6c6e24..7c17e12 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - corret debug output + [fix] - debug output diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 3e52112..f6b4cb2 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -859,7 +859,7 @@ sub WriteReadings { use Data::Dumper; foreach my $dev_schedules ( sort keys %{ $hash->{READINGS} } ) { my $dev_reading = ReadingsVal( $name, $dev_schedules, "error" ); - push @ist, $dev_reading if $dev_schedules =~ /schedule.*_id/; # push reading _id + push @ist, $dev_reading if $dev_schedules =~ /schedule.*\d_id/; # push reading _id push @ist, $1 if $dev_schedules =~ /schedule.*_(\d)_id/; # push readigs d from x_id Log3 $name, 5, "[DEBUG] $name - Key ist : $dev_schedules "; diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 498a408..3f407bb 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-09_10:13:50 107781 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-09_10:33:55 107783 FHEM/74_GardenaSmartDevice.pm From 8b9ce793cd0992fbeb82db1b0b9f24497ea3ef7c Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 9 Aug 2022 14:52:34 +0200 Subject: [PATCH 116/126] [final] - removed debug print lines, cleanup code --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 16 ++++------------ controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/CHANGED b/CHANGED index 7c17e12..4cbe437 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - debug output + [fix] - schedules + debug diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index f6b4cb2..ed8724d 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -855,17 +855,15 @@ sub WriteReadings { } } - -use Data::Dumper; foreach my $dev_schedules ( sort keys %{ $hash->{READINGS} } ) { my $dev_reading = ReadingsVal( $name, $dev_schedules, "error" ); push @ist, $dev_reading if $dev_schedules =~ /schedule.*\d_id/; # push reading _id push @ist, $1 if $dev_schedules =~ /schedule.*_(\d)_id/; # push readigs d from x_id - Log3 $name, 5, "[DEBUG] $name - Key ist : $dev_schedules "; - Log3 $name, 5, "[DDDDD] $name - ID FOUND $dev_reading" if $dev_schedules =~ /schedule.*_\d_id/; # cloud hat SOLL + Log3 $name, 5, "[DEBUG] $name - Schedule - Key ist : $dev_schedules "; + Log3 $name, 5, "[DEBUG] $name - Schedule - ID FOUND $dev_reading" if $dev_schedules =~ /schedule.*_\d_id/; # cloud hat SOLL } - Log3 $name, 5, "[OOOU] Cloud ".Dumper(@soll) . "- Ist:". Dumper(@ist); + #Log3 $name, 5, "[DEBUG] Cloud:".Dumper(@soll) . "- Internal:". Dumper(@ist); ## delete only if cloud != (ist/2) if ((scalar(@soll) != scalar(@ist/2) @@ -878,20 +876,14 @@ use Data::Dumper; foreach my $sist (@tmp_ist) { my $step = scalar(@tmp_ist) > 1 ? 2:1; - #print "step laenge $step \n"; - - print "check $element = $sist\n"; if ($element eq $sist){ - #splice(@ist, $schedule_step_int, 1); # more than 2 items del them, otherwise 1 splice(@ist, $schedule_step_int, $step); # more than 2 items del them, otherwise 1 - #$schedule_step_int++; } - #$schedule_step_int++; $schedule_step_int += $step; } } } - Log3 $name, 5, "[REST] ". Dumper(@ist); + Log3 $name, 5, "[DEBUG] $name - Schedule - Rest ". Dumper(@ist); # delete only if count soll != count ist. cos the will be overwritten if (scalar(@ist) > 0 && scalar(@soll) != scalar(@ist/2) ){ diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 3f407bb..0f062cc 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-09_10:33:55 107783 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-09_14:51:26 107551 FHEM/74_GardenaSmartDevice.pm From d660366aea354959ec73ce2333138a03d1884a02 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 9 Aug 2022 15:03:38 +0200 Subject: [PATCH 117/126] [final 2] - removed debug dumper code --- 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 4cbe437..80f8911 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [fix] - schedules + debug + [final] - removed debug print lines, cleanup code diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index ed8724d..ab4b2bc 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -883,7 +883,7 @@ sub WriteReadings { } } } - Log3 $name, 5, "[DEBUG] $name - Schedule - Rest ". Dumper(@ist); + #Log3 $name, 5, "[DEBUG] $name - Schedule - Rest ". Dumper(@ist); # delete only if count soll != count ist. cos the will be overwritten if (scalar(@ist) > 0 && scalar(@soll) != scalar(@ist/2) ){ diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 0f062cc..4fc77d0 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-09_14:51:26 107551 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-09_15:03:22 107552 FHEM/74_GardenaSmartDevice.pm From 388ae1635ee179273a527ff370bd0b7e45ccf13d Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 11 Aug 2022 12:40:13 +0200 Subject: [PATCH 118/126] [enhancement] - add resetvalveerrors ic24 --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 5 ++++- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 80f8911..816fbc9 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [final] - removed debug print lines, cleanup code + [final 2] - removed debug dumper code diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index ab4b2bc..4e5f3b3 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -571,7 +571,7 @@ sub Set { if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' ); $list .= -'closeAllValves:noArg stopScheduleValve:select,'.ReadingsVal( $name, 'ic24-valves_connected', '1' ).' resumeScheduleValve:select,'.ReadingsVal( $name, 'ic24-valves_connected', '1' ) +'closeAllValves:noArg resetvalveerrors: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'))) { @@ -1290,6 +1290,7 @@ sub ReadingLangGerman { 'n/a' => 'nicht verfügbar', 'pump_not_filled' => 'Pumpe nicht gefüllt', 'clean_fine_filter' => 'Filter reinigen', + 'concurrent_limit_reached' => 'Grenze gleichzeitig geöffneter Ventile erreicht', ); if ( @@ -1820,6 +1821,7 @@ sub SetPredefinedStartPoints {
                • manualDurationValve4 n - open valve 4 for n minutes
                • manualDurationValve5 n - open valve 5 for n minutes
                • manualDurationValve6 n - open valve 6 for n minutes
                • +
                • resetvalveerrors n - reset valve errormessage
                • resumeScheduleValve n - (re)start irrigation schedule for valve n
                • stopScheduleValve n m - stop irrigation schedule for valve n (Default: 2038-01-18T00:00:00.000Z, Gardena App reads it as "permanently")
                • @@ -2235,6 +2237,7 @@ sub SetPredefinedStartPoints {
                • manualDurationValve4 n - Ventil 4 für n Minuten öffnen
                • manualDurationValve5 n - Ventil 5 für n Minuten öffnen
                • manualDurationValve6 n - Ventil 6 für n Minuten öffnen
                • +
                • resetvalveerrors n - Ventilfehler zurücksetzen
                • resumeScheduleValve n - Zeitplan für Ventil n wieder aktivieren
                • stopScheduleValve n m - Zeitplan für Ventil n anhalten für m Stunden (Default: 2038-01-18T00:00:00.000Z, durch Gardena-App als "dauerhaft" interpretiert)
                • diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 4fc77d0..2167974 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-09_15:03:22 107552 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-11_12:40:06 107803 FHEM/74_GardenaSmartDevice.pm From 76a7eeb4e5bfb46ea2be6f9e5bae8c3e4162af7e Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 11 Aug 2022 14:25:19 +0200 Subject: [PATCH 119/126] [fix] - upper/lower case --- 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 816fbc9..b612008 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [final 2] - removed debug dumper code + [enhancement] - add resetvalveerrors ic24 diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 4e5f3b3..6429842 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -571,7 +571,7 @@ sub Set { if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' ); $list .= -'closeAllValves:noArg resetvalveerrors:noArg stopScheduleValve:select,'.ReadingsVal( $name, 'ic24-valves_connected', '1' ).' resumeScheduleValve:select,'.ReadingsVal( $name, 'ic24-valves_connected', '1' ) +'closeAllValves:noArg resetValveErrors: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'))) { @@ -1821,7 +1821,7 @@ sub SetPredefinedStartPoints {
                • manualDurationValve4 n - open valve 4 for n minutes
                • manualDurationValve5 n - open valve 5 for n minutes
                • manualDurationValve6 n - open valve 6 for n minutes
                • -
                • resetvalveerrors n - reset valve errormessage
                • +
                • resetValveErrors n - reset valve errormessage
                • resumeScheduleValve n - (re)start irrigation schedule for valve n
                • stopScheduleValve n m - stop irrigation schedule for valve n (Default: 2038-01-18T00:00:00.000Z, Gardena App reads it as "permanently")
                • @@ -2237,7 +2237,7 @@ sub SetPredefinedStartPoints {
                • manualDurationValve4 n - Ventil 4 für n Minuten öffnen
                • manualDurationValve5 n - Ventil 5 für n Minuten öffnen
                • manualDurationValve6 n - Ventil 6 für n Minuten öffnen
                • -
                • resetvalveerrors n - Ventilfehler zurücksetzen
                • +
                • resetValveErrors n - Ventilfehler zurücksetzen
                • resumeScheduleValve n - Zeitplan für Ventil n wieder aktivieren
                • stopScheduleValve n m - Zeitplan für Ventil n anhalten für m Stunden (Default: 2038-01-18T00:00:00.000Z, durch Gardena-App als "dauerhaft" interpretiert)
                • diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 2167974..32327a6 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-11_12:40:06 107803 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-11_14:24:26 107803 FHEM/74_GardenaSmartDevice.pm From 7b188e3e41f1aef7c48acd6599ac3cec6b9024fd Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 23 Aug 2022 11:24:21 +0200 Subject: [PATCH 120/126] [add] - wc reset valve, commandref --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 314 +++++++++++++++++++------------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 190 insertions(+), 128 deletions(-) diff --git a/CHANGED b/CHANGED index b612008..37eb437 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [enhancement] - add resetvalveerrors ic24 + Reviewed-by: Marko Oldenburg diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 6429842..019095c 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -563,7 +563,7 @@ sub Set { if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' ); $list .= -'manualOverride:slider,1,1,59 cancelOverride:noArg resumeSchedule:noArg stopSchedule manualButtonTime:slider,0,2,100' +'manualOverride:slider,1,1,59 cancelOverride:noArg resumeSchedule:noArg stopSchedule manualButtonTime:slider,0,2,100 resetValveErrors:noArg' if ( AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' ); @@ -1065,7 +1065,7 @@ sub setState { ## 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 ); ## set error type (pumpe required) - $error_type = ReadingsVal( $name, 'error-valve_error_'.$_.'_type', 'ok' ) if (ReadingsVal( $name, 'error-valve_error_'.$_.'_type', 'ok' ) ne 'ok'); + $error_type = ReadingsVal( $name, 'error-valve_error_'.$_.'_type', 'error' ) if (ReadingsVal( $name, 'error-valve_error_'.$_.'_type', 'error' ) ne 'ok'); ## 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 @@ -1291,6 +1291,7 @@ sub ReadingLangGerman { 'pump_not_filled' => 'Pumpe nicht gefüllt', 'clean_fine_filter' => 'Filter reinigen', 'concurrent_limit_reached' => 'Grenze gleichzeitig geöffneter Ventile erreicht', + 'low_battery_prevents_starting' => 'Niedrieger Batteriestand verhindert Bewässerung', ); if ( @@ -1560,10 +1561,10 @@ sub SetPredefinedStartPoints {
                • mower_type-serial_number - serial number
                • radio-quality - percentage of the radio quality
                • radio-state - radio state (bad/poor/good/undefined)
                • -
                • scheduling-schedules_event_1_end_at - ending time of schedule 1
                • -
                • scheduling-schedules_event_1_id - ID of schedule 1
                • -
                • scheduling-schedules_event_1_start_at - starting time of schedule 1
                • -
                • scheduling-schedules_event_1_weekly - weekdays of schedule 1(comma-separated)
                • +
                • scheduling-schedules_event_n_end_at - ending time of schedule 1
                • +
                • scheduling-schedules_event_n_id - ID of schedule 1
                • +
                • scheduling-schedules_event_n_start_at - starting time of schedule 1
                • +
                • scheduling-schedules_event_n_weekly - weekdays of schedule 1(comma-separated)
                • ...more readings for additional schedules (if defined)
                • scheduling-schedules_events_count - number of pre-defined schedules
                • startpoint-1-enabled - starpoint 1 enabled (0/1)
                • @@ -1621,10 +1622,10 @@ sub SetPredefinedStartPoints {
                • radio-state - radio state (bad/poor/good/undefined)
                • scheduling-scheduled_watering_end - next schedule ending time
                • scheduling-scheduled_watering_next_start - next schedule starting time
                • -
                • scheduling-schedules_event_1_valve_1_end_at - ending time of schedule 1
                • -
                • scheduling-schedules_event_1_valve_1_id - ID of schedule 1
                • -
                • scheduling-schedules_event_1_valve_1_start_at - starting time of schedule 1
                • -
                • scheduling-schedules_event_1_valve_1_weekly - weekdays of schedule 1
                • +
                • scheduling-schedules_event_n_valve_1_end_at - ending time of schedule 1
                • +
                • scheduling-schedules_event_n_valve_1_id - ID of schedule 1
                • +
                • scheduling-schedules_event_n_valve_1_start_at - starting time of schedule 1
                • +
                • scheduling-schedules_event_n_valve_1_weekly - weekdays of schedule 1
                • scheduling-schedules_events_count - number of pre-defined schedules
                • scheduling-schedules_paused_until - date/time until schedule is paused (2038-01-18T00:00:00.000Z is defined as permanently by Gardena cloud)
                • state - state of device @@ -1674,10 +1675,10 @@ sub SetPredefinedStartPoints {
                • scheduling-scheduled_watering_next_start - next schedule starting time
                • scheduling-scheduled_watering_next_start_1 - next schedule starting time for valve 1
                • ...more readings for valves 2-6
                • -
                • scheduling-schedules_event_1_valve_1_end_at - ending time of schedule 1
                • -
                • scheduling-schedules_event_1_valve_1_id - ID of schedule 1
                • -
                • scheduling-schedules_event_1_valve_1_start_at - starting time of schedule 1
                • -
                • scheduling-schedules_event_1_valve_1_weekly - weekdays of schedule 1
                • +
                • scheduling-schedules_event_n_valve_1_end_at - ending time of schedule 1
                • +
                • scheduling-schedules_event_n_valve_1_id - ID of schedule 1
                • +
                • scheduling-schedules_event_n_valve_1_start_at - starting time of schedule 1
                • +
                • scheduling-schedules_event_n_valve_1_weekly - weekdays of schedule 1
                • scheduling-schedules_events_count - number of pre-defined schedules
                • ...more readings for further schedules/valves
                • scheduling-schedules_paused_until_1 - date/time until schedule is paused (2038-01-18T00:00:00.000Z is defined as permanently by Gardena cloud)
                • @@ -1800,6 +1801,7 @@ sub SetPredefinedStartPoints {
                • cancelOverride - stop (manual) watering
                • manualButtonTime n - set watering time for manual button (0 disables button)
                • manualOverride n - manual watering for n minutes
                • +
                • resetValveErrors - reset valve errormessage
                • resumeSchedule - enable schedule
                • stopSchedule n - disable schedule for n hours (Default: 2038-01-18T00:00:00.000Z, Gardena App reads it as "permanently")
                • @@ -1821,7 +1823,7 @@ sub SetPredefinedStartPoints {
                • manualDurationValve4 n - open valve 4 for n minutes
                • manualDurationValve5 n - open valve 5 for n minutes
                • manualDurationValve6 n - open valve 6 for n minutes
                • -
                • resetValveErrors n - reset valve errormessage
                • +
                • resetValveErrors - reset valve errormessage
                • resumeScheduleValve n - (re)start irrigation schedule for valve n
                • stopScheduleValve n m - stop irrigation schedule for valve n (Default: 2038-01-18T00:00:00.000Z, Gardena App reads it as "permanently")
                • @@ -1974,10 +1976,10 @@ sub SetPredefinedStartPoints {
                • mower_type-serial_number - Seriennummer
                • radio-quality - Indikator für die Funkverbindung in Prozent
                • radio-state - Verbindungsqualität (schlecht/schwach/gut/Undefiniert)
                • -
                • scheduling-schedules_event_1_end_at - Endzeit des Zeitplans 1
                • -
                • scheduling-schedules_event_1_id - ID des Zeitplans 1
                • -
                • scheduling-schedules_event_1_start_at - Startzeit des Zeitplans 1
                • -
                • scheduling-schedules_event_1_weekly - Wochentage des Zeitplans 1 (kommagetrennt)
                • +
                • scheduling-schedules_event_n_end_at - Endzeit des Zeitplans 1
                • +
                • scheduling-schedules_event_n_id - ID des Zeitplans 1
                • +
                • scheduling-schedules_event_n_start_at - Startzeit des Zeitplans 1
                • +
                • scheduling-schedules_event_n_weekly - Wochentage des Zeitplans 1 (kommagetrennt)
                • ...weitere Readings für zusätzliche Zeitpläne (falls angelegt)
                • scheduling-schedules_events_count - Anzahl angelegter Zeitpläne
                • startpoint-1-enabled - starpoint 1 enabled (0/1)
                • @@ -2035,10 +2037,10 @@ sub SetPredefinedStartPoints {
                • radio-state - Verbindungsqualität (schlecht/schwach/gut/Undefiniert)
                • scheduling-scheduled_watering_end - Endzeit des nächsten Zeitplans
                • scheduling-scheduled_watering_next_start - Startzeit des nächsten Zeitplans
                • -
                • scheduling-schedules_event_1_valve_1_end_at - Endzeit von Zeitplan 1
                • -
                • scheduling-schedules_event_1_valve_1_id - ID von Zeitplan 1
                • -
                • scheduling-schedules_event_1_valve_1_start_at - Startzeit von Zeitplan 1
                • -
                • scheduling-schedules_event_1_valve_1_weekly - Wochentage von Zeitplan 1
                • +
                • scheduling-schedules_event_n_valve_1_end_at - Endzeit von Zeitplan 1
                • +
                • scheduling-schedules_event_n_valve_1_id - ID von Zeitplan 1
                • +
                • scheduling-schedules_event_n_valve_1_start_at - Startzeit von Zeitplan 1
                • +
                • scheduling-schedules_event_n_valve_1_weekly - Wochentage von Zeitplan 1
                • scheduling-schedules_events_count - Anzahl angelegter Zeitpläne
                • scheduling-schedules_paused_until - Datum/Uhrzeit, bis wann Zeitplan pausiert ist (2038-01-18T00:00:00.000Z wird von Gardena-Cloud als dauerhaft angesehen)
                • state - Status des Geräts @@ -2088,10 +2090,10 @@ sub SetPredefinedStartPoints {
                • scheduling-scheduled_watering_next_start - Startzeit des nächsten Zeitplans
                • scheduling-scheduled_watering_next_start_1 - Startzeit des nächsten Zeitplans für Ventil 1
                • ...weitere Readings für Ventile 2-6
                • -
                • scheduling-schedules_event_1_valve_n_end_at - Endzeit des ersten definierten Zeitplans für Ventil n
                • -
                • scheduling-schedules_event_1_valve_n_id - ID des ersten definierten Zeitplans für Ventil n
                • -
                • scheduling-schedules_event_1_valve_n_start_at - Startzeit des ersten definierten Zeitplans für Ventil n
                • -
                • scheduling-schedules_event_1_valve_n_weekly - Wochentage des ersten definierten Zeitplans für Ventil n
                • +
                • scheduling-schedules_event_n_end_at - Endzeit des ersten definierten Zeitplans für Ventil n
                • +
                • scheduling-schedules_event_n_id - ID des ersten definierten Zeitplans für Ventil n
                • +
                • scheduling-schedules_event_n_start_at - Startzeit des ersten definierten Zeitplans für Ventil n
                • +
                • scheduling-schedules_event_n_weekly - Wochentage des ersten definierten Zeitplans für Ventil n
                • scheduling-schedules_events_count - Anzahl angelegter Zeitpläne
                • ...weitere Readings für zusätzliche Zeitpläne/Ventile
                • scheduling-schedules_paused_until_1 - Datum/Uhrzeit, bis wann Zeitplan pausiert ist (2038-01-18T00:00:00.000Z wird von Gardena-Cloud als dauerhaft angesehen)
                • @@ -2108,7 +2110,7 @@ sub SetPredefinedStartPoints {
                • valve-valve_name_1 - Eigener Name für Ventil 1
                • ...weitere Readings für Ventile 2-6 (if installed)
                • -
                • watering-watering_timer_1_duration - Gesamt-Dauer der aktuellen Bewässerung in Sekunden
                • +
                • watering-watering_timer_1_duration - Gesamt-Dauer der aktuellen Bewässerung in Sekunden
                • watering-watering_timer_1_irrigation_left - Verbleibende Dauer der aktuellen Bewässerung in Minuten
                • watering-watering_timer_1_state - Status des Timers
                • watering-watering_timer_1_valve_id - Ventil-ID des Timers
                • @@ -2118,30 +2120,30 @@ sub SetPredefinedStartPoints {

                  Readings (model = sensor)
                    -
                  • ambient_temperature-frost_warning - Frostwarnung
                  • -
                  • ambient_temperature-temperature - Umgebungstemperatur in Celsius
                  • -
                  • battery-disposable_battery_status - Batteriezustand
                  • -
                  • battery-level - Ladezustand der Batterie in Prozent
                  • -
                  • device_info-category - Art des Geräts
                  • -
                  • device_info-connection_status - Verbindungsstatus (online/offline/unknown)
                  • -
                  • device_info-last_time_online - Zeitpunkt der letzten Funkübertragung
                  • -
                  • device_info-manufacturer - Hersteller
                  • -
                  • device_info-product - Produkttyp
                  • -
                  • device_info-serial_number - Seriennummer
                  • -
                  • device_info-sgtin - (tbd.)
                  • -
                  • device_info-version - Firmware Version
                  • -
                  • firmware-firmware_available_version - Neue Firmware (nur wenn verfügbar)
                  • -
                  • firmware-firmware_command - Firmware-Kommando (idle/firmware_cancel/firmware_upload/unsupported)
                  • -
                  • firmware-firmware_status - Firmware Status
                  • -
                  • firmware-firmware_upload_progress - Firmwareupdatestatus in Prozent
                  • -
                  • firmware-inclusion_status - Einbindungsstatus
                  • -
                  • humidity-humidity - Feuchtigkeit in Prozent
                  • -
                  • light-light - Helligkeit in Lux
                  • -
                  • radio-quality - Indikator für die Funkverbindung in Prozent
                  • -
                  • radio-state - Verbindungsqualität (schlecht/schwach/gut/Undefiniert)
                  • -
                  • soil_temperature-temperature - Erd-Temperatur in Celsius
                  • -
                  • state - Status (Temperatur (T:), Feuchtigkeit (H:), Helligkeit (L:)|offline|Winterschlaf)
                  • -
                  • winter_mode - Status Winterschlaf (awake/hibernate)
                  • +
                  • ambient_temperature-frost_warning - Frostwarnung
                  • +
                  • ambient_temperature-temperature - Umgebungstemperatur in Celsius
                  • +
                  • battery-disposable_battery_status - Batteriezustand
                  • +
                  • battery-level - Ladezustand der Batterie in Prozent
                  • +
                  • device_info-category - Art des Geräts
                  • +
                  • device_info-connection_status - Verbindungsstatus (online/offline/unknown)
                  • +
                  • device_info-last_time_online - Zeitpunkt der letzten Funkübertragung
                  • +
                  • device_info-manufacturer - Hersteller
                  • +
                  • device_info-product - Produkttyp
                  • +
                  • device_info-serial_number - Seriennummer
                  • +
                  • device_info-sgtin - (tbd.)
                  • +
                  • device_info-version - Firmware Version
                  • +
                  • firmware-firmware_available_version - Neue Firmware (nur wenn verfügbar)
                  • +
                  • firmware-firmware_command - Firmware-Kommando (idle/firmware_cancel/firmware_upload/unsupported)
                  • +
                  • firmware-firmware_status - Firmware Status
                  • +
                  • firmware-firmware_upload_progress - Firmwareupdatestatus in Prozent
                  • +
                  • firmware-inclusion_status - Einbindungsstatus
                  • +
                  • humidity-humidity - Feuchtigkeit in Prozent
                  • +
                  • light-light - Helligkeit in Lux
                  • +
                  • radio-quality - Indikator für die Funkverbindung in Prozent
                  • +
                  • radio-state - Verbindungsqualität (schlecht/schwach/gut/Undefiniert)
                  • +
                  • soil_temperature-temperature - Erd-Temperatur in Celsius
                  • +
                  • state - Status (Temperatur (T:), Feuchtigkeit (H:), Helligkeit (L:)|offline|Winterschlaf)
                  • +
                  • winter_mode - Status Winterschlaf (awake/hibernate)


                  Readings (model = sensor2) @@ -2149,122 +2151,182 @@ sub SetPredefinedStartPoints { "sensor2" hat keine Helligkeitsmessung oder Umgebungstemperatur, und es legt die Frost-Warnung in einem anderen Reading ab. Ansonsten ist er mehr oder weniger identisch zum "sensor".

                    -
                  • battery-disposable_battery_status - Batteriezustand
                  • -
                  • battery-level - Ladezustand der Batterie in Prozent
                  • -
                  • device_info-category - Art des Geräts
                  • -
                  • device_info-connection_status - Verbindungsstatus (online/offline/unknown)
                  • -
                  • device_info-last_time_online - Zeitpunkt der letzten Funkübertragung
                  • -
                  • device_info-manufacturer - Hersteller
                  • -
                  • device_info-product - Produkttyp
                  • -
                  • device_info-serial_number - Seriennummer
                  • -
                  • device_info-sgtin - (tbd.)
                  • -
                  • device_info-version - Firmware Version
                  • -
                  • firmware-firmware_available_version - Neue Firmware (nur wenn verfügbar)
                  • -
                  • firmware-firmware_command - Firmware-Kommando (idle/firmware_cancel/firmware_upload/unsupported)
                  • -
                  • firmware-firmware_status - Firmware Status
                  • -
                  • firmware-firmware_upload_progress - Firmwareupdatestatus in Prozent
                  • -
                  • firmware-inclusion_status - Einbindungsstatus
                  • -
                  • humidity-humidity - Feuchtigkeit in Prozent
                  • -
                  • radio-quality - Indikator für die Funkverbindung in Prozent
                  • -
                  • radio-state - Verbindungsqualität (schlecht/schwach/gut/Undefiniert)
                  • -
                  • soil_model-model_definition - (tbd.)
                  • -
                  • soil_model-model_status - (tbd.)
                  • -
                  • soil_temperature-frost-warning - Frostwarnung
                  • -
                  • soil_temperature-temperature - Erd-Temperatur in Celsius
                  • -
                  • state - Status (Temperatur (T:), Feuchtigkeit (H:), Helligkeit (L:)|offline|Winterschlaf)
                  • -
                  • winter_mode - Status Winterschlaf (awake/hibernate)
                  • +
                  • battery-disposable_battery_status - Batteriezustand
                  • +
                  • battery-level - Ladezustand der Batterie in Prozent
                  • +
                  • device_info-category - Art des Geräts
                  • +
                  • device_info-connection_status - Verbindungsstatus (online/offline/unknown)
                  • +
                  • device_info-last_time_online - Zeitpunkt der letzten Funkübertragung
                  • +
                  • device_info-manufacturer - Hersteller
                  • +
                  • device_info-product - Produkttyp
                  • +
                  • device_info-serial_number - Seriennummer
                  • +
                  • device_info-sgtin - (tbd.)
                  • +
                  • device_info-version - Firmware Version
                  • +
                  • firmware-firmware_available_version - Neue Firmware (nur wenn verfügbar)
                  • +
                  • firmware-firmware_command - Firmware-Kommando (idle/firmware_cancel/firmware_upload/unsupported)
                  • +
                  • firmware-firmware_status - Firmware Status
                  • +
                  • firmware-firmware_upload_progress - Firmwareupdatestatus in Prozent
                  • +
                  • firmware-inclusion_status - Einbindungsstatus
                  • +
                  • humidity-humidity - Feuchtigkeit in Prozent
                  • +
                  • radio-quality - Indikator für die Funkverbindung in Prozent
                  • +
                  • radio-state - Verbindungsqualität (schlecht/schwach/gut/Undefiniert)
                  • +
                  • soil_model-model_definition - (tbd.)
                  • +
                  • soil_model-model_status - (tbd.)
                  • +
                  • soil_temperature-frost-warning - Frostwarnung
                  • +
                  • soil_temperature-temperature - Erd-Temperatur in Celsius
                  • +
                  • state - Status (Temperatur (T:), Feuchtigkeit (H:), Helligkeit (L:)|offline|Winterschlaf)
                  • +
                  • winter_mode - Status Winterschlaf (awake/hibernate)


                  Readings (model = power)
                    -
                  • (tbd.)
                  • +
                  • (tbd.)


                  Readings (model = electronic_pressure_pump)
                    -
                  • (tbd.)
                  • +
                  • error-error - Fehlermeldung (tbd.)
                  • +
                  • error-valve_error_1_severity - (tbd.)
                  • +
                  • error-valve_error_1_type - (tbd.)
                  • +
                  • error-valve_error_1_valve_id - ID des fehlerhaften Ventils
                  • +
                  • firmware-firmware_available_version - Neue Firmware (nur wenn verfügbar)
                  • +
                  • firmware-firmware_command - Firmware-Kommando (idle/firmware_cancel/firmware_upload/unsupported)
                  • +
                  • firmware-firmware_status - Firmware Status
                  • +
                  • firmware-firmware_upload_progress - Firmwareupdatestatus in Prozent
                  • +
                  • firmware-inclusion_status - Einbindungsstatus
                  • +
                  • radio-quality - Indikator für die Funkverbindung in Prozent
                  • +
                  • radio-state - Verbindungsqualität (schlecht/schwach/gut/Undefiniert)
                  • + +
                  • scheduling-schedules_event_n__end_at - Endzeit des ersten definierten Zeitplans für Ventil n
                  • +
                  • scheduling-schedules_event_n_id - ID des ersten definierten Zeitplans für Ventil n
                  • +
                  • scheduling-schedules_event_n_start_at - Startzeit des ersten definierten Zeitplans für Ventil n
                  • +
                  • scheduling-schedules_event_n_weekly - Wochentage des ersten definierten Zeitplans für Ventil n
                  • +
                  • scheduling-schedules_events_count - Anzahl angelegter Zeitpläne
                  • +
                  • ...weitere Readings für zusätzliche Zeitpläne/Ventile
                  • +
                  • scheduling-schedules_paused_until_1 - Datum/Uhrzeit, bis wann Zeitplan pausiert ist (2038-01-18T00:00:00.000Z wird von Gardena-Cloud als dauerhaft angesehen)
                  • + +
                  • state - Status des Geräts +
                      +
                    • geschossen - Ventil geschlossen, keine Zeitpläne definiert
                    • +
                    • geschlossen. Zeitplan dauerhaft pausiert - Ventil geschlossen, Zeitplan dauerhaft pausiert
                    • +
                    • geschlossen. Nächste Bewässerung: YYYY-MM-DD HH:MM - Ventil geschlossen, nächster Zeitplan-Start YYYY-MM-DDTHH:MM:00.000Z
                    • +
                    • wird bewässert. n Minuten verbleibend - Bewässerung aktiv, n Minuten verbleibend (wenn 2 Ventile geöffnet sind, wird die längere Dauer angezeigt)
                    • +
                    • offline - Gerät ist ausgeschaltet/hat keine Verbindung
                    • +
                    • Winterschlaf - Gerät ist im Winterschlaf
                    • +
                    +
                  • + +
                  • watering-watering_timer_1_duration - Gesamt-Dauer der aktuellen Bewässerung in Sekunden
                  • +
                  • watering-watering_timer_1_irrigation_left - Verbleibende Dauer der aktuellen Bewässerung in Minuten
                  • +
                  • watering-watering_timer_1_state - Status des Timers
                  • +
                  • watering-watering_timer_1_valve_id - Ventil-ID des Timers
                  • +
                  • winter_mode - Status Winterschlaf (awake/hibernate)
                  • +
                  • Flussmengen und Lekage-Erkennung
                  • +
                  • flow-dripping_alert sixty
                  • +
                  • flow-flow_rate - FLussrate (600)
                  • +
                  • flow-flow_since_last_reset 13
                  • +
                  • flow-flow_total 20
                  • +
                  • leakage_detection - Status der Lekage-Konfiguration
                  • + +
                  • Status des Gerätes Temperataur und Druck-Einstellungen
                  • +
                  • outlet_pressure-outlet_pressure -
                  • +
                  • outlet_pressure-outlet_pressure_max 5.8
                  • +
                  • outlet_temperature-frost_warning - Frostwarnung
                  • +
                  • outlet_temperature-temperature - Außentemperatur
                  • +
                  • outlet_temperature-temperature_max - tbd. 100
                  • +
                  • outlet_temperature-temperature_min - tbd. 0
                  • + +
                  • Pumpen-Konfiguration
                  • +
                  • operating_mode - Modus der Pumpe
                  • + +
                  • Pumpenstatus aktuell
                  • +
                  • pump-mode - Modus der Pumpe
                  • +
                  • pump-operating_mode – Pumpenmodus automatic|scheduled
                  • +
                  • pump-pump_on_off - Pumpenzustand on|off
                  • +
                  • pump-pump_state - tbd
                  • +
                  • pump-turn_on_pressure - Einschaltdruck 2.0 - 3.0
                  • +



                  Attribute (alle Modelle)
                    -
                  • IODev - Name des GardenaSmartBridge Devices
                  • -
                  • model watering_computer|sensor|sensor2|mower|ic24|power|electronic_pressure_pump - Modell des - GardenaSmartDevice
                  • -
                  • readingValueLanguage en|de - Sprache der Readings englisch oder deutsch (default: englisch, es sei denn, - Deutsch ist als globale Sprache gesetzt)
                  • +
                  • IODev - Name des GardenaSmartBridge Devices
                  • +
                  • model watering_computer|sensor|sensor2|mower|ic24|power|electronic_pressure_pump - Modell des GardenaSmartDevice
                  • +
                  • readingValueLanguage en|de - Sprache der Readings englisch oder deutsch (default: englisch, es sei denn, Deutsch ist als globale Sprache gesetzt)



                  set (model = mower)
                    -
                  • parkUntilFurtherNotice - Parken des Mähers und Aussetzen des Zeitplans
                  • -
                  • parkUntilNextTimer - Parken bis zum nächsten Start nach Zeitplan
                  • -
                  • startOverrideTimer n - Manuelles Mähen für n Minuten (z.B. 60 = 1h, 1440 = 24h, 4320 = 72h)
                  • -
                  • startResumeSchedule - Zeitplan wieder aktivieren
                  • -
                  • startPoint enable|disable 1|2|3 - Aktiviert oder deaktiviert einen vordefinierten Startbereich
                  • -
                      -
                    • set NAME startpoint enable 1
                    • -
                    • set NAME startpoint disable 3 enable 1
                    • -
                    -
                  • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
                  • +
                  • parkUntilFurtherNotice - Parken des Mähers und Aussetzen des Zeitplans
                  • +
                  • parkUntilNextTimer - Parken bis zum nächsten Start nach Zeitplan
                  • +
                  • startOverrideTimer n - Manuelles Mähen für n Minuten (z.B. 60 = 1h, 1440 = 24h, 4320 = 72h)
                  • +
                  • startResumeSchedule - Zeitplan wieder aktivieren
                  • +
                  • startPoint enable|disable 1|2|3 - Aktiviert oder deaktiviert einen vordefinierten Startbereich
                  • +
                      +
                    • set NAME startpoint enable 1
                    • +
                    • set NAME startpoint disable 3 enable 1
                    • +
                    +
                  • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken


                  set (model = watering_computer)
                    -
                  • cancelOverride - (Manuelle) Bewässerung stoppen
                  • -
                  • manualButtonTime n - Bewässerungsdauer für manuellen Knopf auf n Minuten setzen (0 schaltet den Knopf aus) -
                  • -
                  • manualOverride n - Manuelle Bewässerung für n Minuten
                  • -
                  • resumeSchedule - Zeitplan wieder aktivieren
                  • -
                  • stopSchedule n - Zeitplan anhalten für n Stunden (Default: 2038-01-18T00:00:00.000Z, durch Gardena-App als - "dauerhaft" interpretiert)
                  • -
                  • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
                  • +
                  • cancelOverride - (Manuelle) Bewässerung stoppen
                  • +
                  • manualButtonTime n - Bewässerungsdauer für manuellen Knopf auf n Minuten setzen (0 schaltet den Knopf aus)
                  • +
                  • manualOverride n - Manuelle Bewässerung für n Minuten
                  • +
                  • resetValveErrors - Ventilfehler zurücksetzen
                  • +
                  • resumeSchedule - Zeitplan wieder aktivieren
                  • +
                  • stopSchedule n - Zeitplan anhalten für n Stunden (Default: 2038-01-18T00:00:00.000Z, durch Gardena-App als "dauerhaft" interpretiert)
                  • +
                  • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken


                  set (model = ic24)
                    -
                  • cancelOverrideValve1 - (Manuelle) Bewässerung an Ventil 1 stoppen
                  • -
                  • cancelOverrideValve2 - (Manuelle) Bewässerung an Ventil 2 stoppen
                  • -
                  • cancelOverrideValve3 - (Manuelle) Bewässerung an Ventil 3 stoppen
                  • -
                  • cancelOverrideValve4 - (Manuelle) Bewässerung an Ventil 4 stoppen
                  • -
                  • cancelOverrideValve5 - (Manuelle) Bewässerung an Ventil 5 stoppen
                  • -
                  • cancelOverrideValve6 - (Manuelle) Bewässerung an Ventil 6 stoppen
                  • -
                  • closeAllValves - Alle Ventile schliessen
                  • -
                  • manualDurationValve1 n - Ventil 1 für n Minuten öffnen
                  • -
                  • manualDurationValve2 n - Ventil 2 für n Minuten öffnen
                  • -
                  • manualDurationValve3 n - Ventil 3 für n Minuten öffnen
                  • -
                  • manualDurationValve4 n - Ventil 4 für n Minuten öffnen
                  • -
                  • manualDurationValve5 n - Ventil 5 für n Minuten öffnen
                  • -
                  • manualDurationValve6 n - Ventil 6 für n Minuten öffnen
                  • -
                  • resetValveErrors n - Ventilfehler zurücksetzen
                  • -
                  • resumeScheduleValve n - Zeitplan für Ventil n wieder aktivieren
                  • -
                  • stopScheduleValve n m - Zeitplan für Ventil n anhalten für m Stunden (Default: 2038-01-18T00:00:00.000Z, - durch Gardena-App als "dauerhaft" interpretiert)
                  • -
                  • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
                  • +
                  • cancelOverrideValve1 - (Manuelle) Bewässerung an Ventil 1 stoppen
                  • +
                  • cancelOverrideValve2 - (Manuelle) Bewässerung an Ventil 2 stoppen
                  • +
                  • cancelOverrideValve3 - (Manuelle) Bewässerung an Ventil 3 stoppen
                  • +
                  • cancelOverrideValve4 - (Manuelle) Bewässerung an Ventil 4 stoppen
                  • +
                  • cancelOverrideValve5 - (Manuelle) Bewässerung an Ventil 5 stoppen
                  • +
                  • cancelOverrideValve6 - (Manuelle) Bewässerung an Ventil 6 stoppen
                  • +
                  • closeAllValves - Alle Ventile schliessen
                  • +
                  • manualDurationValve1 n - Ventil 1 für n Minuten öffnen
                  • +
                  • manualDurationValve2 n - Ventil 2 für n Minuten öffnen
                  • +
                  • manualDurationValve3 n - Ventil 3 für n Minuten öffnen
                  • +
                  • manualDurationValve4 n - Ventil 4 für n Minuten öffnen
                  • +
                  • manualDurationValve5 n - Ventil 5 für n Minuten öffnen
                  • +
                  • manualDurationValve6 n - Ventil 6 für n Minuten öffnen
                  • +
                  • resetValveErrors - Ventilfehler zurücksetzen
                  • +
                  • resumeScheduleValve n - Zeitplan für Ventil n wieder aktivieren
                  • +
                  • stopScheduleValve n m - Zeitplan für Ventil n anhalten für m Stunden (Default: 2038-01-18T00:00:00.000Z durch Gardena-App als "dauerhaft" interpretiert)
                  • +
                  • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken


                  set (model = sensor)
                    -
                  • refresh temperature|humidity|light - Sensorwert für Temperatur, Feuchtigkeit oder Helligkeit aktualisieren -
                  • -
                  • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
                  • +
                  • refresh temperature|humidity|light - Sensorwert für Temperatur, Feuchtigkeit oder Helligkeit aktualisieren
                  • +
                  • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken


                  set (model = sensor2)
                    -
                  • refresh temperature|humidity - Sensorwert für Temperatur oder Feuchtigkeit aktualisieren
                  • -
                  • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
                  • +
                  • refresh temperature|humidity - Sensorwert für Temperatur oder Feuchtigkeit aktualisieren
                  • +
                  • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken


                  set (model = power)
                    -
                  • (tbd.)
                  • +
                  • (tbd.)


                  set (model = electronic_pressure_pump)
                    -
                  • (tbd.)
                  • +
                  • manualOverride n - Bewässerungdauer in Minuten
                  • +
                  • cancelOverride - (Manuelle) Bewässerung stoppen
                  • +
                  • operating_mode -Steuert den Operation Mode. Zeitgesteuert wird in Kombination mit dem Wochenzeitplan oder mit "manualOverride" genutzt, automatisch bedeutet, dass die Pumpe immer aktiv ist und die Bewässerung abhängig vom Wert "Einschaltdruck" startet. automatic|scheduled
                  • +
                  • leakage_detection - Steuert die Lekage-Erkennung.
                    Hierdurch wird eine Pumpenabschaltung erreicht, sollte die Pumpe unkontrollierten Wasserverlust feststellen. watering|washing_machine|domestic_water_supply|off
                  • +
                  • turn_on_pressure - Einschaltdruck 2.0 - 3.0 Steuert den Einschaltdruck in Scheduled und Automatic Mode. Fällt der Druck bei der Bewässerung unter diese wert, startet die Pumpe, ist der Wert dauerhaft über diesem Wert und es finden kein Durchfluss statt, geht die Pumpe in Standby
                  • +
                  • resetValveErrors - Ventilfehler zurücksetzen
                diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 32327a6..9d97520 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-11_14:24:26 107803 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-23_11:24:15 113481 FHEM/74_GardenaSmartDevice.pm From 3dd4796e14a62a379fe686dede035dc162d9ade3 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 23 Aug 2022 15:04:06 +0200 Subject: [PATCH 121/126] [try] - to setup cmdref to set webui --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 21 ++++++++++++++------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGED b/CHANGED index 37eb437..135aa9a 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - Reviewed-by: Marko Oldenburg + [add] - wc reset valve, commandref diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 019095c..0f72d33 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -2272,13 +2272,20 @@ sub SetPredefinedStartPoints {

                set (model = watering_computer)
                  -
                • cancelOverride - (Manuelle) Bewässerung stoppen
                • -
                • manualButtonTime n - Bewässerungsdauer für manuellen Knopf auf n Minuten setzen (0 schaltet den Knopf aus)
                • -
                • manualOverride n - Manuelle Bewässerung für n Minuten
                • -
                • resetValveErrors - Ventilfehler zurücksetzen
                • -
                • resumeSchedule - Zeitplan wieder aktivieren
                • -
                • stopSchedule n - Zeitplan anhalten für n Stunden (Default: 2038-01-18T00:00:00.000Z, durch Gardena-App als "dauerhaft" interpretiert)
                • -
                • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
                • + +
                • cancelOverride - (Manuelle) Bewässerung stoppen
                • + +
                • manualButtonTime n - Bewässerungsdauer für manuellen Knopf auf n Minuten setzen (0 schaltet den Knopf aus)
                • + +
                • manualOverride n - Manuelle Bewässerung für n Minuten
                • + +
                • resetValveErrors - Ventilfehler zurücksetzen
                • + +
                • resumeSchedule - Zeitplan wieder aktivieren
                • + +
                • stopSchedule n - Zeitplan anhalten für n Stunden (Default: 2038-01-18T00:00:00.000Z, durch Gardena-App als "dauerhaft" interpretiert)
                • + +
                • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken


                set (model = ic24) diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 9d97520..a8cdc7b 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-23_11:24:15 113481 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-23_13:25:59 113470 FHEM/74_GardenaSmartDevice.pm From 1f54fc7601c690232bf4a8f95eca4bd8c3626943 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 28 Aug 2022 20:11:11 +0200 Subject: [PATCH 122/126] [test] commandref --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 20 +++++++++++--------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/CHANGED b/CHANGED index 135aa9a..4c24952 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [add] - wc reset valve, commandref + [try] - to setup cmdref to set webui diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 0f72d33..f116d13 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -1445,7 +1445,7 @@ sub SetPredefinedStartPoints { =item summary_DE Modul zur Steuerung von GardenaSmartgeräten =begin html - +

                GardenaSmartDevice

                  In combination with Fhem device GardenaSmartBridge this Fhem module enables communication between GardenaCloud and @@ -1458,7 +1458,7 @@ sub SetPredefinedStartPoints {

                  So far, known devices are mower, smart water control, irrigation control, smart sensors, power plug and pressure pump. Schedules can be disabled/enabled via fhem, defining or deleting them must be done via Gardena App or its web interface.
                  - +

                  @@ -1771,7 +1771,7 @@ sub SetPredefinedStartPoints {
                • (tbd.)



                - + Attribute (all models)
                • IODev - Name of GardenaSmartBridge device
                • @@ -1781,7 +1781,7 @@ sub SetPredefinedStartPoints { set to german)



                - + set (model = mower)
                • parkUntilFurtherNotice - park mower and disable schedule
                • @@ -1857,7 +1857,7 @@ sub SetPredefinedStartPoints { =begin html_DE - +

                  GardenaSmartDevice

                    Zusammen mit dem Device GardenaSmartBridge stellt dieses Fhem-Modul die Kommunikation zwischen der GardenaCloud und @@ -1871,7 +1871,7 @@ sub SetPredefinedStartPoints { Bekannte Gardena-Geräte umfassen Rasenmäher, Smart Water Control, Irrigation Control, Smart Sensoren, Steckdosen-Adapter und Pumpe. Zeitpläne können über fhem pausiert/aktiviert werden, das Anlegen oder Löschen erfolgt derzeit nur über die App oder deren Web-Frontend. - +

                    @@ -2247,7 +2247,7 @@ sub SetPredefinedStartPoints {



                  - + Attribute (alle Modelle)
                  • IODev - Name des GardenaSmartBridge Devices
                  • @@ -2255,7 +2255,7 @@ sub SetPredefinedStartPoints {
                  • readingValueLanguage en|de - Sprache der Readings englisch oder deutsch (default: englisch, es sei denn, Deutsch ist als globale Sprache gesetzt)



                  - + set (model = mower)
                  • parkUntilFurtherNotice - Parken des Mähers und Aussetzen des Zeitplans
                  • @@ -2330,7 +2330,9 @@ sub SetPredefinedStartPoints {
                    • manualOverride n - Bewässerungdauer in Minuten
                    • cancelOverride - (Manuelle) Bewässerung stoppen
                    • -
                    • operating_mode -Steuert den Operation Mode. Zeitgesteuert wird in Kombination mit dem Wochenzeitplan oder mit "manualOverride" genutzt, automatisch bedeutet, dass die Pumpe immer aktiv ist und die Bewässerung abhängig vom Wert "Einschaltdruck" startet. automatic|scheduled
                    • + +
                    • operating_mode -Steuert den Operation Mode. Zeitgesteuert wird in Kombination mit dem Wochenzeitplan oder mit "manualOverride" genutzt, automatisch bedeutet, dass die Pumpe immer aktiv ist und die Bewässerung abhängig vom Wert "Einschaltdruck" startet. automatic|scheduled
                    • +
                    • leakage_detection - Steuert die Lekage-Erkennung.
                      Hierdurch wird eine Pumpenabschaltung erreicht, sollte die Pumpe unkontrollierten Wasserverlust feststellen. watering|washing_machine|domestic_water_supply|off
                    • turn_on_pressure - Einschaltdruck 2.0 - 3.0 Steuert den Einschaltdruck in Scheduled und Automatic Mode. Fällt der Druck bei der Bewässerung unter diese wert, startet die Pumpe, ist der Wert dauerhaft über diesem Wert und es finden kein Durchfluss statt, geht die Pumpe in Standby
                    • resetValveErrors - Ventilfehler zurücksetzen
                    • diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index a8cdc7b..ecfa04c 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-23_13:25:59 113470 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-28_20:08:30 113470 FHEM/74_GardenaSmartDevice.pm From 8c49aaa07976790ead6a86a46500c30d2cc587a4 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 30 Aug 2022 16:23:00 +0200 Subject: [PATCH 123/126] [enhancement] - commandref --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 257 +++++++++++++++++++------------- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 152 insertions(+), 109 deletions(-) diff --git a/CHANGED b/CHANGED index 4c24952..245398c 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [try] - to setup cmdref to set webui + [test] commandref diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index f116d13..5a67e7e 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -1458,9 +1458,9 @@ sub SetPredefinedStartPoints {

                      So far, known devices are mower, smart water control, irrigation control, smart sensors, power plug and pressure pump. Schedules can be disabled/enabled via fhem, defining or deleting them must be done via Gardena App or its web interface.
                      -

                    +
                      Readings (model = mower)

                      @@ -1659,7 +1659,7 @@ sub SetPredefinedStartPoints {
                    • error-valve_error_0_severity - (tbd.)
                    • error-valve_error_0_type - (tbd.)
                    • error-valve_error_0_valve_id - id of valve with error
                    • -
                    • ...more error readings
                    • +
                    • ...more error readings
                    • firmware-firmware_available_version - new available firmware (only if available)
                    • firmware-firmware_command - firmware command (idle/firmware_cancel/firmware_upload/unsupported)
                    • firmware-firmware_status - firmware status
                    • @@ -1771,7 +1771,7 @@ sub SetPredefinedStartPoints {
                    • (tbd.)



                    - + Attribute (all models)
                    • IODev - Name of GardenaSmartBridge device
                    • @@ -1781,7 +1781,7 @@ sub SetPredefinedStartPoints { set to german)



                    - + set (model = mower)
                    • parkUntilFurtherNotice - park mower and disable schedule
                    • @@ -1857,6 +1857,7 @@ sub SetPredefinedStartPoints { =begin html_DE +

                      GardenaSmartDevice

                        @@ -1871,9 +1872,60 @@ sub SetPredefinedStartPoints { Bekannte Gardena-Geräte umfassen Rasenmäher, Smart Water Control, Irrigation Control, Smart Sensoren, Steckdosen-Adapter und Pumpe. Zeitpläne können über fhem pausiert/aktiviert werden, das Anlegen oder Löschen erfolgt derzeit nur über die App oder deren Web-Frontend. -
                      +
                      + +
                    • parkUntilFurtherNotice - Parken des Mähers und Aussetzen des Zeitplans
                    • +
                    • parkUntilNextTimer - Parken bis zum nächsten Start nach Zeitplan
                    • +
                    • startOverrideTimer n - Manuelles Mähen für n Minuten (z.B. 60 = 1h, 1440 = 24h, 4320 = 72h)
                    • +
                    • startResumeSchedule - Zeitplan wieder aktivieren
                    • +
                    • startpoint enable|disable 1|2|3 - Aktiviert oder deaktiviert einen vordefinierten Startbereich +
                        +
                      • set NAME startpoint enable 1
                      • +
                      • set NAME startpoint disable 3 enable 1
                      • +
                      +
                    • + +
                    • cancelOverride - (Manuelle) Bewässerung stoppen
                    • +
                    • manualButtonTime n - Bewässerungsdauer für manuellen Knopf auf n Minuten setzen (0 schaltet den Knopf aus)
                    • +
                    • manualOverride n - Manuelle Bewässerung für n Minuten
                    • +
                    • resetValveErrors - Ventilfehler zurücksetzen
                    • +
                    • resumeSchedule - Zeitplan wieder aktivieren
                    • +
                    • stopSchedule n - Zeitplan anhalten für n Stunden (Default: 2038-01-18T00:00:00.000Z, durch Gardena-App als "dauerhaft" interpretiert)
                    • + +
                    • operating_mode -Steuert den Operation Mode. Zeitgesteuert wird in Kombination mit dem Wochenzeitplan oder mit "manualOverride" genutzt, automatisch bedeutet, dass die Pumpe immer aktiv ist und die Bewässerung abhängig vom Wert "Einschaltdruck" startet. automatic|scheduled
                    • +
                    • leakage_detection - Steuert die Lekage-Erkennung.
                      Hierdurch wird eine Pumpenabschaltung erreicht, sollte die Pumpe unkontrollierten Wasserverlust feststellen. watering|washing_machine|domestic_water_supply|off
                    • +
                    • turn_on_pressure - Einschaltdruck 2.0 - 3.0 Steuert den Einschaltdruck in Scheduled und Automatic Mode. Fällt der Druck bei der Bewässerung unter diese wert, startet die Pumpe, ist der Wert dauerhaft über diesem Wert und es finden kein Durchfluss statt, geht die Pumpe in Standby
                    • + +
                    • cancelOverrideValve1 - (Manuelle) Bewässerung an Ventil 1 stoppen
                    • +
                    • cancelOverrideValve2 - (Manuelle) Bewässerung an Ventil 2 stoppen
                    • +
                    • cancelOverrideValve3 - (Manuelle) Bewässerung an Ventil 3 stoppen
                    • +
                    • cancelOverrideValve4 - (Manuelle) Bewässerung an Ventil 4 stoppen
                    • +
                    • cancelOverrideValve5 - (Manuelle) Bewässerung an Ventil 5 stoppen
                    • +
                    • cancelOverrideValve6 - (Manuelle) Bewässerung an Ventil 6 stoppen
                    • +
                    • closeAllValves - Alle Ventile schliessen
                    • +
                    • manualDurationValve1 n - Ventil 1 für n Minuten öffnen
                    • +
                    • manualDurationValve2 n - Ventil 2 für n Minuten öffnen
                    • +
                    • manualDurationValve3 n - Ventil 3 für n Minuten öffnen
                    • +
                    • manualDurationValve4 n - Ventil 4 für n Minuten öffnen
                    • +
                    • manualDurationValve5 n - Ventil 5 für n Minuten öffnen
                    • +
                    • manualDurationValve6 n - Ventil 6 für n Minuten öffnen
                    • +
                    • resumeScheduleValve n - Zeitplan für Ventil n wieder aktivieren
                    • +
                    • stopScheduleValve n m - Zeitplan für Ventil n anhalten für m Stunden (Default: 2038-01-18T00:00:00.000Z durch Gardena-App als "dauerhaft" interpretiert)
                    • + +
                    • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
                    • + +
                    • refresh temperature|humidity|light* +
                      + Wert für Temperatur, Feuchtigkeit oder Helligkeit aktualisieren +
                      *nur bei Sensor type 1 verfügbar +
                    • + + + +

                      +
                        Readings (model = mower/Mäher)

                        @@ -1884,7 +1936,7 @@ sub SetPredefinedStartPoints {
                      • battery-level - Ladezustand der Batterie in Prozent
                      • battery-rechargeable_battery_status - Zustand der Batterie (Ausser Betrieb/Kritischer Batteriestand, wechseln Sie jetzt/Niedrig/oK), nicht bei allen Modellen
                      • -
                      • device_info-connection_status - Verbindungs-Status (online/offline/unknown) +
                      • device_info-connection_status - Verbindungs-Status (online/offline/unknown)
                      • device_info-category - Eigenschaft des Gerätes (Mäher/Bewässerungscomputer/Bodensensor)
                      • device_info-last_time_online - Zeitpunkt der letzten Funkübertragung
                      • device_info-manufacturer - Hersteller
                      • @@ -1982,7 +2034,7 @@ sub SetPredefinedStartPoints {
                      • scheduling-schedules_event_n_weekly - Wochentage des Zeitplans 1 (kommagetrennt)
                      • ...weitere Readings für zusätzliche Zeitpläne (falls angelegt)
                      • scheduling-schedules_events_count - Anzahl angelegter Zeitpläne
                      • -
                      • startpoint-1-enabled - starpoint 1 enabled (0/1)
                      • +
                      • startpoint-1-enabled - starpoint 1 enabled (0/1)
                      • ...weitere Readings für zusätzliche Startpunkte (falls angelegt)
                      • state - Status des Mähers
                          @@ -2014,7 +2066,7 @@ sub SetPredefinedStartPoints {
                          • ambient_temperature-temperature - Umgebungstemperatur in Celsius
                          • battery-disposable_battery_status - Batteriezustand
                          • -
                          • battery-level - Ladezustand der Batterie in Prozent
                          • +
                          • battery-level - Ladezustand der Batterie in Prozent
                          • device_info-category - Art des Geräts
                          • device_info-connection_status - Verbindungsstatus (online/offline/unknown)
                          • device_info-last_time_online - Zeitpunkt der letzten Funkübertragung
                          • @@ -2053,7 +2105,7 @@ sub SetPredefinedStartPoints {
                          • Winterschlaf - Gerät ist im Winterschlaf
                          -
                        • watering-watering_timer_1_duration - Gesamt-Dauer der aktuellen Bewässerung in Sekunden
                        • +
                        • watering-watering_timer_1_duration - Gesamt-Dauer der aktuellen Bewässerung in Sekunden
                        • watering-watering_timer_1_irrigation_left - Verbleibende Bewässerungszeit in Minuten
                        • watering-watering_timer_1_state - Status des Zeitplans
                        • watering-watering_timer_1_valve_id - Ventil-ID des Zeitplans
                        • @@ -2121,29 +2173,29 @@ sub SetPredefinedStartPoints { Readings (model = sensor)
                          • ambient_temperature-frost_warning - Frostwarnung
                          • -
                          • ambient_temperature-temperature - Umgebungstemperatur in Celsius
                          • -
                          • battery-disposable_battery_status - Batteriezustand
                          • +
                          • ambient_temperature-temperature - Umgebungstemperatur in Celsius
                          • +
                          • battery-disposable_battery_status - Batteriezustand
                          • battery-level - Ladezustand der Batterie in Prozent
                          • -
                          • device_info-category - Art des Geräts
                          • -
                          • device_info-connection_status - Verbindungsstatus (online/offline/unknown)
                          • -
                          • device_info-last_time_online - Zeitpunkt der letzten Funkübertragung
                          • -
                          • device_info-manufacturer - Hersteller
                          • -
                          • device_info-product - Produkttyp
                          • -
                          • device_info-serial_number - Seriennummer
                          • -
                          • device_info-sgtin - (tbd.)
                          • -
                          • device_info-version - Firmware Version
                          • -
                          • firmware-firmware_available_version - Neue Firmware (nur wenn verfügbar)
                          • -
                          • firmware-firmware_command - Firmware-Kommando (idle/firmware_cancel/firmware_upload/unsupported)
                          • -
                          • firmware-firmware_status - Firmware Status
                          • -
                          • firmware-firmware_upload_progress - Firmwareupdatestatus in Prozent
                          • -
                          • firmware-inclusion_status - Einbindungsstatus
                          • +
                          • device_info-category - Art des Geräts
                          • +
                          • device_info-connection_status - Verbindungsstatus (online/offline/unknown)
                          • +
                          • device_info-last_time_online - Zeitpunkt der letzten Funkübertragung
                          • +
                          • device_info-manufacturer - Hersteller
                          • +
                          • device_info-product - Produkttyp
                          • +
                          • device_info-serial_number - Seriennummer
                          • +
                          • device_info-sgtin - (tbd.)
                          • +
                          • device_info-version - Firmware Version
                          • +
                          • firmware-firmware_available_version - Neue Firmware (nur wenn verfügbar)
                          • +
                          • firmware-firmware_command - Firmware-Kommando (idle/firmware_cancel/firmware_upload/unsupported)
                          • +
                          • firmware-firmware_status - Firmware Status
                          • +
                          • firmware-firmware_upload_progress - Firmwareupdatestatus in Prozent
                          • +
                          • firmware-inclusion_status - Einbindungsstatus
                          • humidity-humidity - Feuchtigkeit in Prozent
                          • -
                          • light-light - Helligkeit in Lux
                          • -
                          • radio-quality - Indikator für die Funkverbindung in Prozent
                          • -
                          • radio-state - Verbindungsqualität (schlecht/schwach/gut/Undefiniert)
                          • -
                          • soil_temperature-temperature - Erd-Temperatur in Celsius
                          • -
                          • state - Status (Temperatur (T:), Feuchtigkeit (H:), Helligkeit (L:)|offline|Winterschlaf)
                          • -
                          • winter_mode - Status Winterschlaf (awake/hibernate)
                          • +
                          • light-light - Helligkeit in Lux
                          • +
                          • radio-quality - Indikator für die Funkverbindung in Prozent
                          • +
                          • radio-state - Verbindungsqualität (schlecht/schwach/gut/Undefiniert)
                          • +
                          • soil_temperature-temperature - Erd-Temperatur in Celsius
                          • +
                          • state - Status (Temperatur (T:), Feuchtigkeit (H:), Helligkeit (L:)|offline|Winterschlaf)
                          • +
                          • winter_mode - Status Winterschlaf (awake/hibernate)


                          Readings (model = sensor2) @@ -2151,30 +2203,30 @@ sub SetPredefinedStartPoints { "sensor2" hat keine Helligkeitsmessung oder Umgebungstemperatur, und es legt die Frost-Warnung in einem anderen Reading ab. Ansonsten ist er mehr oder weniger identisch zum "sensor".

                            -
                          • battery-disposable_battery_status - Batteriezustand
                          • -
                          • battery-level - Ladezustand der Batterie in Prozent
                          • -
                          • device_info-category - Art des Geräts
                          • -
                          • device_info-connection_status - Verbindungsstatus (online/offline/unknown)
                          • -
                          • device_info-last_time_online - Zeitpunkt der letzten Funkübertragung
                          • -
                          • device_info-manufacturer - Hersteller
                          • -
                          • device_info-product - Produkttyp
                          • -
                          • device_info-serial_number - Seriennummer
                          • -
                          • device_info-sgtin - (tbd.)
                          • -
                          • device_info-version - Firmware Version
                          • -
                          • firmware-firmware_available_version - Neue Firmware (nur wenn verfügbar)
                          • -
                          • firmware-firmware_command - Firmware-Kommando (idle/firmware_cancel/firmware_upload/unsupported)
                          • -
                          • firmware-firmware_status - Firmware Status
                          • -
                          • firmware-firmware_upload_progress - Firmwareupdatestatus in Prozent
                          • -
                          • firmware-inclusion_status - Einbindungsstatus
                          • +
                          • battery-disposable_battery_status - Batteriezustand
                          • +
                          • battery-level - Ladezustand der Batterie in Prozent
                          • +
                          • device_info-category - Art des Geräts
                          • +
                          • device_info-connection_status - Verbindungsstatus (online/offline/unknown)
                          • +
                          • device_info-last_time_online - Zeitpunkt der letzten Funkübertragung
                          • +
                          • device_info-manufacturer - Hersteller
                          • +
                          • device_info-product - Produkttyp
                          • +
                          • device_info-serial_number - Seriennummer
                          • +
                          • device_info-sgtin - (tbd.)
                          • +
                          • device_info-version - Firmware Version
                          • +
                          • firmware-firmware_available_version - Neue Firmware (nur wenn verfügbar)
                          • +
                          • firmware-firmware_command - Firmware-Kommando (idle/firmware_cancel/firmware_upload/unsupported)
                          • +
                          • firmware-firmware_status - Firmware Status
                          • +
                          • firmware-firmware_upload_progress - Firmwareupdatestatus in Prozent
                          • +
                          • firmware-inclusion_status - Einbindungsstatus
                          • humidity-humidity - Feuchtigkeit in Prozent
                          • -
                          • radio-quality - Indikator für die Funkverbindung in Prozent
                          • -
                          • radio-state - Verbindungsqualität (schlecht/schwach/gut/Undefiniert)
                          • -
                          • soil_model-model_definition - (tbd.)
                          • -
                          • soil_model-model_status - (tbd.)
                          • -
                          • soil_temperature-frost-warning - Frostwarnung
                          • -
                          • soil_temperature-temperature - Erd-Temperatur in Celsius
                          • -
                          • state - Status (Temperatur (T:), Feuchtigkeit (H:), Helligkeit (L:)|offline|Winterschlaf)
                          • -
                          • winter_mode - Status Winterschlaf (awake/hibernate)
                          • +
                          • radio-quality - Indikator für die Funkverbindung in Prozent
                          • +
                          • radio-state - Verbindungsqualität (schlecht/schwach/gut/Undefiniert)
                          • +
                          • soil_model-model_definition - (tbd.)
                          • +
                          • soil_model-model_status - (tbd.)
                          • +
                          • soil_temperature-frost-warning - Frostwarnung
                          • +
                          • soil_temperature-temperature - Erd-Temperatur in Celsius
                          • +
                          • state - Status (Temperatur (T:), Feuchtigkeit (H:), Helligkeit (L:)|offline|Winterschlaf)
                          • +
                          • winter_mode - Status Winterschlaf (awake/hibernate)


                          Readings (model = power) @@ -2247,22 +2299,21 @@ sub SetPredefinedStartPoints {



                        - +
                      Attribute (alle Modelle)
                      • IODev - Name des GardenaSmartBridge Devices
                      • model watering_computer|sensor|sensor2|mower|ic24|power|electronic_pressure_pump - Modell des GardenaSmartDevice
                      • readingValueLanguage en|de - Sprache der Readings englisch oder deutsch (default: englisch, es sei denn, Deutsch ist als globale Sprache gesetzt)
                      -


                      - +


                      set (model = mower)
                        -
                      • parkUntilFurtherNotice - Parken des Mähers und Aussetzen des Zeitplans
                      • -
                      • parkUntilNextTimer - Parken bis zum nächsten Start nach Zeitplan
                      • -
                      • startOverrideTimer n - Manuelles Mähen für n Minuten (z.B. 60 = 1h, 1440 = 24h, 4320 = 72h)
                      • -
                      • startResumeSchedule - Zeitplan wieder aktivieren
                      • -
                      • startPoint enable|disable 1|2|3 - Aktiviert oder deaktiviert einen vordefinierten Startbereich
                      • +
                      • parkUntilFurtherNotice - Parken des Mähers und Aussetzen des Zeitplans
                      • +
                      • parkUntilNextTimer - Parken bis zum nächsten Start nach Zeitplan
                      • +
                      • startOverrideTimer n - Manuelles Mähen für n Minuten (z.B. 60 = 1h, 1440 = 24h, 4320 = 72h)
                      • +
                      • startResumeSchedule - Zeitplan wieder aktivieren
                      • +
                      • startPoint enable|disable 1|2|3 - Aktiviert oder deaktiviert einen vordefinierten Startbereich
                        • set NAME startpoint enable 1
                        • set NAME startpoint disable 3 enable 1
                        • @@ -2270,74 +2321,66 @@ sub SetPredefinedStartPoints {
                        • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken


                        - set (model = watering_computer) + set (model = watering_computer)
                          - -
                        • cancelOverride - (Manuelle) Bewässerung stoppen
                        • - -
                        • manualButtonTime n - Bewässerungsdauer für manuellen Knopf auf n Minuten setzen (0 schaltet den Knopf aus)
                        • - -
                        • manualOverride n - Manuelle Bewässerung für n Minuten
                        • - -
                        • resetValveErrors - Ventilfehler zurücksetzen
                        • - -
                        • resumeSchedule - Zeitplan wieder aktivieren
                        • - -
                        • stopSchedule n - Zeitplan anhalten für n Stunden (Default: 2038-01-18T00:00:00.000Z, durch Gardena-App als "dauerhaft" interpretiert)
                        • - -
                        • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
                        • +
                        • cancelOverride - (Manuelle) Bewässerung stoppen
                        • +
                        • manualButtonTime n - Bewässerungsdauer für manuellen Knopf auf n Minuten setzen (0 schaltet den Knopf aus)
                        • +
                        • manualOverride n - Manuelle Bewässerung für n Minuten
                        • +
                        • resetValveErrors - Ventilfehler zurücksetzen
                        • +
                        • resumeSchedule - Zeitplan wieder aktivieren
                        • +
                        • stopSchedule n - Zeitplan anhalten für n Stunden (Default: 2038-01-18T00:00:00.000Z, durch Gardena-App als "dauerhaft" interpretiert)
                        • +
                        • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken


                        - set (model = ic24) + set (model = ic24)
                          -
                        • cancelOverrideValve1 - (Manuelle) Bewässerung an Ventil 1 stoppen
                        • -
                        • cancelOverrideValve2 - (Manuelle) Bewässerung an Ventil 2 stoppen
                        • -
                        • cancelOverrideValve3 - (Manuelle) Bewässerung an Ventil 3 stoppen
                        • -
                        • cancelOverrideValve4 - (Manuelle) Bewässerung an Ventil 4 stoppen
                        • -
                        • cancelOverrideValve5 - (Manuelle) Bewässerung an Ventil 5 stoppen
                        • -
                        • cancelOverrideValve6 - (Manuelle) Bewässerung an Ventil 6 stoppen
                        • -
                        • closeAllValves - Alle Ventile schliessen
                        • -
                        • manualDurationValve1 n - Ventil 1 für n Minuten öffnen
                        • -
                        • manualDurationValve2 n - Ventil 2 für n Minuten öffnen
                        • -
                        • manualDurationValve3 n - Ventil 3 für n Minuten öffnen
                        • -
                        • manualDurationValve4 n - Ventil 4 für n Minuten öffnen
                        • -
                        • manualDurationValve5 n - Ventil 5 für n Minuten öffnen
                        • -
                        • manualDurationValve6 n - Ventil 6 für n Minuten öffnen
                        • -
                        • resetValveErrors - Ventilfehler zurücksetzen
                        • -
                        • resumeScheduleValve n - Zeitplan für Ventil n wieder aktivieren
                        • -
                        • stopScheduleValve n m - Zeitplan für Ventil n anhalten für m Stunden (Default: 2038-01-18T00:00:00.000Z durch Gardena-App als "dauerhaft" interpretiert)
                        • -
                        • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
                        • +
                        • cancelOverrideValve1 - (Manuelle) Bewässerung an Ventil 1 stoppen
                        • +
                        • cancelOverrideValve2 - (Manuelle) Bewässerung an Ventil 2 stoppen
                        • +
                        • cancelOverrideValve3 - (Manuelle) Bewässerung an Ventil 3 stoppen
                        • +
                        • cancelOverrideValve4 - (Manuelle) Bewässerung an Ventil 4 stoppen
                        • +
                        • cancelOverrideValve5 - (Manuelle) Bewässerung an Ventil 5 stoppen
                        • +
                        • cancelOverrideValve6 - (Manuelle) Bewässerung an Ventil 6 stoppen
                        • +
                        • closeAllValves - Alle Ventile schliessen
                        • +
                        • manualDurationValve1 n - Ventil 1 für n Minuten öffnen
                        • +
                        • manualDurationValve2 n - Ventil 2 für n Minuten öffnen
                        • +
                        • manualDurationValve3 n - Ventil 3 für n Minuten öffnen
                        • +
                        • manualDurationValve4 n - Ventil 4 für n Minuten öffnen
                        • +
                        • manualDurationValve5 n - Ventil 5 für n Minuten öffnen
                        • +
                        • manualDurationValve6 n - Ventil 6 für n Minuten öffnen
                        • +
                        • resetValveErrors - Ventilfehler zurücksetzen
                        • +
                        • resumeScheduleValve n - Zeitplan für Ventil n wieder aktivieren
                        • +
                        • stopScheduleValve n m - Zeitplan für Ventil n anhalten für m Stunden (Default: 2038-01-18T00:00:00.000Z durch Gardena-App als "dauerhaft" interpretiert)
                        • +
                        • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken


                        set (model = sensor)
                          -
                        • refresh temperature|humidity|light - Sensorwert für Temperatur, Feuchtigkeit oder Helligkeit aktualisieren
                        • -
                        • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
                        • +
                        • refresh temperature|humidity|light - Sensorwert für Temperatur, Feuchtigkeit oder Helligkeit aktualisieren
                        • +
                        • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken


                        set (model = sensor2)
                          -
                        • refresh temperature|humidity - Sensorwert für Temperatur oder Feuchtigkeit aktualisieren
                        • -
                        • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
                        • +
                        • refresh temperature|humidity - Sensorwert für Temperatur oder Feuchtigkeit aktualisieren
                        • +
                        • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken


                        set (model = power)
                          -
                        • (tbd.)
                        • +
                        • (tbd.)


                        set (model = electronic_pressure_pump) -
                      + =end html_DE diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index ecfa04c..a046664 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-28_20:08:30 113470 FHEM/74_GardenaSmartDevice.pm +UPD 2022-08-30_16:22:11 118212 FHEM/74_GardenaSmartDevice.pm From b61c32a850f194d283f15ed392622578ef6a9add Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 6 Sep 2022 12:32:40 +0200 Subject: [PATCH 124/126] [enhancement] - commandref --- CHANGED | 2 +- FHEM/74_GardenaSmartDevice.pm | 55 ++++++++++++++++++++++++++++++++- controls_GardenaSmartDevice.txt | 2 +- 3 files changed, 56 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 245398c..2de9fa3 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [test] commandref + [enhancement] - commandref diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 5a67e7e..8b0c0cc 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -1460,6 +1460,59 @@ sub SetPredefinedStartPoints { pump. Schedules can be disabled/enabled via fhem, defining or deleting them must be done via Gardena App or its web interface.

                    +
                    + +
                  • parkUntilFurtherNotice - park mower and disable schedule
                  • +
                  • parkUntilNextTimer - park mower until next schedule
                  • +
                  • startOverrideTimer n - manual mowing for n minutes (e.g. 60 = 1h, 1440 = 24h, 4320 = 72h)
                  • +
                  • startResumeSchedule - enable schedule
                  • +
                  • startpoint enable|disable 1|2|3 - nable or disable pre-defined starting points +
                      +
                    • set NAME startpoint enable 1
                    • +
                    • set NAME startpoint disable 3 enable 1
                    • +
                    +
                  • + +
                  • cancelOverride - stop (manual) watering
                  • +
                  • manualButtonTime n - set watering time for manual button (0 disables button)
                  • +
                  • manualOverride n - manual watering for n minutes
                  • +
                  • resetValveErrors - Vreset valve errormessage
                  • +
                  • resumeSchedule - enable schedule
                  • +
                  • stopSchedule n - disable schedule for n hours (Default: 2038-01-18T00:00:00.000Z, Gardena App reads it as + "permanently")
                  • + +
                  • operating_mode -Steuert den Operation Mode. Zeitgesteuert wird in Kombination mit dem Wochenzeitplan oder mit "manualOverride" genutzt, automatisch bedeutet, dass die Pumpe immer aktiv ist und die Bewässerung abhängig vom Wert "Einschaltdruck" startet. automatic|scheduled
                  • +
                  • leakage_detection - Steuert die Lekage-Erkennung.
                    Hierdurch wird eine Pumpenabschaltung erreicht, sollte die Pumpe unkontrollierten Wasserverlust feststellen. watering|washing_machine|domestic_water_supply|off
                  • +
                  • turn_on_pressure - Einschaltdruck 2.0 - 3.0 Steuert den Einschaltdruck in Scheduled und Automatic Mode. Fällt der Druck bei der Bewässerung unter diese wert, startet die Pumpe, ist der Wert dauerhaft über diesem Wert und es finden kein Durchfluss statt, geht die Pumpe in Standby
                  • + +
                  • cancelOverrideValve1 - stop (manual) watering for valve 1
                  • +
                  • cancelOverrideValve2 - stop (manual) watering for valve 2
                  • +
                  • cancelOverrideValve3 - stop (manual) watering for valve 3
                  • +
                  • cancelOverrideValve4 - stop (manual) watering for valve 4
                  • +
                  • cancelOverrideValve5 - stop (manual) watering for valve 5
                  • +
                  • cancelOverrideValve6 - stop (manual) watering for valve 6
                  • +
                  • closeAllValves - close all valves
                  • +
                  • manualDurationValve1 n - open valve 1 for n minutes
                  • +
                  • manualDurationValve2 n - open valve 2 for n minutes
                  • +
                  • manualDurationValve3 n - open valve 3 for n minutes
                  • +
                  • manualDurationValve4 n - open valve 4 for n minutes
                  • +
                  • manualDurationValve5 n - open valve 5 for n minutes
                  • +
                  • manualDurationValve6 n - open valve 6 for n minutes
                  • +
                  • resumeScheduleValve n - (re)start irrigation schedule for valve n
                  • +
                  • stopScheduleValve n m - stop irrigation schedule for valve n (Default: 2038-01-18T00:00:00.000Z, Gardena + App reads it as "permanently")
                  • + +
                  • winter_mode awake|hibernate - disable or enable winter mode
                  • + +
                  • refresh temperature|humidity|light* +
                    + refresh sensor reading for temperature, humidity or daylight +
                    *only Sensor type 1 +
                  • + + + +
                      Readings (model = mower) @@ -1805,7 +1858,7 @@ sub SetPredefinedStartPoints {
                    • resumeSchedule - enable schedule
                    • stopSchedule n - disable schedule for n hours (Default: 2038-01-18T00:00:00.000Z, Gardena App reads it as "permanently")
                    • -
                    • winter_mode awake|hibernate - Disable or enable winter mode
                    • +
                    • winter_mode awake|hibernate - disable or enable winter mode


                    set (model = ic24) diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index a046664..3f3bf01 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-08-30_16:22:11 118212 FHEM/74_GardenaSmartDevice.pm +UPD 2022-09-06_12:31:38 123049 FHEM/74_GardenaSmartDevice.pm From eebe13bb7bb63c767020501f283e69518c168ed9 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 6 Sep 2022 14:34:38 +0200 Subject: [PATCH 125/126] spellcheck + corrections --- 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 2de9fa3..37eb437 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - [enhancement] - commandref + Reviewed-by: Marko Oldenburg diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 8b0c0cc..a1529c7 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -1476,12 +1476,12 @@ sub SetPredefinedStartPoints {
                  • cancelOverride - stop (manual) watering
                  • manualButtonTime n - set watering time for manual button (0 disables button)
                  • manualOverride n - manual watering for n minutes
                  • -
                  • resetValveErrors - Vreset valve errormessage
                  • +
                  • resetValveErrors - reset valve errormessage
                  • resumeSchedule - enable schedule
                  • stopSchedule n - disable schedule for n hours (Default: 2038-01-18T00:00:00.000Z, Gardena App reads it as "permanently")
                  • -
                  • operating_mode -Steuert den Operation Mode. Zeitgesteuert wird in Kombination mit dem Wochenzeitplan oder mit "manualOverride" genutzt, automatisch bedeutet, dass die Pumpe immer aktiv ist und die Bewässerung abhängig vom Wert "Einschaltdruck" startet. automatic|scheduled
                  • +
                  • operating_mode - Steuert den Operation Mode. Zeitgesteuert wird in Kombination mit dem Wochenzeitplan oder mit "manualOverride" genutzt, automatisch bedeutet, dass die Pumpe immer aktiv ist und die Bewässerung abhängig vom Wert "Einschaltdruck" startet. automatic|scheduled
                  • leakage_detection - Steuert die Lekage-Erkennung.
                    Hierdurch wird eine Pumpenabschaltung erreicht, sollte die Pumpe unkontrollierten Wasserverlust feststellen. watering|washing_machine|domestic_water_supply|off
                  • turn_on_pressure - Einschaltdruck 2.0 - 3.0 Steuert den Einschaltdruck in Scheduled und Automatic Mode. Fällt der Druck bei der Bewässerung unter diese wert, startet die Pumpe, ist der Wert dauerhaft über diesem Wert und es finden kein Durchfluss statt, geht die Pumpe in Standby
                  • @@ -1502,7 +1502,7 @@ sub SetPredefinedStartPoints {
                  • stopScheduleValve n m - stop irrigation schedule for valve n (Default: 2038-01-18T00:00:00.000Z, Gardena App reads it as "permanently")
                  • -
                  • winter_mode awake|hibernate - disable or enable winter mode
                  • +
                  • winter_mode awake|hibernate - enable or disable winter mode
                  • refresh temperature|humidity|light*
                    @@ -1642,7 +1642,7 @@ sub SetPredefinedStartPoints {
                  • ok_cutting_timer_overridden
                  • parked_autotimer
                  • parked_daily_limit_reached
                  • -
                  • hibernate - winter mode)
                  • +
                  • hibernate - winter mode
                • winter_mode - status of winter mode (awake/hibernate)
                • @@ -1846,7 +1846,7 @@ sub SetPredefinedStartPoints {
                • set NAME startpoint enable 1
                • set NAME startpoint disable 3 enable 1
                -
              • winter_mode awake|hibernate - Disable or enable winter mode
              • +
              • winter_mode hibernate|awake - enable or disable winter mode


              set (model = watering_computer) @@ -1858,7 +1858,7 @@ sub SetPredefinedStartPoints {
            • resumeSchedule - enable schedule
            • stopSchedule n - disable schedule for n hours (Default: 2038-01-18T00:00:00.000Z, Gardena App reads it as "permanently")
            • -
            • winter_mode awake|hibernate - disable or enable winter mode
            • +
            • winter_mode hibernate|awake - enable or disable winter mode


            set (model = ic24) @@ -1880,19 +1880,19 @@ sub SetPredefinedStartPoints {
          • resumeScheduleValve n - (re)start irrigation schedule for valve n
          • stopScheduleValve n m - stop irrigation schedule for valve n (Default: 2038-01-18T00:00:00.000Z, Gardena App reads it as "permanently")
          • -
          • winter_mode awake|hibernate - Disable or enable winter mode
          • +
          • winter_mode hibernate|awake - enable or disable winter mode


          set (model = sensor)
          • refresh temperature|humidity|light - refresh sensor reading for temperature, humidity or daylight
          • -
          • winter_mode awake|hibernate - Disable or enable winter mode
          • +
          • winter_mode hibernate|awake - enable or disable winter mode


          set (model = sensor2)
          • refresh temperature|humidity - refresh sensor reading for temperature or humidity
          • -
          • winter_mode awake|hibernate - Disable or enable winter mode
          • +
          • winter_mode hibernate|awake - enable or disable winter mode


          set (model = power) @@ -2341,7 +2341,7 @@ sub SetPredefinedStartPoints {
        • outlet_temperature-temperature_min - tbd. 0
        • Pumpen-Konfiguration
        • -
        • operating_mode - Modus der Pumpe
        • +
        • operating_mode - Modus der Pumpe
        • Pumpenstatus aktuell
        • pump-mode - Modus der Pumpe
        • @@ -2371,7 +2371,7 @@ sub SetPredefinedStartPoints {
        • set NAME startpoint enable 1
        • set NAME startpoint disable 3 enable 1
        -
      • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
      • +
      • winter_mode hibernate|awake - Winterschlaf aktivieren oder Gerät aufwecken


      set (model = watering_computer) @@ -2382,7 +2382,7 @@ sub SetPredefinedStartPoints {
    • resetValveErrors - Ventilfehler zurücksetzen
    • resumeSchedule - Zeitplan wieder aktivieren
    • stopSchedule n - Zeitplan anhalten für n Stunden (Default: 2038-01-18T00:00:00.000Z, durch Gardena-App als "dauerhaft" interpretiert)
    • -
    • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
    • +
    • winter_mode hibernate|awake - Winterschlaf aktivieren oder Gerät aufwecken


    set (model = ic24) @@ -2403,19 +2403,19 @@ sub SetPredefinedStartPoints {
  • resetValveErrors - Ventilfehler zurücksetzen
  • resumeScheduleValve n - Zeitplan für Ventil n wieder aktivieren
  • stopScheduleValve n m - Zeitplan für Ventil n anhalten für m Stunden (Default: 2038-01-18T00:00:00.000Z durch Gardena-App als "dauerhaft" interpretiert)
  • -
  • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
  • +
  • winter_mode hibernate|awake - Winterschlaf aktivieren oder Gerät aufwecken


  • set (model = sensor)
    • refresh temperature|humidity|light - Sensorwert für Temperatur, Feuchtigkeit oder Helligkeit aktualisieren
    • -
    • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
    • +
    • winter_mode hibernate|awake - Winterschlaf aktivieren oder Gerät aufwecken


    set (model = sensor2)
    • refresh temperature|humidity - Sensorwert für Temperatur oder Feuchtigkeit aktualisieren
    • -
    • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
    • +
    • winter_mode hibernate|awake - Winterschlaf aktivieren oder Gerät aufwecken


    set (model = power) @@ -2427,11 +2427,11 @@ sub SetPredefinedStartPoints {
    • manualOverride n - Bewässerungdauer in Minuten
    • cancelOverride - (Manuelle) Bewässerung stoppen
    • -
    • operating_mode -Steuert den Operation Mode. Zeitgesteuert wird in Kombination mit dem Wochenzeitplan oder mit "manualOverride" genutzt, automatisch bedeutet, dass die Pumpe immer aktiv ist und die Bewässerung abhängig vom Wert "Einschaltdruck" startet. automatic|scheduled
    • +
    • operating_mode - Steuert den Operation Mode. Zeitgesteuert wird in Kombination mit dem Wochenzeitplan oder mit "manualOverride" genutzt, automatisch bedeutet, dass die Pumpe immer aktiv ist und die Bewässerung abhängig vom Wert "Einschaltdruck" startet. automatic|scheduled
    • leakage_detection - Steuert die Lekage-Erkennung.
      Hierdurch wird eine Pumpenabschaltung erreicht, sollte die Pumpe unkontrollierten Wasserverlust feststellen. watering|washing_machine|domestic_water_supply|off
    • turn_on_pressure - Einschaltdruck 2.0 - 3.0 Steuert den Einschaltdruck in Scheduled und Automatic Mode. Fällt der Druck bei der Bewässerung unter diese wert, startet die Pumpe, ist der Wert dauerhaft über diesem Wert und es finden kein Durchfluss statt, geht die Pumpe in Standby
    • resetValveErrors - Ventilfehler zurücksetzen
    • -
    • winter_mode awake|hibernate - Winterschlaf aktivieren oder Gerät aufwecken
    • +
    • winter_mode hibernate|awake - Winterschlaf aktivieren oder Gerät aufwecken
    diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 3f3bf01..56e0156 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-09-06_12:31:38 123049 FHEM/74_GardenaSmartDevice.pm +UPD 2022-09-06_14:33:00 123048 FHEM/74_GardenaSmartDevice.pm From fe97f0b20354576c264605e88ecf921f56ff4951 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 18 Sep 2022 08:52:43 +0200 Subject: [PATCH 126/126] [translaten] - add commandref translation --- 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 37eb437..2161d26 100644 --- a/CHANGED +++ b/CHANGED @@ -1 +1 @@ - Reviewed-by: Marko Oldenburg + spellcheck + corrections diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index a1529c7..20da94d 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -1481,10 +1481,10 @@ sub SetPredefinedStartPoints {
  • stopSchedule n - disable schedule for n hours (Default: 2038-01-18T00:00:00.000Z, Gardena App reads it as "permanently")
  • -
  • operating_mode - Steuert den Operation Mode. Zeitgesteuert wird in Kombination mit dem Wochenzeitplan oder mit "manualOverride" genutzt, automatisch bedeutet, dass die Pumpe immer aktiv ist und die Bewässerung abhängig vom Wert "Einschaltdruck" startet. automatic|scheduled
  • -
  • leakage_detection - Steuert die Lekage-Erkennung.
    Hierdurch wird eine Pumpenabschaltung erreicht, sollte die Pumpe unkontrollierten Wasserverlust feststellen. watering|washing_machine|domestic_water_supply|off
  • -
  • turn_on_pressure - Einschaltdruck 2.0 - 3.0 Steuert den Einschaltdruck in Scheduled und Automatic Mode. Fällt der Druck bei der Bewässerung unter diese wert, startet die Pumpe, ist der Wert dauerhaft über diesem Wert und es finden kein Durchfluss statt, geht die Pumpe in Standby
  • - +
  • operating_mode - Managing operation mode. Timed operation is used in combination with schedules or "manualOverride". Automatic operation leaves pump active and activates irrigation depending on start-up pressure. automatic|scheduled
  • +
  • leakage_detection - Manages leakage detection.
    Pump will be deactivated if it detects irregular loss of water. watering|washing_machine|domestic_water_supply|off
  • +
  • turn_on_pressure - Start-up pressure 2.0 - 3.0 Manages start-up pressure in scheduled and automatic mode. If pressure falls below this setting, pump will start. If pressure stays above this setting and there isn't any water flow, pump will activate standby.
  • +
  • cancelOverrideValve1 - stop (manual) watering for valve 1
  • cancelOverrideValve2 - stop (manual) watering for valve 2
  • cancelOverrideValve3 - stop (manual) watering for valve 3
  • diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 56e0156..249f831 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2022-07-21_19:43:48 49634 FHEM/73_GardenaSmartBridge.pm -UPD 2022-09-06_14:33:00 123048 FHEM/74_GardenaSmartDevice.pm +UPD 2022-09-18_08:52:23 122934 FHEM/74_GardenaSmartDevice.pm