Enable/Disable Ewon Flexy WAN or VPN connection using a key switch

02 Aug 2022

The Ewon Cosy features an option that allows users to control the WAN or the VPN connection through its
Digital Input. The idea is to let the end customer decide whether the Integrator or the Machine
builder can connect the Ewon remotely or not using an electrical switch.

This option is unfortunately not directly embedded in the Ewon Flexy. Nevertheless, it is possible to make it
using a simple piece of BASIC Script.

 

APPLICABLE PRODUCTS

Ewon : Flexy

 

PROCEDURE

First create a Tag associated to a digital input of the Flexy. In this example we will use the first digital input of the Flexy Base Unit (DI1).  See Appendix A of the Flexy 205 Installation Guide.

 

mceclip0.png

 

Secondly make sure your Ewon Internet connection is properly configured (You should have executed the Internet Configuration Wizard successfully)

 

Finally, open your BASIC IDE, paste the following BASIC Script and save it.

  • In the Init Section, paste the following script
SETSYS COM,"LOAD"
WANCnxInUse$ = GETSYS COM,"WANCnx"
ONCHANGE "Switch","GOTO DoSwitch"
GOTO DoSwitch
  • Create a new section with the name of your choice and paste this other script
DoSwitch:
IF (Switch@<>0) THEN
Rem Open Internet connection
SETSYS COM,"LOAD"
SETSYS COM,"WANCnx", WANCnxInUse$
SETSYS COM,"WANPermCnx","1"
SETSYS COM,"SAVE"
PRINT Time$;" Connection opened"
ELSE
Rem Close Internet connection
SETSYS COM,"LOAD"
SETSYS COM,"WANCnx","0"
SETSYS COM,"SAVE"
PRINT Time$;" Connection closed"
ENDIF

 

Do not forget to select the AutoRun option (Run > AutoRun) to start the Script execution at the Ewon Start-up.

mceclip1.png

At the end you should have this kind of result :

 

mceclip0.png