PVOuput Uploader

Any progress on integrating upload capability into core? It would be incredibly useful and powerful to have HA be able to upload its data (since it can come from multiple sources) to pvoutput and emoncms so that we can compare data with other users. I think this would lead to a large number of HA adoption as many in the energy monitoring community are using old antiquated techniques. Thanks!

3 Likes

I have a strange issue. I am not getting the v7 or v8 data depending on where I put it in the YAML. Using my example I get the v8 data, but not the v7. If I swap it around like this, I get the v7 and not the v8.

    payload: >-
        d={{now().strftime("%Y%m%d")}}
        &t={{now().strftime("%H:%M")}}
        &v2={{(states('sensor.lux_solar_output_live'))|round(0) }}
        &v4={{(states('sensor.lux_home_consumption_live'))|round(0) }}
        &v5={{(states('sensor.met_office_buntingford_temperature_3_hourly'))|round(0) }}
        &v8={{(states('sensor.lux_solar_output_array_2_live'))|round(0) }}
        &v7={{(states('sensor.lux_solar_output_array_1_live'))|round(0) }}

I finally have this working with some help from the LuxPowerTek GitHub group. This is the working YAML. I hope it can help other people.

rest_command:
  update_pvoutput:
    url: https://pvoutput.org/service/r2/addstatus.jsp
    method: post
    content_type: "application/x-www-form-urlencoded"
    headers:
        X-Pvoutput-Apikey: !secret pvoutout-api
        X-Pvoutput-SystemId: !secret pvoutput-site
    payload: "d={{now().strftime('%Y%m%d')}}&t={{now().strftime('%H:%M')}}&v2={{(states('sensor.lux_solar_output_live'))|round(0)}}&v4={{(states('sensor.lux_home_consumption_live'))|round(0)}}&v5={{(states('sensor.met_office_buntingford_temperature_3_hourly'))|round(0)}}&v8={{(states('sensor.lux_solar_output_array_2_live'))|round(0)}}&v6={{(states('sensor.lux_grid_voltage_live'))|round(0)}}&v7={{(states('sensor.lux_solar_output_array_1_live'))|round(0)}}&v9={{(states('sensor.lux_battery'))|round(0)}}&v10={{(states('sensor.lux_battery_charge_live'))|round(0)}}&v11={{(states('sensor.lux_battery_discharge_live'))|round(0)}}&v12={{(states('sensor.lux_power_to_grid_live'))|round(0)}}"

I have this working but I have phantom power from my solar sensor.
How do i modify the below to say ‘if value less than 15, then set to 0’ ?
Or - do I do that on the sensor config itself somehow ?
Sorry - I am very very new to HA - and have a load of things yet to add, but getting there.

pvoutput_generation: ‘curl -d “d={{now().strftime(”%Y%m%d")}}" -d “t={{now().strftime(”%H:%M")}}" -d “v2={{states.sensor.cc_solar_generation_power.state|int}}” -H “X-Pvoutput-Apikey: keyhere” -H “X-Pvoutput-SystemId: systemidhere” https://pvoutput.org/service/r2/addstatus.jsp

just wanted to say I stumbled upon this after my old process (ginlong scaper) stopped working with the migration of Soliscloud.

Made sense to have this running at the same time as HA and its one less process to run on my NAS…All seems to work smoothly…will make sure tomorrow’s numbers tie up…but thanks to all the tips and comments here that made things pretty simple

Hi there,

interesting topic this is! I also have solar power and meteobridge coming in on HA. Now I wanted to upload these values. Long time ago I did this with domoticz but now want to use HA.
I read al these stiff here but get stuck.
It is not clear where I put all these code.
Do I need the code from Martijn Braam?
And where do I put rest commands and all others? Could anyone make a list of what code where to put in HA?
Thanks in advance.

Use this post as reference

But be sure to update the apikey, SystemId + check the v1 and v2 values for the correct sensors that you use for your inverter data. If you don’t know what to put there, the API spec: API Specification — PVOutput documentation

It’s still working great here.

1 Like

Hi! I used this sucessfully for some months.
About 4 weeks ago I started getting error (Logs) and I have no idea what I could change to resolve it?
Could somebody help me what I am doing wrong?


I was able to implement this thanks to the posts so far above.

My automations.yaml file.

- alias: PVOutput Uploader (rest_command)
  description: Uploads values to PVOutput
  trigger:
    - platform: time_pattern
      minutes: /5
      seconds: "0"
  action:
    - service: rest_command.pvoutput_generation
      data: {}
  mode: single

My configuration.yaml file.

logger:
  default: info
  logs:
    homeassistant.components.rest_command: debug

    # Power Consumption (Instantaneous), Energy Consumption (Accumulated)
rest_command:
  pvoutput_generation:
    method: POST
    url: https://pvoutput.org/service/r2/addstatus.jsp
    headers:
      X-Pvoutput-Apikey: !secret pvoutput_api_key
      X-Pvoutput-SystemId: !secret pvoutput_system_id
    payload: "d={{now().strftime('%Y%m%d&t=%H:%M')}}&c1=1&v3={{states('sensor.esphome_web_a2e2e8_load_power_consumption_of_the_day')| float * 1000 }}&v4={{states('sensor.energy_consumption_5min')|float(0)}}&v1={{states('sensor.esphome_web_a2e2e8_power_generation_of_the_day')| float * 1000 }}&v2={{states('sensor.energy_generation_5min')|float(0)}}&v6={{states('sensor.esphome_web_a2e2e8_pv_voltage')|float(0)}}"
    content_type: "application/x-www-form-urlencoded"

My payload response.

2024-03-26 16:20:01.744 DEBUG (MainThread) [homeassistant.components.rest_command] Success. Url: https://pvoutput.org/service/r2/addstatus.jsp. Status code: 200. Payload: b’d=20240326&t=16:20&c1=1&v3=6500.0&v4=660.5&v1=4300.0&v2=986.65&v6=74.0’

So far the result.

I was testing a couple of stuff and I used my accumulated energy sensor at one point for the payload, thus the jump in energy use. I only multiplied by 1000 for the values that come as kWh.

I have two inverters, one already in use for almost 10 years, the other brand new. I managed to have an automated upload via HA using the rest_command to a new account. I would like to upload the other one as well to a existing account. Adding another rest_command results in an error.

rest_command:
  pvoutput_generation:
    method: POST
    url: https://pvoutput.org/service/r2/addstatus.jsp
    headers:
      X-Pvoutput-Apikey: key1
      X-Pvoutput-SystemId: ID1
    payload: 'd={{now().strftime("%Y%m%d")}}&t={{now().strftime("%H:%M")}}&v1={{states.sensor.inverter_1_yieldday|round()+states.sensor.inverter_2_yieldday|round()}}'  
    content_type: "application/x-www-form-urlencoded" 

  pvoutput_generationABB:
    method: POST
    url: https://pvoutput.org/service/r2/addstatus.jsp
    headers:
     X-Pvoutput-Apikey: key2
     X-Pvoutput-SystemId: ID2
    payload: 'd={{now().strftime("%Y%m%d")}}&t={{now().strftime("%H:%M")}}&v1={{states.sensor.solar_inverter_total_energyy|round()*1000}}'  
    content_type: "application/x-www-form-urlencoded"

What error do you get ?

Maybe the double yy at the end of energy ?

states.sensor.solar_inverter_total_energyy

1 Like

Got a configuration error at check configuration.

Changed the pvoutput_generationABB to pvoutput_generationabb and removed the yy and now the config is valid. Will load the new configuration.yaml when it is all ok for other users.
Thanks

I’m also adding the PVoutput payload
it is working , but still V3 and V4 are not correct in my case
V3 Gross Energy Consumption today (Wh)
V4 Gross Power Consumption today (W)

if im correct the Gross value
so i have to calculate

V3 = energy consumption(today) from grid + generated solar energy(today) - energy return to grid(today)

but im getting a hard time calculating this
i have sensors
Electricity Meter Energy consumption (tarif 1)
Electricity Meter Energy consumption (tarif 2)
Electricity Meter Energy production (tarif 1)
Electricity Meter Energy production (tarif 2)
Solar Energy production today

With the app Utility meter i can calculate the today values (resets daily) but look like it is not always working correctly

is there a easier better way to calculate V3 and V4