Tutorials, libraries, softwares, e!COCKPIT and CODESYS code examples for WAGO PLC, WAGO PFC Controller.
Default WAGO PFC username “admin” and password “wago”.
Open WinSCP and Configure Login.
a. Select SCP for ‘File Protocol’, enter WAGO IP address for hostname, and the username and password.
b. Port number remain as “22”.
Default WAGO PFC username “root” and password “wago”.
Download the respective files to your own folder.
Create your own conf file, mysettings.conf in /etc. This file is to store your configuration values.
# /etc/mysettings.conf
# My settings
my_publish=no
my_topic="/wago"
my_interval=5
Create get_mysettings_conf file for reading values.
Download get_mysettings_conf and edit. This file is for WBM to read values in mysettings.conf.
Line 21 to 29 - Edit line 23, 25, 27 for each variable values.
# validate request params
case $1 in
my_publish)
;;
my_topic)
;;
my_interval)
;;
*)
Create config_mysettings file for writing values.
Download config_mysettings and edit. This file is for WBM to write values to mysettings.conf.
Line 18 - Change the file name to what you configured in previous step.
CONF_FILE="/etc/mysettings.conf"
Line 47 to 49 - Edit the values to be configured.
PUBLISH=`GetParameterValue my_publish $*`
TOPIC=`GetParameterValue my_topic $*`
INTERVAL=`GetParameterValue my_interval $*`
Line 50 to 79 - Edit line 53, 62, 71 for each variable values. Take note there is “c” in second word.
”/^my_publish/cmy_publish=$PUBLISH”
”/^my_topic/cmy_topic=$TOPIC”
”/^my_interval/cmy_interval=$INTERVAL”
if [ "$status" = "$SUCCESS" ]; then
# update "my_publish"
sed -i "/^my_publish/cmy_publish=$PUBLISH" $CONF_FILE
status=$?
if [ "$status" != "$SUCCESS" ]; then
status=$SHELL_ERROR
ReportError $status
SetLastError "Error while writing mysettings config file"
fi
# update "my_topic"
sed -i "/^my_topic/cmy_topic=$TOPIC" $CONF_FILE
status=$?
if [ "$status" != "$SUCCESS" ]; then
status=$SHELL_ERROR
ReportError $status
SetLastError "Error while writing mysettings config file"
fi
# update "my_interval"
sed -i "/^my_interval/cmy_interval=$INTERVAL" $CONF_FILE
status=$?
if [ "$status" != "$SUCCESS" ]; then
status=$SHELL_ERROR
ReportError $status
SetLastError "Error while writing mysettings config file"
fi
fi
Locate the sudoers file in root directory. Append /etc/config-tools/config_mysettings,
after www ALL=NOPASSWD:
.
# User privilege specification
www ALL=NOPASSWD: /etc/config-tools/config_mysettings, /sbin/ifup, .....
Create mysettings.js in /var/www/wbm/js
.
Create device_param_list.js.php in /var/www/wbm/js
.
Line 3673 to 3692.
/*---------------------------------------------------------------------------
* MySettings
* ---------------------------------------------------------------------------
*/
var CreateMySettingsParams = (function()
{
deviceParams.Add(
{
id : 'mysettings',
exampleValue : '' ,
configtoolReadParams :
{
name : 'get_mysettings_conf',
parameter : [ 'my_publish=$my_publish',
'my_topic=$my_topic',
'my_interval=$my_interval' ],
sudo : true
}
});
})();
Edit the file index.php in /var/www/wbm/
.
3.1 Append <script type="text/javascript" src="js/mysettings.js"></script>
after <script type="text/javascript" src="js/opkg.js"></script>
.
<script type="text/javascript" src="js/opkg.js"></script>
<script type="text/javascript" src="js/mysettings.js"></script>
3.2 Append new MySettingsContent('mysettings'),
after var content = new Array(
.
var content = new Array(
new MySettingsContent('mysettings'),
new InformationContent('information'),
Edit the file frontend_config_wbm.xml in /var/www/wbm/
.
Add the following code to the place you want the link to display at WBM.
<level id="mysettings" uid="MYSETTINGS">
<nav ressource="index.php" text="My Settings" user_level="2" fragment="mysettings"/>
</level>
Example, to display above Diagnostic
<level id="mysettings" uid="MYSETTINGS">
<nav ressource="index.php" text="My Settings" user_level="2" fragment="mysettings"/>
</level>
<level id="diagnostic" uid="DIAGNOSTIC">
<nav ressource="index.php" text="Diagnostic" user_level="0" fragment="diagnostic"/>
</level>