How to Enable/disable datasource by Script in active process command?
-
How to Enable/disable datasource by Script in active process command?
in Event handler
My problem is when my mango restart modbus sierial datasource can't get data until i disable datasource and enable again. *i use usb to RS485 connect to my raspberry pi. -
Hi te36051, welcome to the forum!
var dsxid = 'DS_Modbus'; //Change to your data source's XID RuntimeManager.disableDataSource(dsxid); RuntimeManager.enableDataSource(dsxid);
-
@phildunlap
Thank you for your code.i try to add event to datapoint .Set Event detectors Type "No update" and add code to Script at Active action . It not work for me. can you recommend me?mycode
var dsxid = 'DS_7b18e9be-4329-41c0-b4af-a65de69c683d'; //Change to your data source's XID
RuntimeManager.disableDataSource(dsxid);
RuntimeManager.enableDataSource(dsxid); -
Ok Thank 's a lot . It work! move code to Event type -> SystemEvents -> SystemstartUp
-
Glad to hear it! It should work in any script set point event handler, but you may need to give the handler sufficient script permissions (add 'superadmin' to the script permissions fields on the event handler) and ensure the event is raised.