Simple Script to automatically Reset OPCUA I/O Server

Occasionally the remote OPCUA Server that the Flexy 205 is communicating with will lose power and thus communications are stopped. When the remote OPCUA server is back online, the EWON Flexy 205 OPCUA IOServer does not automatically reconnect. I can get the Flexy205 to restore communications to the OPCUA Server by manually disabling the Topic within the OPC UA IO Server and waiting a 10-15 seconds and then renabling the Topic. How can I setup the EWON Flexy 205 to automatically monitor the connection and if the connection is lost then perform the disable / enable of the OPC UA Topic automatically? If it’s a script, can someone get me started with the basic functionality of how the script would be setup?

Hi @anonuvgkfiwh,

I’m looking into this and checking if there’s a way to trigger the Init button for the OPCUA server over the BASIC IDE.

-Tim

It looks like Simon has an example of this on the Techforum that you should be able to do.

https://techforum.ewon.biz/thread-1198.html

You’ll need to modify it so that it corresponds to your device with the correct login info, IP address, etc. Also change the cbIOSrvList=5 to cbIOSrvList=3 for this to work with the OPCUA server.

1 Like

How do I set this up to automatically run when I see an error with the communications?
The way it is currently setup it looks like a static execution.

There’s 3 different ways I can think that would help you trigger this.

You’ll want to create a function with either an Ondate, Onerror, or Ontimer condition.

OnError could work if you know the specific error that is being shown each time this happens. You could then have a section of the script check if the error number matches, and if that number is a match run the OPCUA Initialization.

OnTimer could work if it happens very frequently. You could have a script that just runs every x seconds/minutes/hours.

OnDate could work if there’s a specific time that this seems to be occurring on. If it’s say every day at a certain time.

RG-006-0-EN-(Programming Reference Guide)(1).pdf (865.6 KB)

-Tim