Skip to content

PV Output

TonyM1958 edited this page Jul 20, 2024 · 44 revisions

I've registered and uploaded my solar generation at pvoutput.org so I can track my daily generation and consumption overtime:


You can also compare performance with others near you and contribute to regional and national statustics:

To register:

  • Go to pvoutput.org and click register to create an account
  • Create a system that describes your PV system.
  • Under Settings, API, enable API access
  • Click the New Key button to create an API key. Take a copy of the API key
  • Under Registed Systems, take a copy of the System ID
  • Don't forget to save your changes

Tips:

  • It's helpful to name your system so it's (loosely) related to your facebook presence so we can tell who's who in any chats. You can change the name by clicking Edit in Settings, Registered Systems
  • The map identifies your location but you can click Edit Location and move your pin if you don't want your exact location to be revealed

Teams

If you upload your data, you can also add your output to the Fox ESS Owners Group to track and compare your generation against other members of the group and put yourself on the map. To set this up:

Here's what the map looked like on 9th August 2023 - be intersting to see how far away some of our members are!

Bulk Loading

Once you are setup in PV Output, you can upload historic data to PV Output using a CSV / tab delimited data format via this page.

You can generate upload data from your Fox ESS Cloud using the instructions here. This uses Google Colaboratory or Jupyter Lab to run some scripts that generate your upload data. All you need is a Google account and access to Google Drive.

You can also use the scripts provided to manually upload your data each day if you wish.

After uploading data, you may find that your statistics on the team page don't update automatically and your output looks like this:

This is becasue PV Output does not automatically re-calculate when you load your history. You can manually recalculate by:

  • Going to 'Your Outputs'
  • Go to the last page of your data
  • Go to the last entry on that page and click 'Edit'
  • Click 'Save' and keep clicking 'Save' until you reach today's date
  • Click on 'Your Outputs' to exit edit mode.

Daily Updates using Home Assistant

If you have Home Assistant, you can configure it to automatically upload generation and consumption data to pvoutput.org.

To do this:

  • Before starting, take a back of your 'configuration.yaml' file so you can restore it if things go wrong and read through this section to familiarise yourself with the changes you will be making. When you are ready...
  • Create a file called 'rest_command.yaml' in your CONFIG folder containing the following text:
pvoutput_upload:
  url: "https://pvoutput.org/service/r2/addoutput.jsp"
  method: post
  headers:
    X-Pvoutput-Apikey: !secret pvoutput_apikey
    X-Pvoutput-SystemId: !secret pvoutput_systemid
  content_type: application/x-www-form-urlencoded
  payload: data={{states('sensor.pvoutput_data')}}
  • Edit your 'secrets.yaml' file and add the following entries, replacing <your api key> and <your system id> with the API key and System ID from your when you setup your pvoutput.org account
pvoutput_apikey: "<your api key>"
pvoutput_systemid: "<your system id>"
  • Alternatively, if you don't have a 'secrets.yaml' file, you can add your details directly into 'rest_command.yaml' on these lines:
    X-Pvoutput-Apikey: "<your api key>"
    X-Pvoutput-SystemId: "<your system id>"
  • Add a line to your 'configuration.yaml' that includes the file 'rest_command.yaml' created earlier:
rest_command: !include rest_command.yaml
  • Open 'template.yaml' and add a new template:
    # pvoutput.org upload using CSV format
    - name: "PVOutput Data"
      unique_id: foxess_inv1_pvoutput_data
      state: >
        {% set dat = now().year|string + ('0' + (now().month|string))[-2:] + ('0' + (now().day|string))[-2:] %}
        {% set gen = states('sensor.pv_energy_daily') | float(default=-1) * 1000 %}
        {% set gen = '' if gen < 0 else gen | int | string %}
        {% set exp = states('sensor.feedin_daily') | float(default=-1) * 1000 %}
        {% set exp = '' if exp < 0 else exp | int | string %}
        {% set con = states('sensor.load_daily') | float(default=-1) * 1000 %}
        {% set con = '' if con < 0 else con | int | string %}
        {% set imp = states('sensor.grid_daily') | float(default=-1) * 1000 %}
        {% set imp = '' if imp < 0 else imp | int | string %}
        {% set result = dat + ',' + gen + ',' + exp + ',,,,,,,0,' + imp + ',0,0,' + con + ',,,,' %}
        {{ result }}
  • Alternatively, if you use 'configuration.yaml' for your templates, add the code underneath your 'template', 'sensor' section, like this:
template:
  - sensor:
    # pvoutput.org upload using CSV format
    - name: "PVOutput Data"
      unique_id: foxess_inv1_pvoutput_data
      state: >
        {% set dat = now().year|string + ('0' + (now().month|string))[-2:] + ('0' + (now().day|string))[-2:] %}
        {% set gen = states('sensor.pv_energy_daily') | float(default=-1) * 1000 %}
        {% set gen = '' if gen < 0 else gen | int | string %}
        {% set exp = states('sensor.feedin_daily') | float(default=-1) * 1000 %}
        {% set exp = '' if exp < 0 else exp | int | string %}
        {% set con = states('sensor.load_daily') | float(default=-1) * 1000 %}
        {% set con = '' if con < 0 else con | int | string %}
        {% set imp = states('sensor.grid_daily') | float(default=-1) * 1000 %}
        {% set imp = '' if imp < 0 else imp | int | string %}
        {% set result = dat + ',' + gen + ',' + exp + ',,,,,,,0,' + imp + ',0,0,' + con + ',,,,' %}
        {{ result }}
  • After adding the template code, go to Developer Tools and click CHECK CONFIGURATION. IF HA reports an error, try adding (or removing) 1 level of indentation to the whole code block, save the file and check again
  • Depending on which integration you are using, you may need to change the names of some of the sensors. For example, if your integration presents 'sesnor.pv_energy_today' or 'sensor.solar_energy_today', 'sensor.feed_in_energy_today', 'sensor.load_energy_today' and 'sensor.grid_consumption_energy_today', it is recommended you use these. If you wish to disable a sensor, add X to the end of the name so data for that sensor is not uploaded
  • Go to Settings, Automations and CREATE a new AUTOMATION, click the three dots and select Edit in YAML and paste the following code, replacing the default yaml:
  alias: Upload pvoutput data every hour
  trigger:
  - platform: time_pattern
    minutes: '59'
  action:
  - service: rest_command.pvoutput_upload
  mode: single
  • Save the automation
  • Go to Developer Tools and CHECK CONFIGURAITON and fix any problems. When everything is OK, Restart HA and wait it to do it's thing
  • Go to Settings, Automations and find your pvoutput upload automation. Click the three dots and click Run. Click again and click Traces and check the Trace Timeline. It usually takes less than 1 second to complete the upload
  • Go to pvoutput.org and refresh the page for your system to check if data was uploaded for today.