From 9d3ddb088b9930c18798423187fc8b0fe7d17f11 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 28 Jun 2021 16:11:39 +0200 Subject: [PATCH 1/3] add mower timestamp to readings --- FHEM/74_GardenaSmartDevice.pm | 14 ++++++++++++++ controls_GardenaSmartDevice.txt | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index d8e9d1a..176d087 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -653,6 +653,20 @@ sub WriteReadings { || $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name} eq 'light-light' ) ); + + readingsBulkUpdateIfChanged( + $hash, + $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} + . '_timestamp', + RigReadingsValue( $hash, $propertie->{timestamp} ) + ) + if ( + defined( $propertie->{value} ) + && ( $decode_json->{abilities}[$abilities]{name} . '-' + . $propertie->{name} eq 'mower_timer-mower_timer' + ) + readingsBulkUpdateIfChanged( $hash, diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 575fb6c..4fee53f 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ -UPD 2021-06-28_10:47:43 47009 FHEM/73_GardenaSmartBridge.pm -UPD 2021-06-09_09:52:26 55505 FHEM/74_GardenaSmartDevice.pm +UPD 2021-06-28_15:56:58 47009 FHEM/73_GardenaSmartBridge.pm +UPD 2021-06-28_16:11:26 56085 FHEM/74_GardenaSmartDevice.pm From cf93bbdba62ef6d4cd2785950df258bb00f508dc Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 28 Jun 2021 16:16:10 +0200 Subject: [PATCH 2/3] missed ); --- FHEM/74_GardenaSmartDevice.pm | 1 + controls_GardenaSmartDevice.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index 176d087..fd8292b 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -666,6 +666,7 @@ sub WriteReadings { && ( $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name} eq 'mower_timer-mower_timer' ) + ); readingsBulkUpdateIfChanged( diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 4fee53f..55d9564 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2021-06-28_15:56:58 47009 FHEM/73_GardenaSmartBridge.pm -UPD 2021-06-28_16:11:26 56085 FHEM/74_GardenaSmartDevice.pm +UPD 2021-06-28_16:15:56 56104 FHEM/74_GardenaSmartDevice.pm From 70c54892d871287836d1c1d90c4b94b13ffc4720 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 28 Jun 2021 20:11:18 +0200 Subject: [PATCH 3/3] change to unixtimestamp --- FHEM/74_GardenaSmartDevice.pm | 4 ++-- controls_GardenaSmartDevice.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/FHEM/74_GardenaSmartDevice.pm b/FHEM/74_GardenaSmartDevice.pm index fd8292b..ce951a6 100644 --- a/FHEM/74_GardenaSmartDevice.pm +++ b/FHEM/74_GardenaSmartDevice.pm @@ -659,7 +659,8 @@ sub WriteReadings { $decode_json->{abilities}[$abilities]{name} . '-' . $propertie->{name} . '_timestamp', - RigReadingsValue( $hash, $propertie->{timestamp} ) + Time::Piece->strptime(RigReadingsValue( $hash, $propertie->{timestamp} ), "%Y-%m-%d %H:%M:%S")->strftime('%s') + ) if ( defined( $propertie->{value} ) @@ -668,7 +669,6 @@ sub WriteReadings { ) ); - readingsBulkUpdateIfChanged( $hash, $decode_json->{abilities}[$abilities]{name} . '-' diff --git a/controls_GardenaSmartDevice.txt b/controls_GardenaSmartDevice.txt index 55d9564..852aaca 100644 --- a/controls_GardenaSmartDevice.txt +++ b/controls_GardenaSmartDevice.txt @@ -1,2 +1,2 @@ UPD 2021-06-28_15:56:58 47009 FHEM/73_GardenaSmartBridge.pm -UPD 2021-06-28_16:15:56 56104 FHEM/74_GardenaSmartDevice.pm +UPD 2021-06-28_20:08:52 56188 FHEM/74_GardenaSmartDevice.pm