indykoning / PyPi_GrowattServer

MIT License
70 stars 32 forks source link

[FR] Option to use official web API #76

Open Saentist opened 5 months ago

Saentist commented 5 months ago

As was suggested by @marcovtwout

It's better to use and official way to GET data and SET parameter's documentation link https://www.showdoc.com.cn/262556420217021

Templates by device models can be made also.

And will be more informative then this basic scrape in configuration.yaml with work from lot of time

multiscrape:
  - name: HA scraper
    resource: https://server.growatt.com/singlePage/getPlantData
    scan_interval: 300
    method: POST
    headers:
      Content-Type: application/x-www-form-urlencoded
    payload: 'plantId=xxxxxxx' #plant id number
    sensor:
      - unique_id: 4200TLXE_today
        name: Inv1 day 
        value_template: '{{ value_json.obj.eToday }}'
        unit_of_measurement: kWh 
      - unique_id: 4200TLXE_month
        name: Inv1 Month
        value_template: '{{ value_json.obj.eMonth }}'
        unit_of_measurement: kWh 
      - unique_id: 4200TLXE_total
        name: inv1_tot
        value_template: '{{ value_json.obj.eTotal }}'
        unit_of_measurement: kWh 
        device_class: energy
        state_class: total_increasing
      - unique_id: 4200TLXE_now
        name: inv1_realtime
        value_template: '{{ value_json.obj.pac }}'
        unit_of_measurement: kW