mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
74_AutomowerConnect: prevent division by zero, delay ws init, force new access token when set client_secret
git-svn-id: https://svn.fhem.de/fhem/trunk@27628 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
84d39b9eda
commit
976bcfb874
@ -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
|
||||
|
@ -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 <floating point longitude><one space character><floating point latitude>" 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" ) {
|
||||
|
Loading…
Reference in New Issue
Block a user