PVOuput Uploader

I was looking for this too and I am happy I found this solution. I don;t like my API key in the YAML files though as I use Github so I did this to template the API key:

sensor:
  - platform: template
    sensors:
      pvoutput_api_key:
        value_template: !secret pvoutput_api_key
        
      pvoutput_system_id:
        value_template: !secret pvoutput_system_id

and in the curl command:

shell_command:
   pvoutput_generation: 'curl -d "d={{now().strftime("%Y%m%d")}}" -d "t={{now().strftime("%H:%M")}}" -d "v2={{states.sensor.cs31011195_output_power.state|round(0)}}" -H "X-Pvoutput-Apikey: {{states.sensor.pvoutput_api_key.state}}" -H "X-Pvoutput-SystemId: {{states.sensor.pvoutput_system_id.state}}" https://pvoutput.org/service/r2/addstatus.jsp'

   pvoutput_consumption: 'curl -d "d={{now().strftime("%Y%m%d")}}" -d "t={{now().strftime("%H:%M")}}" -d "c1=1" -d "v3={{(states.sensor.energy_consumption_tariff_1.state|int)+(states.sensor.energy_consumption_tariff_2.state|int)}}" -H "X-Pvoutput-Apikey: {{states.sensor.pvoutput_api_key.state}}" -H "X-Pvoutput-SystemId: {{states.sensor.pvoutput_system_id.state}}" https://pvoutput.org/service/r2/addstatus.jsp'

I am using two commands as I have a cumulative energy usage value from my smart meter and a power generation value from the solar power invertor. (note: the c1=1 means cumulative)

3 Likes