Hi guys,
I've recently installed some solar panels on my roof, and connected my smart meter to my Domoticz instance. Previously I just got 1 device (when looking at Power), and that was just the meter itself, but now it's totally different, and I'm struggling with uploading all the data to Pvoutput.
Now, I get 6 devices:
Usage L1
Usage L2
Usage L3
Delivery L1
Delivery L2
Delivery L3
Has anyone been able to upload this data succesfully to pvoutput. All the scripts I've found don't take the L1,L2,L3 into account, and thus won't work, and I guess there needs to be some aggregation.
Any tips would be highly appreciated!
Thanks in advance!
Uploading data from 3phase smart meter to PvOutput
Moderators: leecollings, remb0
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Uploading data from 3phase smart meter to PvOutput
A dzVents solution could look like this.mcpoowl wrote: ↑Friday 21 June 2019 19:56 I've recently installed some solar panels on my roof, and connected my smart meter to my Domoticz instance. Previously I just got 1 device (when looking at Power), and that was just the meter itself, but now it's totally different, and I'm struggling with uploading all the data to Pvoutput. Now, I get 6 devices; I guess there needs to be some aggregation.
Any tips would be highly appreciated!
When not yet familiar with dzVents please start with reading Get started Before implementing. Special attention please for
"In Domoticz go to Setup > Settings > Other and in the section EventSystem make sure the checkbox 'dzVents disabled' is not checked. Also make sure that in the Security section in the settings you allow 127.0.0.1 to not need a password. dzVents uses that port to send certain commands to Domoticz. Finally make sure you have set your current location in Setup > Settings > System > Location, otherwise there is no way to determine nighttime/daytime state."
Code: Select all
local stringVar = 'PVOutput'
return {
on = {
timer = { 'every 4 minutes'},
httpResponses = { stringVar },
},
logging = {
level = domoticz.LOG_ERROR,
marker = "pvOutput"
},
execute = function(dz, item)
local function post2PVOutput(PVSettings, postData)
dz.openURL({
url = PVSettings.url,
method = 'POST',
headers = {
['X-Pvoutput-Apikey'] = PVSettings.api,
['X-Pvoutput-SystemId'] = PVSettings.id
},
callback = stringVar,
postData = postData
})
end
local function makepostData()
local P1-1 = dz.devices('L1')
local P1-2 = dz.devices('L2')
local P1-3 = dz.devices('L3')
local temperature = dz.devices('myTemperature') -- change to your outside temp device
local voltage = dz.devices('myVoltage') -- change to a device with a voltage value
local round = dz.utils.round
local postdDataAsString =
'd=' .. os.date("%Y%m%d") ..
'&t=' .. os.date("%H:%M") ..
'&v1=' .. tostring(P1-1.usageDelivered + P1-2.usageDelivered + P1-3.usageDelivered ) ..
'&v2=' .. tostring(P1-1.return1 + P1-2.return1 + P1-3.return1 + P1-1.return2 + P1-2.return2 + P1-3.return2 ) ..
'&v3=' .. P1.usage1 + P1.usage2 ..
'&v4=' .. P1.usage ..
'&v5=' .. round(temperature.temperature,1) ..
'&v6=' .. dz.utils.round(voltage.voltage,1)
--[[
'&c1= .. c1
'&n= .. n
Donation mode only parms
'&delay=' .. Delay
'&v7=' .. WaterConsumption
'&v8=' .. InverterFrequency
'&v11=' .. InverterTemp
'&v12=' .. GasConsumption
]] --
return postdDataAsString
end
if item.isHTTPResponse then
dz.log("Return from PVOutput \n" .. item.data,dz.LOG_DEBUG)
else
PVSettings =
{
url = 'HTTPS://pvoutput.org/service/r2/addstatus.jsp',
api = dz.variables('PVoutput_API').value, -- create this (string Type) uservar and put your API in
id = dz.variables('PVoutput_ID').value, -- create this (string Type) uservar and put your PVoutput ID in
}
post2PVOutput(PVSettings, makepostData())
end
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 9
- Joined: Wednesday 06 August 2014 8:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: NL
- Contact:
Re: Uploading data from 3phase smart meter to PvOutput
Hi waaren,
Thanks for your reply and your script.
I don't think that script is going to work though, since my Usage L1 / Delivery L1 etc devices aren't actual P1 devices, but Usage, Electric devices, thus they won't have the .return1 function. See screen below.
NB: The Consumption device is a little test of mine, so forget that one

Thanks for your reply and your script.
I don't think that script is going to work though, since my Usage L1 / Delivery L1 etc devices aren't actual P1 devices, but Usage, Electric devices, thus they won't have the .return1 function. See screen below.
NB: The Consumption device is a little test of mine, so forget that one


- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Uploading data from 3phase smart meter to PvOutput
Looking at your screenshot, I see that your P1 "Power" is already an aggregate of the other devices. So no real modification needed compared to the script I use (apart from the fact that I have a Youless sensor to measure my production directly from the solarPanels kWh meter)
Can you try this one ?
Code: Select all
local scriptVar = 'PVOutput'
return {
on = {
timer = { 'every 4 minutes'},
httpResponses = { scriptVar },
},
logging = {
level = domoticz.LOG_ERROR,
marker = "pvOutput"
},
execute = function(dz, item)
local function post2PVOutput(PVSettings, postData)
dz.openURL({
url = PVSettings.url,
method = 'POST',
headers = {
['X-Pvoutput-Apikey'] = PVSettings.api,
['X-Pvoutput-SystemId'] = PVSettings.id
},
callback = scriptVar,
postData = postData
})
end
local function makepostData()
local P1 = dz.devices('Power')
local Youless = dz.devices('Youless')
local temperature = dz.devices('myTemperature') -- change to your outside temp device
local voltage = dz.devices('myVoltage') -- change to a device with a voltage value
local round = dz.utils.round
local postdDataAsString =
'd=' .. os.date("%Y%m%d") ..
'&t=' .. os.date("%H:%M") ..
'&v1=' .. ( P1.return1 + P1.return2 ) ..
'&v2=' .. P1.usageDelivered ..
'&v3=' .. ( P1.usage1 + P1.usage2 ) ..
'&v4=' .. P1.usage ..
'&v5=' .. round(temperature.temperature,1) ..
'&v6=' .. round(voltage.voltage,1)
--[[
v1 - energy generation
v2 - power generation
v3 - energy consumption
v4 - power consumption
v5 - temperature
v6 - voltage
'&c1= .. c1
'&n= .. n
Donation mode only parms
'&delay=' .. Delay
'&v7=' .. WaterConsumption
'&v8=' .. InverterFrequency
'&v11=' .. InverterTemp
'&v12=' .. GasConsumption
]] --
return postdDataAsString
end
if item.isHTTPResponse then
dz.log("Return from PVOutput \n" .. item.data,dz.LOG_DEBUG)
else
PVSettings =
{
url = 'HTTPS://pvoutput.org/service/r2/addstatus.jsp',
api = dz.variables('PVoutput_API').value,
id = dz.variables('PVoutput_ID').value,
}
post2PVOutput(PVSettings, makepostData())
end
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 9
- Joined: Wednesday 06 August 2014 8:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: NL
- Contact:
Re: Uploading data from 3phase smart meter to PvOutput
Hi waaren,
Thanks for sticking with me. I used your script, and edited the devices where needed, but I keep getting a 400 BAD REQUEST error. Maybe one of the values is too high? This is the log message I generated:
2019-06-23 20:24:00.201 Status: dzVents: Info: pvOutput: Calling PvOutput with HTTPS://pvoutput.org/service/r2/addstatus.jsp with data d=20190623&t=20:24&v1=86505&v2=0&v3=21439325&v4=127&v5=27.5&v6=234.1
//edit: When I post it as a GET request, I get more info:
Bad request 400: Energy value [86505] too high for system size [3720]
//edit2: When I add the c=1 and n=1 flags to the call, I get an 200 OK, so that works, but I'm not sure my data is correct?
Thanks for sticking with me. I used your script, and edited the devices where needed, but I keep getting a 400 BAD REQUEST error. Maybe one of the values is too high? This is the log message I generated:
2019-06-23 20:24:00.201 Status: dzVents: Info: pvOutput: Calling PvOutput with HTTPS://pvoutput.org/service/r2/addstatus.jsp with data d=20190623&t=20:24&v1=86505&v2=0&v3=21439325&v4=127&v5=27.5&v6=234.1
//edit: When I post it as a GET request, I get more info:
Bad request 400: Energy value [86505] too high for system size [3720]
//edit2: When I add the c=1 and n=1 flags to the call, I get an 200 OK, so that works, but I'm not sure my data is correct?
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Uploading data from 3phase smart meter to PvOutput
Had another look but I seem to have messed up something in my own script or something has changed on the pvOutput side. Will have a look later this week and come back to you.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Uploading data from 3phase smart meter to PvOutput
I indeed messed up something in my own script when I did some tests. Sorry for the confusion caused.
If you change the postdataAsString declaration to
Code: Select all
local postdDataAsString =
'd=' .. os.date("%Y%m%d") ..
'&t=' .. os.date("%H:%M") ..
'&v1=' .. P1.return1 + P1.return2 ..
'&v2=' .. P1.usageDelivered ..
'&v3=' .. P1.usage1 + P1.usage2 ..
'&v4=' .. P1.usage ..
'&v5=' .. round(temperature.temperature,1) ..
'&v6=' .. dz.utils.round(voltage.voltage,1) ..
'&c1=1'
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 9
- Joined: Wednesday 06 August 2014 8:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: NL
- Contact:
Re: Uploading data from 3phase smart meter to PvOutput
Thanks waaren, I'll check tonight, and post back tomorrow!
//edit: Seems to be working now! https://pvoutput.org/intraday.jsp?id=40263&sid=36810
//edit: Seems to be working now! https://pvoutput.org/intraday.jsp?id=40263&sid=36810
Who is online
Users browsing this forum: Google [Bot] and 1 guest