When troubleshooting Wi-Fi issues, it may be helpful to see a Flexy's Wi-Fi signal numerically, rather than just as a symbol on the summary page. This number can be loaded into a tag, which can then be shown as a KPI or recorded to a historical log.
The Wi-Fi signal number ranges from 0, for disconnected, to 7, for a very strong connection.
APPLICABLE PRODUCTS
- Ewon Flexy equipped with Wi-Fi extension card
PRE-REQUISITES
- Ability to edit tags
- Access to the BASIC IDE
IN THIS ARTICLE
Creating the Wi-Fi Signal Tag
- Navigate to Tags → Values, then set mode to Setup at top left
- Add a new tag and give it the name WiFiSignal
- Leave the server name as MEM, which is used for memory tags controlled by user input or a script
- If interested in logging, check "Historical Logging Enabled" and set the Logging Interval to the desired frequency.
WiFiSignal tag configured to log its value every 60 seconds
Adding the BASIC Script
- Navigate to Setup → BASIC IDE
- In the Init Section, paste the code below
- This code first sets a timer that runs the function get_wifi_signal() every ten seconds
- get_wifi_signal() sets the tag WiFiSignal to the value of "WIFISSIDLevel" from system info
- Because the value from system info is a string, the function to_int%() converts this to an integer that can be loaded into the WiFiSignal tag
- Up top, click Run then check Autorun to ensure the script runs automatically after the Ewon reboots
- Finally, at the top right change the "Script execution" toggle to Running to run the script
TSET 1, 10
ONTIMER 1, "@get_wifi_signal"
REM Set tag WiFiSignal to signal from system info
FUNCTION get_wifi_signal():
SETSYS INF, "LOAD"
WiFiSignal@ = @to_int%(GETSYS INF, "WIFISSIDLevel")
ENDFN
REM Convert string to integer
FUNCTION to_int%($param1$):
$to_int% = FCNV $param1$, 30, 0, "%d"
ENDFN
ADDITIONAL INFO
RG-0006-01-EN - Programming Reference Guide