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.

Photovoltaik Visu
#3
(10.05.2020, 17:02)Erwin van der Zwart Wrote: Hi,

The error is probably because the storage is never saved yet due to your condition, then you fetch 'nil' and you cant perform a calculation. 

Change your code like this
Code:
else
  PVEnergie = grp.getvalue(adr_PVEnergie)
  vortageswert = storage.get('vortageswert')
  if vortageswert == nil then
    storage.set('vortageswert', 0)
    vortageswert = 0
  end
  PVTageswert = PVEnergie - vortageswert
Easiest way to do this is to use the partial energy registers from the iEM3155, make sure to disable the "com protection" (enabled by default) on the meter by using the display and create a virtual object and attach a scheduler to it with a event at 00:00 and attach this script to the object and adjust connection details and slave id as needed
Code:
require('luamodbus')
mb = luamodbus.rtu()
mb:open('/dev/RS485', 19200, 'E', 8, 1, 'H')
mb:connect()
mb:setslave(1)
mb:writeregisters(5249, 2020, '')
mb:close()
The partial energy registers are now receiving a reset command by the command interface every day at 0:00

Add a trend to your partial registers and you are good to go..

BR,

Erwin

thanks for your help, the first script does not work ... the second only works, unfortunately I do not have the Total Active Energy Export modbus register ... and I do not know how to write it into the Modbus register
Reply


Messages In This Thread
Photovoltaik Visu - by tirei - 10.05.2020, 11:06
RE: Photovoltaik Visu - by tirei - 10.05.2020, 20:04

Forum Jump: