pyess icon indicating copy to clipboard operation
pyess copied to clipboard

Additional documentation

Open maxant opened this issue 6 months ago • 0 comments

Hi, many thanks for this awesome library. I made some notes while reverse engineering your python, so that I could call the API with Node-RED / Javascript. I tested it using curl. Would it be useful for others, to post this in the README or nearby? Especially the part about multiplying the values by 4.

Go into basement, push button on the inverter which is next to USB port for about 5 seconds until 
the "wifi" LED on the front turns blue.
use laptop to connect to the inverters wifi - the password is written on the side of the inverter.
run this to find the password:

    conda create -n env3819 python=3.8.19
    conda activate env3819
    pip install pyess
    esscli --action get_password

        INFO:pyess.cli:password: XXXXXX


push and hold the button again for five seconds until the wifi led goes back to being green. then connect the laptop back to the normal wifi and do this to get data:


    esscli --action get_data --password XXXXXX | jq


use the router to find the name of ess box, it is:

    AB1234BBBB56789C 192.168.1.400

    export MYPWD="XXXXXX"

    export AUTHKEY=$(curl -vvv -k -s -XPUT \
                    'https://AB1234BBBB56789C/v1/user/setting/login' \
                    -H 'Content-Type: application/json' \
                    -d '{"password": "'"$MYPWD"'"}' \
                | jq -r '.auth_key')

e.g. get network settings:

    curl -vvv -k -s -XPUT \
                    'https://AB1234BBBB56789C/v1/user/setting/network' \
                    -H 'Content-Type: application/json' \
                    -d '{"auth_key": "'"$AUTHKEY"'"}' \
                | jq

if any call returns this, then the user needs to log in again:

        {
            "auth": "session_timed_out"
        }


provide total per quarter hour, and **so need multiplying by 4** in order to match how they are displayed in the graph:

    curl -vvv -k -XPOST 'https://AB1234BBBB56789C/v1/user/graph/load/day' \
         -H 'Content-Type: application/json' \
         -d '{"year_month_day": "'"$(date +%Y%m%d%H%M%S)"'", "auth_key": "'"$AUTHKEY"'"}'

    curl -vvv -k -XPOST 'https://AB1234BBBB56789C/v1/user/graph/pv/day' \
         -H 'Content-Type: application/json' \
         -d '{"year_month_day": "'"$(date +%Y%m%d%H%M%S)"'", "auth_key": "'"$AUTHKEY"'"}'

    curl -vvv -k -XPOST 'https://AB1234BBBB56789C/v1/user/graph/batt/day' \
         -H 'Content-Type: application/json' \
         -d '{"year_month_day": "'"$(date +%Y%m%d%H%M%S)"'", "auth_key": "'"$AUTHKEY"'"}'


provides instantaneous values:

    curl -vvv -k -XPOST 'https://AB1234BBBB56789C/v1/user/essinfo/home' \
         -H 'Content-Type: application/json' \
         -d '{"auth_key": "'"$AUTHKEY"'"}'

    curl -vvv -k -XPOST 'https://AB1234BBBB56789C/v1/user/essinfo/common' \
         -H 'Content-Type: application/json' \
         -d '{"auth_key": "'"$AUTHKEY"'"}'

maxant avatar Aug 18 '24 21:08 maxant