This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Daily logging of produced energy from solar inverter
#5
Hi,
thanks buuuudzik for the hint how to append values to a table. I tested it and it works as expected.

admin: I tried to achieve this by using trends and ran into the following limitations:
- Trend resolution is too small, I need to log one value once a day.
- I'm logging the total amount of kWh produced on every day. This value increases throughout the current day until it reaches a maximum value (when the inverter deactivates itself). So 
when I create a trend of the produced kWh's there's too much information in it. As far as I read here in the forum, an averaging is performed on the trend data when it dates back more than 30 days (or whatever value was chosen when creating the trend). This averaging is not apropriate in this case, as the maximum value is wanted.
- Finally it's going to be displayed as a bar chart, with daily/monthly/yearly values.

thanks again. Here's the script and the view of the storage attached as png. 

Code:
-- Log PV-Production
-- get value of object named 'PV Yesterday kWh'
-- Config:
logVariable = '_PV_Energy_daily'  -- custom value so it shows on top of the Storage Viewer App

-- Script start:
value = grp.getvalue('PV Yesterday kWh')
pvLogs = storage.get(logVariable)

toAdd = {
 timestamp = os.time(),
 Energy = value
}

if (pvLogs == nil) then
 -- create table first
 saveTable = {}
 table.insert(saveTable, toAdd)
 storage.set(logVariable, saveTable)
else
 table.insert(pvLogs, toAdd)
 storage.set(logVariable, pvLogs)
end

Attached Files Thumbnail(s)
   
Reply


Messages In This Thread
RE: Daily logging of produced energy from solar inverter - by tintsch - 06.06.2018, 15:17

Forum Jump: