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 whether you accept or reject these cookies being set.

Modbus RTU Serial Enabled/Disabled by Script
#1
Hi guys...

is there a way to activate and deactivate the Modbus RTU Serial 1 by an event script?, cuz´I want to use an object for doing this from the visualization without using the administrator account 

B.R
Reply
#2
What is the use case for that?
Reply
#3
Hi admin,

I'm trying to use 2 Modbus Masters writing in KNX(The LM and an external one)reading common devices but clearly not at the same time, so the master change should be done by the final user, switching between them without getting access over the LM config. That's why I want to set up a switch in user's visualization for make this change.

B.R
Reply
#4
This is not the best approach. You should make one device talking to slave and the other two masters should exchange data in another way. LM can be also modbus slave.
Reply
#5
Thanks Daniel,

But what happened if I had 2 masters reading same devices?, in Modbus that's imposible but...you can do it if you turn off one master when the other one is working, as I see.. that's like a redundant modbus network, that's the thing that I wanna get... it's easy from the admin account cuz' you just go to the modbus tab and disable RTU and it's done...but the tricky thing is to do it from the visualization...
Reply
#6
Use this event script to emulate a web request to enable/disable RTU. Attach it to a boolean object.

Code:
value = event.getvalue()

require('uci')
require('json')

function getvar()
  return 'config-save'
end

function json.data()
  return { enabled = value }
end

dofile('/lib/genohm-scada/plugins/modbus/web.lua')
Reply
#7
Thank u so much admin, it totally works!

B.R
Reply


Forum Jump: