ASCII configuration files can be designed flexibly and with dependencies by using the Lua scripting language within them.

The description in this Configuration Guide follows a configuration in the new user interface (web interface) available from icom OS 5.5. Update your router to the latest version of icom OS for the required functionality of the new user interface. The description of this configuration in the classic web interface is available in this Configuration Guide.

Situation

A parameter is to be added to an existing profile using an ASCII configuration file containing a Lua script.

Solution

The problem when adding a list parameter to an existing configuration list is that it is necessary to know the number of already existing list entries if another parameter references to this parameter. If the number is unknown or the ASCII configuration is to be applied to different routers with a differing number of list entries, this can be solved using a Lua script to determine the number of existing list entries. We use the example of the Configuration Guide Dual Connection Check with Ping and Triggering an Action to show how to do this. This example uses an ASCII configuration file to add a timer and an event that uses this timer. To use this timer, the event must know the number of it.

Refer to the Lua 5.3 Reference Manual for more information about Lua.

Preparation of the ASCII configuration file

We’ve prepared the following ASCII configuration file for adding the timer and event of above example. Copy and paste it to your text editor or download it using the link below.

The ASCII configuration file will add a timer to an already existing list of timers using the function [last]. Then, an action will be added that uses this timer as a triggering event.

ASCII configuration file
events.timer.timer.add
events.timer.timer[last].active=1
events.timer.timer[last].description=Timer for dual ping check with Lua
events.timer.timer[last].type=interval
events.timer.timer[last].interval_hh=00
events.timer.timer[last].interval_mm=10

events.event_config.event.add
events.event_config.event[last].active=1
events.event_config.event[last].description=Dual ping check with Lua
events.event_config.event[last].event_type=ev_timer
-----LUA-----
cli("events.event_config.event[last].event_timer_name=timer"..cli("events.timer.timer.size").."")
-----LUA-----
events.event_config.event[last].event_action_type=act_ascii
events.event_config.event[last].event_action_ascii=CG_m3_lua_connection_check_script.txt

administration.profiles.activate

A short Lua script is used to determine the size of the timer list and use it to compose the timer name of the added timer. The double dots (..) connect the first string (events.event_config.event[last].event_timer_name=timer) with the result returned from (events.timer.timer.size) and a last, empty string to form the whole command:

Lua script from ASCII configuration file

-----LUA-----
cli("events.event_config.event[last].event_timer_name=timer"..cli("events.timer.timer.size").."")
-----LUA-----

Router configuration

It is prerequisite that you have access to the web interface of the router.

  1. Open the user interface of the router in a browser: 192.168.1.1

  2. Click in the cog outline AdministrationProfile menu in the ASC`II configuration section on file upload, select the ASCII configuration file just downloaded and click on   SUBMIT  .

  3. In order to apply the ASCII configuration file, click in the row of the configuration file, then on cog Apply ASCII configuration and on   APPLy ASCII CONFIGURATION  . [1]

This will add the timer and the event to your profile.

Result testing

  1. Change to the update EventsTimer menu to see the timer that has been added at the end of the list.

  2. Change to the update EventsEvents menu to see the event that has been added at the end of the list and open this event for editing (pencil) to see that above timer is used to trigger the event.


Back to the Configuration Guides for icom OS routers

Back to overview


1. Applying an ASCII configuration file means that the opened profile will be amended or modified by the configurations contained.. The opened profile will also be activated with this ASCII configuration file, because it contains the command administration.profiles.activate.