User Tools

Site Tools


howto:growatt

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howto:growatt [2023/07/09 18:29] Wulf Rajekhowto:growatt [2023/07/09 22:58] (current) – [Download Growatt Data Log History] Wulf Rajek
Line 241: Line 241:
 Example History showing the change from 5 minute update interval to 1 minute update interval:\\  Example History showing the change from 5 minute update interval to 1 minute update interval:\\ 
 {{:howto:pasted:20230709-181511.png}} {{:howto:pasted:20230709-181511.png}}
 +
 +
 +===== Download Growatt Data Log History =====
 +
 +The following bash script downloads the historic data log into xls files for each day. The file needs start and end date as well as username, password and the serial number of the inverter as configuration options.
 +
 +<code bash growatt_history_download.sh>
 +#!/bin/bash
 +
 +startdate="20230614"
 +enddate="20230709"
 +interval=1
 +username="username"
 +password="password"
 +serialnumber="serialnumber"
 +
 +curl 'http://server-api.growatt.com/login' --compressed -X POST -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Accept-Language: en-GB,en;q=0.5' -H 'Accept-Encoding: gzip, deflate' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'X-Requested-With: XMLHttpRequest' -H 'Origin: http://server-api.growatt.com' -H 'Connection: keep-alive' -H 'Referer: http://server-api.growatt.com/login' --cookie-jar cookies.txt --data-raw "account=${username}&password=${password}&validateCode=&isReadPact=0" --silent
 +
 +while [[ "${startdate}" -le "${enddate}" ]]; do
 +    # echo ${startdate}
 +    formatdate="$(date -d "${startdate}" +'%Y-%m-%d')"
 +    echo "Processing ${formatdate}"
 +
 +    curl 'http://server-api.growatt.com/device/exportMIXHistory' --compressed -X POST -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Accept-Language: en-GB,en;q=0.5' -H 'Accept-Encoding: gzip, deflate' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'X-Requested-With: XMLHttpRequest' -H 'Origin: http://server-api.growatt.com' -H 'Connection: keep-alive' -H 'Referer: http://server-api.growatt.com/index' --cookie cookies.txt --data-raw "mixSn=${serialnumber}&startDate=${formatdate}&endDate=${formatdate}&start=1" -o "growatt-export_${formatdate}.xls" --silent
 +
 +    # set new start date based on interval
 +    startdate="$(date -d "${startdate} + ${interval} days" +'%Y%m%d')"
 +done
 +</code>
 +
howto/growatt.1688923784.txt.gz · Last modified: 2023/07/09 18:29 by Wulf Rajek