The following solution works in my setup, and does away with the secret problem. It uploads power and energy generation.
In configuration.yaml:
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={{now().strftime("%H:%M")}}&v1={{states.sensor.growatt_energytoday.state|round(1)*1000}}&v2={{states.sensor.growatt_acpower.state|round(0)}}'
content_type: "application/x-www-form-urlencoded"
In automations:
alias: PVOutput Uploader (rest_command)
description: Uploads values to PVOutput
trigger:
- platform: time_pattern
minutes: /5
seconds: '0'
condition:
- condition: state
entity_id: sensor.growatt_status
state: Normal
action:
- service: rest_command.pvoutput_generation
data: {}
mode: single
I am using the sensors described here : ESPHome modbus Growatt ShineWiFi-S