Upload energy data to PVoutput (Lua)
And of course feedback is welcome

Moderator: leecollings
Nice work!roblom wrote:At this moment I have two scripts running, one for the generated energy from my PV installation and one that pulls the data from my smartmeter. Both of these scripts uploads the values to PVoutput and Domoticz. As I would like to have the Domoticz database the primari database as possible and as the consumption calculation of PVoutput isn't accurate as I would like I dived into the Lua scripting. As I'm no programmer and therefore I didn't had any knowledge of Lua it took me a few weeks but my first Lua script was born. As I like sharing my knowledge I created a Wiki of it.
Upload energy data to PVoutput (Lua)
And of course feedback is welcome
roblom wrote:I don't know if it's the right way but if you edit the front page with the table and add a new wiki in it, then after you have saved it, you can click on it and it opens a new empty wiki.
Nice to hear it worked.pimvolkert wrote:It was pretty easy to configure. Except for one 1 small error/bug in the Wiki documentation, which avoided the script working.
When you use a P1 meter (like me) an additional change has to be made to the script cript_device_calculate_consumption.lua
Change:
if devicechanged[ImportedDeviceName] then
into:
if devicechanged[EnergyDeviceName] then
Then it worked flawless.
Hibomboclat wrote:Markk,, did you find any solution ,.,
i am getting crazy with socket and lua52... all example are for unix or Pi... nothing for windows.
I try to recompile the socket lib ... but nothing .to do ... do not work
Ciao
Michele
I already have a Raspberry Pi with Domoticz loaded but got stuck ages ago trying to get further. I need to change the port as I already have port 8080 on another device. I've asked here loads of times but, unfortunately, as helpful as everyone is, no-one has yet given me idiot instructions on how to do this!roblom wrote:Sorry I can't help with this.
But maybe a stupid question, but why are you running it on windows? You can but a Raspberry for about € 30,- then you don't have to get crazy anymore
So already tried that by changing 8080 to something else?To start Domoticz automatically when the system starts perform the following steps:
sudo cp domoticz.sh /etc/init.d sudo chmod +x
/etc/init.d/domoticz.sh
sudo update-rc.d domoticz.sh defaults
Edit the startup script and change the USERNAME, DAEMON and DAEMON_ARGS parameters to reflect your current
settings
sudo vi /etc/init.d/domoticz.sh
USERNAME=pi
DAEMON=/home/$USERNAME/domoticz/$NAME
DAEMON_ARGS="-daemon -www 8080 –sslwww 443"
If you want to use another web interface port change:
DAEMON_ARGS="-daemon -www 8080 –sslwww 443"
Code: Select all
- Domoticz IDX of devices
----------------------------------------------------------------------------------------------------------
local GenerationDeviceName = "3685" -- Device name of the Generated energy
local ConsumptionDeviceName = "xxxxx" -- Name of the energy device that shows calculated Consumption
local VoltageDeviceName = "xxxxx" -- Name of the voltage device that shows voltage of the inverter
local TemperatureDeviceName = "2563" -- Name of the temperature device that shows outside temperature
Code: Select all
local PVoutputURL = '://pvoutput.org/service/r2/addstatus.jsp?key=' -- The URL to the PVoutput Service
You probably need to modify the script a bit to remove the not needed devices.Derik wrote:Sear All.
Do i need all the setting give a idx?
I will only upload my winddelen, so no consumption..Code: Select all
- Domoticz IDX of devices ---------------------------------------------------------------------------------------------------------- local GenerationDeviceName = "3685" -- Device name of the Generated energy local ConsumptionDeviceName = "xxxxx" -- Name of the energy device that shows calculated Consumption local VoltageDeviceName = "xxxxx" -- Name of the voltage device that shows voltage of the inverter local TemperatureDeviceName = "2563" -- Name of the temperature device that shows outside temperature
NoDerik wrote: Do i need to change this?:Code: Select all
local PVoutputURL = '://pvoutput.org/service/r2/addstatus.jsp?key=' -- The URL to the PVoutput Service
No a crontab is not needed.Derik wrote: EDIT:
And do i need a crontab?
Or is lua self starting?
What is shown in the log?Derik wrote: Found;
script_time_upload_to_PVoutput.lua
Only there is nothing uploading?
Should upload every 5 minutes?
I just found out the problem is the current "life time" production energy value. It is set way to low, since I created the virtual production sensor just recently. My PV and Smartmeter have been in production for more then 2 years though...pgit wrote:The problem is that the virtual device for the consumption, besides showing the current consumption correctly (I think), is also showing a negative cumulative energy consumption value.
I guess the script is querying the wrong value from my PV Production device in Domoticz: not the current production level, but one of the cumulative ones (either the total- or the daily production).
Users browsing this forum: No registered users and 0 guests