diff --git a/fhem/CHANGED b/fhem/CHANGED index 2b13a0026..07f00fd5d 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - bugfix: 74_AutomowerConnect: prevent division by zero, delay ws init + force new access token when set client_secret - change: 74_AutomowerConnect: Common.pm, automowerconnect.js implemented error stack and getter to show show daily collisions, not calculate statistics solved diff --git a/fhem/FHEM/74_AutomowerConnect.pm b/fhem/FHEM/74_AutomowerConnect.pm index bac47c187..a736d10da 100644 --- a/fhem/FHEM/74_AutomowerConnect.pm +++ b/fhem/FHEM/74_AutomowerConnect.pm @@ -394,8 +394,10 @@ sub getMowerResponse { # schedule new access token RemoveInternalTimer( $hash, \&APIAuth ); InternalTimer( ReadingsVal($name, '.expires', 600)-37, \&APIAuth, $hash, 0 ); + # Websocket initialisieren, schedule ping, reopen - wsReopen( $hash ); + RemoveInternalTimer( $hash, \&wsReopen ); + InternalTimer( gettimeofday() + 1.5, \&wsReopen, $hash, 0 ); return undef; @@ -614,6 +616,13 @@ sub Set { my ($passResp, $passErr) = $hash->{helper}->{passObj}->setStorePassword($name, $setVal); Log3 $name, 1, "$iam error: $passErr" if ($passErr); return "$iam $passErr" if( $passErr ); + + readingsBeginUpdate($hash); + readingsBulkUpdateIfChanged( $hash, '.access_token', '', 0 ); + readingsBulkUpdateIfChanged( $hash, 'device_state', 'initialized'); + readingsBulkUpdateIfChanged( $hash, 'mower_commandStatus', 'cleared'); + readingsEndUpdate($hash, 1); + RemoveInternalTimer($hash, \&APIAuth); APIAuth($hash); return undef; @@ -774,6 +783,12 @@ sub Attr { if( $cmd eq "set" ) { return "$iam $attrName has a wrong format use linewise pairs " unless( $attrVal =~ /(-?\d*\.?\d+)\s(-?\d*\.?\d+)(\R|\s)(-?\d*\.?\d+)\s(-?\d*\.?\d+)/ ); + my ( $lo1, $la1, $lo2, $la2 ) = ( $1, $2, $4, $5 ); + return "$iam $attrName illegal value 0 for the difference of longitudes." unless ( $lo1 - $lo2 ); + return "$iam $attrName illegal value 0 for the difference of latitudes." unless ( $la1 - $la2 ); + + + Log3 $name, 3, "$iam $cmd $attrName $attrVal"; } elsif( $cmd eq "del" ) {