From 9372456abd1c6b85e6ce7f8d91653b23881e71e7 Mon Sep 17 00:00:00 2001 From: Ellert <> Date: Sun, 20 Apr 2025 12:17:00 +0000 Subject: [PATCH] 74_AutomowerConnect: Cref improved, automowerconnect.js fix third party file loading, change tp repository, add file size to log entry. git-svn-id: https://svn.fhem.de/fhem/trunk@29881 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 3 +++ fhem/FHEM/74_AutomowerConnect.pm | 12 ++++++------ fhem/lib/FHEM/Devices/AMConnect/Common.pm | 8 +++++--- fhem/www/pgm2/automowerconnect.js | 24 +++++++++++++++-------- 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index a1661b757..912d6c96b 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,8 @@ # 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 + - change: 74_AutomowerConnect: Cref improved, automowerconnect.js fix third + party file loading, change tp repository, add file size to log + entry - bugfix: 76_SMAInverter.pm: fix SBS LG bog - feature: 50_MOBILEALERTSGW: Added Internal lastGateway - feature: 76_SolarForecast: Major release 1.51.0 diff --git a/fhem/FHEM/74_AutomowerConnect.pm b/fhem/FHEM/74_AutomowerConnect.pm index 17dbd6933..f12cb4a8f 100644 --- a/fhem/FHEM/74_AutomowerConnect.pm +++ b/fhem/FHEM/74_AutomowerConnect.pm @@ -284,13 +284,13 @@ __END__
  • MowerData
    get <name> MowerData
    - Lists all mower data with its hash path exept positon array. The hash path can be used for generating userReadings. The trigger is e.g. device_state: connected or mower_wsEvent: <status-event|positions-event|settings-event>.
    + Lists all mower data with its hash path exept positon array. The hash path can be used for generating userReadings. The trigger is e.g. device_state:\sconnected or mower_wsEvent:\s<event name>.
    Example: created reading serialnumber with hash path $hash->{helper}{mower}{attributes}{system}{serialNumber}

    - attr <name> userReadings serialnumber:connected {$defs{$name}->{helper}{mower}{attributes}{system}{serialNumber}}
  • + attr <name> userReadings serialnumber:device_state:\sconnected {$defs{$name}->{helper}{mower}{attributes}{system}{serialNumber}}
  • StatisticsData
    get <name> StatisticsData
    - Lists statistics data with its hash path. The hash path can be used for generating userReadings. The trigger is e.g. device_state: connected or mower_wsEvent: <status-event|positions-event|settings-event>.
  • + Lists statistics data with its hash path. The hash path can be used for generating userReadings. The trigger is e.g. device_state:\sconnected or mower_wsEvent:\s<status-event|positions-event|settings-event>, see .
  • errorCodes
    get <name> errorCodes
    @@ -816,13 +816,13 @@ __END__
  • MowerData
    get <name> MowerData
    - Listet alle Daten des Mähers einschließlich Hashpfad auf, ausgenommen das Positonsarray. Der Hashpfad kann zur Erzeugung von userReadings genutzt werden, getriggert wird durch e.g. device_state: connected oder mower_wsEvent: <status-event|positions-event|settings-event>.
    + Listet alle Daten des Mähers einschließlich Hashpfad auf, ausgenommen das Positonsarray. Der Hashpfad kann zur Erzeugung von userReadings genutzt werden, getriggert wird durch z.B. device_state:\sconnected oder mower_wsEvent:\s<event name>.
    Beispiel: erzeugen des Reading serialnumber mit dem Hashpfad $hash->{helper}{mower}{attributes}{system}{serialNumber}

    - attr <name> userReadings serialnumber:connected {$defs{$name}->{helper}{mower}{attributes}{system}{serialNumber}}
  • + attr <name> userReadings serialnumber:device_state:\sconnected {$defs{$name}->{helper}{mower}{attributes}{system}{serialNumber}}
  • StatisticsData
    get <name> StatisticsData
    - Listet statistische Daten mit ihrem Hashpfad auf. Der Hashpfad kann zur Erzeugung von userReadings genutzt werden, getriggert wird z.B. durch device_state: connected oder mower_wsEvent: <status-event|positions-event|settings-event>
  • + Listet statistische Daten mit ihrem Hashpfad auf. Der Hashpfad kann zur Erzeugung von userReadings genutzt werden, getriggert wird z.B. durch device_state:\sconnected oder mower_wsEvent:\s<event name>
  • errorStack
    get <name> errorStack
    diff --git a/fhem/lib/FHEM/Devices/AMConnect/Common.pm b/fhem/lib/FHEM/Devices/AMConnect/Common.pm index dfede8c95..008300d34 100644 --- a/fhem/lib/FHEM/Devices/AMConnect/Common.pm +++ b/fhem/lib/FHEM/Devices/AMConnect/Common.pm @@ -3053,7 +3053,8 @@ sub listInternalData { ## no critic (ProhibitExcessComplexity [complexity core m $ret .= '

    '; $ret .= ''; - $ret .= ''; + $ret .= ''; $ret .= '
    Third Party Software
    hull calculation (hull.js) Server: ' . $hash->{helper}{FWEXTA}{url} . '
    hull calculation (hull.js) Server: ' . $hash->{helper}{FWEXTA}{url} + . ', filesize: ' . ( -s $FW_dir . '/' . $hash->{helper}{FWEXTA}{path} . '/' . $hash->{helper}{FWEXTA}{file} ) . ' kB, check content if not about 12kB.
    '; @@ -3166,8 +3167,9 @@ sub getTpFile { print $fh $msg; close( $fh ); - readingsSingleUpdate( $hash, 'third_party_library', "$file downloaded to: $path", 1 ); - Log3 $name, 1, "$name getTpFile: third party library downloaded from $url to $path"; + my $fsz = -s "$path/$file"; + readingsSingleUpdate( $hash, 'third_party_library', "${file}, (${fsz} Byte) downloaded to: $path", 1 ); + Log3 $name, 1, "$name getTpFile: third party library downloaded from $url to $path/$file, filesize: $fsz. Check content if not about 12 kB."; } diff --git a/fhem/www/pgm2/automowerconnect.js b/fhem/www/pgm2/automowerconnect.js index 764f6634d..217c03585 100644 --- a/fhem/www/pgm2/automowerconnect.js +++ b/fhem/www/pgm2/automowerconnect.js @@ -826,19 +826,27 @@ function AutomowerConnectUpdateDetail (dev, type, detailfnfirst, picx, picy, sca loadScript('automowerconnect/hull.js', ()=> { - const pts = []; + if ( typeof hull === "function" ) { - for ( let i = 0; i < pos.length; i+=3 ){ + const pts = []; - if ( pos[i+2] == "M") pts.push( [ pos[i], pos[i+1] ] ); + for ( let i = 0; i < pos.length; i+=3 ){ - } + if ( pos[i+2] == "M") pts.push( [ pos[i], pos[i+1] ] ); - if ( pts.length > 50 ) { + } - const res = div.getAttribute( 'data-hullResolution' ); - const hullpts = hull( pts, res ); - AutomowerConnectHull( ctx0, div, hullpts, 'hull' ); + if ( pts.length > 50 ) { + + const res = div.getAttribute( 'data-hullResolution' ); + const hullpts = hull( pts, res ); + AutomowerConnectHull( ctx0, div, hullpts, 'hull' ); + + } + + } else { + + log( 'AutomowerConnectUpdateDetail: Loading automowerconnect/hull.js failed, no function named hull, check content of hull.js' ); }