Posts: 74
Threads: 21
Joined: Sep 2016
Reputation:
0
Hi,
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.
Posts: 7764
Threads: 42
Joined: Jun 2015
Reputation:
447
No, but you can set bus_address field in the profile itself so you don't have to do mapping manually after creating a device with new/updated profile.
Posts: 74
Threads: 21
Joined: Sep 2016
Reputation:
0
Thanks!
Code: "bus_address": 1/1/1,
Will I be able to change the group adress in the web-interface later, or is it hard-written when writing in the profile?
Posts: 7764
Threads: 42
Joined: Jun 2015
Reputation:
447
Yes, you can change or remove mapping later.
Posts: 74
Threads: 21
Joined: Sep 2016
Reputation:
0
Thanks.
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: -- init modbus on first script execution
if not mb then
require('luamodbus')
mb = luamodbus.rtu()
mb:open('/dev/RS485', 9600, 'N', 8, 1, 'H')
mb:connect()
end
-- sets slave ID to read/write data from/to
mb: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.
Posts: 74
Threads: 21
Joined: Sep 2016
Reputation:
0
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.:
Code: mbproxy = require('mbproxy')
mb = mbproxy.new()
mb:setslave(1)
result=mb:readregisters(26)
grp.write('2/3/7',result)
The best were if it was possible to let the RTU send values to the bus even though the are unchanged.
Posts: 7764
Threads: 42
Joined: Jun 2015
Reputation:
447
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: result = mb:readregisters(26)
if result then
grp.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: now = os.time()
interval = 120 -- resend time in seconds
-- go through all objects with "resend" tag
objects = grp.tag('resend')
for _, object in ipairs(objects) do
delta = now - object.updatetime
-- check if value must be sent again
if delta >= interval then
object:write(object.data)
end
end
Posts: 74
Threads: 21
Joined: Sep 2016
Reputation:
0
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.
Posts: 74
Threads: 21
Joined: Sep 2016
Reputation:
0
Maybe I should upgrade from 16.07 to 16.09 as well..
Posts: 221
Threads: 45
Joined: Nov 2015
Reputation:
2
Is there any way to set Object name as well? When I put bus_address in the json profile it maps it correctly, but with no name in the Object..
Posts: 7764
Threads: 42
Joined: Jun 2015
Reputation:
447
No, because it only does grp.write or grp.update to the specified address. Object creation must be done through the web interface.
Posts: 221
Threads: 45
Joined: Nov 2015
Reputation:
2
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?
Posts: 7764
Threads: 42
Joined: Jun 2015
Reputation:
447
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.
|