VPN Control via a Tag on Flexy
Hello,
Would you like to use a digital input to enable/disable the VPN connection on your Flexy like you can with a Cosy? This can be done with a short BASIC script. This also gives you the option to control it via a bit/coil in the PLC instead.
To use it, copy and paste the following text into the "Init Section" of the BASIC IDE on-board the Flexy. Read the project description for the details.
Best regards,
Trevor Lang
Field Applications Engineer
HMS Networks
//*********************************************************************************************************
// VPN Control via a Tag - v1.0 (8/11/2021)
//
// Project Description
//---------------------------------------------------------------------------------------------------------
// This script will enable/disable the VPN connection based on the status of a tag called "VPNSwitch".
// This tag must be created in the Flexy tag list prior to running this script. When the tag is "true"
// (i.e. non-zero), the VPN will be enabled. When the tag is "false" (i.e. equal to zero) the VPN will
// be disabled. The "VPNSwitch" tag can be associated with a digital input on the Flexy. Via the digital
// input, a key switch or selector switch can be hard-wired to the Flexy for local control of VPN
// connectivity. An alternative would be to assign "VPNSwitch" to a bit/coil in the PLC. This would give
// the PLC the ability to enable/disable VPN connectivity.
//
// To make this script run at boot-up, open the "Run" menu and check the box for "Autorun".
//*********************************************************************************************************
//
@VPNControl(VPNSwitch@)
ONCHANGE "VPNSwitch", "@VPNControl(VPNSwitch@)"
END
//
FUNCTION VPNControl($VPNSwitch)
IF ($VPNSwitch<>0) THEN
// Open VPN connection
SETSYS COM,"load"
SETSYS COM,"VPNCnxType","2"
SETSYS COM,"save"
PRINT Time$;" - VPN connection opened"
ELSE
// Close VPN connection
SETSYS COM,"load"
SETSYS COM,"VPNCnxType","0"
SETSYS COM,"save"
PRINT Time$;" - VPN connection closed"
ENDIF
ENDFN
//*********************************************************************************************************-
Hi again,
I would like to add a comment to this post. There are several Flexy features that depend on the VPN connection. If you switch the VPN connection off, these services will not function: live KPI's on M2Web.Talk2M.com, emails sent via the Talk2M relay server (relay.talk2m.com), DataMailbox uploads, M2Web API calls from third-party applications, etc. If your application depends on any of these services, it would be best to leave the VPN active full time.
Best regards,
Trevor0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
1 Kommentar