From 9f9722ce9c2946c32b18ce2dc72daddeb75da158 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 23 Jun 2022 12:36:17 +0200 Subject: [PATCH] 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