Publishing solar production data to pvoutput.org from Home Assistant


PVOutput is a website in which you can share your solar production data. Home Assistant is an open source home automation solution that can be run in Raspberry Pi among other options.

Sharing photovoltaic (PV) production can help the community to learn, analyse and help make decisions regarding solar production plants investments, either residential or commercial.

In this post we are explaining how to automate data load in Home Assistnat

STEP 1: GET APIKEY FROM PVOUTPUT.ORG

Go to pvoutput.org, register yourself and obtain an apikey, grab the key for later use

STEP 2: REGISTER YOUR SOLAR PLANT

Click on [Add System] button and register your plant data, at he end you’ll have a System Id which is needed for loading data later on

STEP 3: GET VARIABLES THAT HOLD PRODUCTION DATA

Depending the inverter or smart meter you have, an integration for Home Assistant is needed. The integration provides you sensor variables that you can use in automations and the like.

In my particular case, for a GoodWe inverter, I’m using an integration provided by the HACS community, called GoodWe Inverter Solar Sensor (UDP – no cloud), this integration provides direct UDP communication with the inverter not needing a cloud account and, because the direct communication, the integration is much more better.

STEP 4: CONFIGURE SCRIPT IN CONFIGURATION.YAML

Home Assistant has a “famous” configuration file in which you can set up a bunch of things, in this particular case we are setting a shell script that send data to pvoutput.org as follows:

shell_command:
  pvoutputcurl: 'curl -d "d={{now().strftime("%Y%m%d")}}" -d "t={{now().strftime("%H:%M")}}" -d "v2={{states.sensor.goodwe_ppv.state|round(0)}}"  -d "v4={{states.sensor.goodwe_house_consumption.state|round(0)}}" -d "v5={{states.sensor.goodwe_temperature.state|float}}" -d "v6={{states.sensor.goodwe_vgrid.state|round(0)}}" -H "X-Pvoutput-Apikey: 33f03........310a" -H "X-Pvoutput-SystemId: 8...7" https://pvoutput.org/service/r2/addstatus.jsp'

STEP 5: CREATE AN AUTOMATION

alias: pvoutput
description: ''
trigger:
  - platform: time_pattern
    minutes: /4
condition: []
action:
  - service: shell_command.pvoutputcurl
    data: {}
mode: single

The technical information to understand the command is explained here.

That’s all, hope it helps 🙂

12 Comments

  1. Marc

    Hello,
    I added you rule, little bit converted to my own entities; but nothing is happening at pvoutput.
    this is the code I have in the confuguration.yaml;

    shell_command:
    pvoutputcurl: ‘curl -d “d={{now().strftime(“%Y%m%d”)}}” -d “t={{now().strftime(“%H:%M”)}}” -d “v4={{states.sensor.power_output|round(0)}}” -H “X-Pvoutput-Apikey: 2….200” -H “X-Pvoutput-SystemId: 7…” https://pvoutput.org/service/r2/addstatus.jsp

    is there anything else I have to do? I’m having a account at pvoutput, and also api key and systemic is correct

    Like

    1. javier mugueta

      Yes, create an automation and execute the command every 5 minutes:
      alias: pvoutput
      description: ”
      trigger:
      – platform: time_pattern
      minutes: /5
      condition: []
      action:
      – service: shell_command.pvoutputcurl
      data: {}
      mode: single

      Like

  2. Sirox01

    I have it working but the voltage isn’t uploading.
    Is there a way to see the values with are trying to uploaded?

    shell_command:
    pvoutputcurl: ‘curl -d “d={{now().strftime(“%Y%m%d”)}}” -d “t={{now().strftime(“%H:%M”)}}” -d “v1={{states.sensor.tdg2a4303y_energy_today.state|float *1000}}” -d “v2={{states(‘tdg2a4303y_output_power’)|round(0)}}” “v6={{states(‘tdg2a4303y_reactive_voltage’)|round(0)}}” -H “X-Pvoutput-Apikey: 2d” -H “X-Pvoutput-SystemId: 85” https://pvoutput.org/service/r2/addstatus.jsp

    Like

    1. javier mugueta

      Go to Developer Tools|Templates and put your voltage template expression [{{states(‘tdg2a4303y_reactive_voltage’)|round(0)}}] in the editor and see if a value is displayed. I am curious about reactive_voltage, shouldn’t it be active_voltage? (reactive voltage is non zero mostly in industrial loads and the like I believe…)

      Like

  3. SeByDocKy

    Hello,

    Got problem with the curl command…. seems he don’t want to replace with the corresponding {{ sensors.mysenors.state}} value in any field (d,t,v1, etc…) If I exexucte for example :
    curl -d “d=20220605” -d “t=10:03” -d “v1=1000” -d “v2=150” -H “X-Pvoutput-Apikey: 76501xxxxxx4835a9” -H “X-Pvoutput-SystemId: 9xxx2” https://pvoutput.org/service/r2/addstatus.jsp
    it’s worling (from the shell exexcute in the file editor)
    but I am trying for example :
    curl -d “d={{now().strftime(“%Y%m%d”)}}” -d “t=10:02” -d “v2={{states.sensor.pvbrain_axpert_pv_power_total.state|round(0)}}” -H “X-Pvoutput-Apikey: 7650XXXXXX4835a9” -H “X-Pvoutput-SystemId: 9YYYY2” https://pvoutput.org/service/r2/addstatus.jsp
    it’s no more working …. while in the template panel {{now().strftime(“%Y%m%d”)}} returns the correct date…..

    Really strange.

    Like

  4. SeByDocKy

    Hi again,

    In my scripts.yaml file, I defined
    “`
    shell_command:
    pvoutputcurl: ‘curl -d “d={{now().strftime(“%Y%m%d”)}}” -d “t={{now().strftime(“%H:%M”)}}” -d “v1={{states.sensor.pvbrain_axpert_pv_power_total_du_jour.state|round(0)}}” -d “v2={{states.sensor.pvbrain_axpert_pv_power_total.state|round(0)}}” -d “v3={{states.sensor.pvbrain_grid_du_jour.state|round(0)}}” -d “v4={{states.sensor.pvbrain_grid_puissance.state|round(0)}}” -d “v5={{states.sensor.pvbrain_axpert_inverter_heat_sink_temperature.state|float}}” -d “v6={{states.sensor.pvbrain_solar_tension.state|round(0)}}” -H “X-Pvoutput-Apikey: 7650XXXXXXXX5a9” -H “X-Pvoutput-SystemId: 9YYYY2” https://pvoutput.org/service/r2/addstatus.jsp
    “`

    got these errors …
    “`
    Logger: homeassistant.components.websocket_api.http.connection
    Source: components/websocket_api/connection.py:146
    Integration: Home Assistant WebSocket API (documentation, issues)
    First occurred: 4:00:37 PM (2 occurrences)
    Last logged: 4:01:03 PM

    [281472899035920] Error handling message: Service shell_command:.pvoutputcurl does not match format . for dictionary value @ data[‘sequence’][0][‘service’]. Got ‘shell_command:.pvoutputcurl’ (invalid_format)
    [281472899035920] Error handling message: Unable to find service script.pvoutputcurl (unknown_error)
    “`

    Like

    1. javier mugueta

      Hi
      I’ve cut & paste your command in my yaml and it seems your single quotes at the beginning and the end are not the correct character. If you have copied it from the post may have sense because sometimes html decoration changes the character map, just remove them and retype again from the keyboard, it just worked for me. I know because home assistant shows the content between single quotes in green colour.
      Regards

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.