06.06.2018, 15:17
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.
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