This commit is contained in:
Sebastian
2022-06-23 12:11:00 +02:00
parent c68f35c2e3
commit 3780befa7a
3 changed files with 15 additions and 2 deletions

View File

@ -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