Sending two extended data value v7 and v8, but only getting one

I finally have Home Assistant populating PVOutput, but for some reason which I can’t work out, my extended data only has v8 and not v7. The API is giving me a 200 and yet it is not there. What have I missed? This is what I am seeing.

.

This is my YAML

    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 have swapped the v7 and v8 line around and now I get the v7 data and not v8. What am I missing?

I did some more testing. I add a v9 value and then I only got v9. It seems I can only send one extended value and strangely, it is the last line of the YAML.

Hi @bazcurtis,

I don’t know anything about YAML but have you configured your system to accept and display the v7, v8 & v9 values?

Cheers,
Grannos

Thanks for coming back to me. This is driving me crazy :grinning:

These are my settings

At the moment I am not sending the battery information. If I do, I will only get v11 if that is the last line in the YAML.

Doing some ‘googling’ I uncovered this thread which I see that you’ve posted to as well.

In an earlier post to the thread by rodw he has a similar-ish payload to you. Interestingly though there is only one pair of single quote >’< surrounding the entire clause whereas the clause that you are using contains multiple pairs. Have you tried the clause with only a single pair? It may or may not make a difference.

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’

Thanks for coming back to me. I too have Google the life out of this. Even tried ChatGPT :grinning:

This curl works. So this points to a formatting issue on my side.

curl -d "d=20230323" -d "t=21:23" -d "v2=0" -d "v4=414" -d "v5=10" -d "v8=0" -d "v6=247" -d "v7=0" -d "v9=51" -d "v10=0" -d "v11=558" -H "X-Pvoutput-Apikey: key" -H "X-Pvoutput-SystemId: site" https://pvoutput.org/service/r2/addstatus.jsp

I tried the below, but that didn’t work. I will look at your suggestion. I am sure it is going to be dead simple when it is cracked. I am surprise there isn’t more Home Assistant code examples around

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 "d={{now().strftime("%Y%m%d")}}"
    -d "t={{now().strftime("%H:%M")}}"
    -d "v2={{(states('sensor.lux_solar_output_live'))|round(0)}}"
    -d "v4={{(states('sensor.lux_home_consumption_live'))|round(0)}}"
    -d "v5={{(states('sensor.met_office_buntingford_temperature_3_hourly'))|round(0)}}"
    -d "v8={{(states('sensor.lux_solar_output_array_2_live'))|round(0)}}"
    -d "v6={{(states('sensor.lux_grid_voltage_live'))|round(0)}}"
    -d "v7={{(states('sensor.lux_solar_output_array_1_live'))|round(0)}}"
    -d "v9={{(states('sensor.lux_battery'))|round(0)}}"
    -d "v10={{(states('sensor.lux_battery_charge_live'))|round(0)}}"
    -d "v11={{(states('sensor.lux_battery_discharge_live'))|round(0)}}"

Are you able to log the string that is actually pushed to PVO and to see that it corresponds with the structure f the curl example?

With some help from the LuxPowerTek GitHub group I now have it working. The working YAML is below. I hope this can help other people.

I think, and this is only a guess, the issue was the spaces in the original submitted. This was the output from the Home Assistant logs

2023-03-24 09:00:02.112 DEBUG (MainThread) [homeassistant.components.rest_command] Success. Url: https://pvoutput.org/service/r2/addstatus.jsp. Status code: 200. Payload: b’d=20230324 &t=09:00 &v2=621 &v4=526 &v5=9 &v8=482 &v6=246 &v7=139’

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)}}"
2 Likes

It’s always the little things :smile: Glad you’ve got it working.

1 Like

thank you very much I was having the same problem and this fixed it