Hi Didier,
I am testing Home assistant for the first time and i am struggling trying to use the description you posted.
I input the portion sensor and shell_command into configuration.yaml . The API and system id into the file secret.yalm
Checking the file configuration.yaml system says it is OK …no errors… but how to run every 5 minutes the command to upload data to PVOUTPUT?
Would be very appreaciated a support from you.
So I got the API working fine thanks to your posts above, however I’m a bit confused how I create a 5min average sensor to send to PVoutput.
I have a template sensor that calculates my instantaneous house consumption (removing solar generation):
Awesome, thanks for that example. Based on that I’ve got a functioning configuration for a Fronius inverter. The config below uploads all the standard fields, including consumption, voltage, temperature etc. So if anyone else adapts this for there fronius choose which fields you want to upload, v1 and v3 are the essential ones I believe.
Note to deal with the ‘unknown’ state from a sensor in some circumstances the powerflow is set to default to 0, if it’s unable to be rounded.
This thread was very useful, but when I trigger this via an automation I get this error in the trace: Stopped because an error was encountered at September 5, 2022 at 9:30:37 PM (runtime: 0.02 seconds) ’entity_id’
Any ideas on how to resolve this?
Using the rest_command
rest_command:
pvoutputpro:
url: https://pvoutput.org/service/r2/addoutput.jsp
method: POST
headers:
X-Pvoutput-Ap:ikey: xxxxxxxxxxxxxxxxxxxxxxx" <<<< does this have a typo? should be X-Pvoutput-Apikey:
X-Pvoutput-SystemId: "yyyyy"
accept: "application/json"
user-agent: 'Mozilla/5.0 {{ useragent }}' <<< I don't use this
payload: 'd={{now().strftime("%Y%m%d")}}&t={{now().strftime("%H:%M")}}&v1={{states.sensor.yield_energy_daily_wh.state|float(0)|round(0)}}&v2={{states.sensor.solar_power_c.state|float(0)|round(0)}}v3={{states.sensor.grid_consumption_energy_wh.state|float(0)|round(0)}}&v4={{states.sensor.load_power.state|float(0)|round(0)}}&v6={{states.sensor.solar_voltage_a|float(0)}}&c1=1'
content_type: "application/x-www-form-urlencoded"
Your indents are out compared to mine, I edited yours above. I don’t use the accept line either(although I doubt that matters.)
You also have an extra : in the api key line.
"d={{now().strftime('%Y%m%d&t=%H:%M')}}&
I use that for the datetime
thats my whole payload line, although mine converts from kWh back to Wh
Thanks for the help and pointing out silly typos that must have crept in. Really appreciated.
I reworked my payload and checked the formatting on the developer tools/template page which was super helpful as I found one value with a trailing .state missing!
I had converted values to Wh in a template before the payload