Is there any way to update a modbus profile without having to map all the KNX adresses again?
I'm implementing function on the go and would like the already configurated maps to remain unchanged/no need to map the KNX adress again.
Is it possible to set the profile to poll the read values even though it haven't changed?
I have a Gira Homeserver, KNX visualization, but I can't read the modbus values from the KNX bus, by sending a read request or read on init, when the server reboots.
I have tried script, but it returns 0, always.. even though the value should be greater!
Code:
123456789101112131415
-- init modbus on first script executionifnotmbthenrequire('luamodbus')
mb = luamodbus.rtu()
mb:open('/dev/RS485', 9600, 'N', 8, 1, 'H')
mb:connect()
end-- sets slave ID to read/write data from/tomb:setslave(1)
result=mb:readregisters(27)
grp.write('2/3/10',result)
mb:close()
I have disabled RTU, and the register adress is 4x00027.
The LM modbus profile can read this register, but it doesn't poll the value since it's not changed often, but I need to learn my KNX devices this value when they reboot or things like that.
If I remove the if query, then it works better.
But it interfer with the RTU, so sometimes the value gets zero, but then jumps back to the static "10".
This works better, but the value still gets 0 sometimes, not that often as with above, but still occours.:
First, you should never access serial port directly if it's used by the Modbus mapper, it will lead to random errors.
It might be that read fails for some reason and returns nil which ends up being sent as 0.
Try this:
Code:
1234
result = mb:readregisters(26)
ifresultthengrp.write('2/3/7',result)
end
Another approach is to create a scheduled script which runs every X minutes (depending on frequently you want to resend values). Mark each required object with resend tag, tune interval value in your script as needed.
Code:
12345678910111213
now = os.time()
interval = 120-- resend time in seconds-- go through all objects with "resend" tagobjects = grp.tag('resend')
for_, objectinipairs(objects) dodelta = now - object.updatetime-- check if value must be sent againifdelta >= intervalthenobject:write(object.data)
endend
Thanks, yes I read that in another post that I never should open the serial if mapper is used.
But then I read that MBPROXY could be used instead? So my second example should be OK together with mapper right? Or should I skip the proxy and luamodbus in the script, because the serial is already open due to mapper?
It's a LM2 I'm working with.
I think I might have a collision, because I have set the same group adress in mapper and script for same register, so when the script reads value and send it out on the group adress, then the mapper will listen to this GA and write that value to register. Some sort of loop, I will test to use different GA in the script and see if it collides.
I will probably go for an event script triggered by a GA, so on init of my device I will trigger this GA to learn in all the values.
16.11.2016, 11:34 (This post was last modified: 16.11.2016, 11:36 by FatMax.)
Ok, that makes sense.
Next question;
I´m making 150 profiles (Modbus TCP/IP) to do auto mapping with about 20 registers/coils each. Any idea if the SpaceLYnk can handle that amount of polling..? And if yes, any max modbus devices set for tcp/ip?
Recommended limit is about 1000 objects per device, though 3000 will work but slower. Another thing to consider is adjusting poll interval as value too small will cause high CPU load.