Skip to main content
Version: Next

Introduction

Welcome to the Configuration API section. Here you can find the overview of all the Configuration APIs using Lua script.


On this page you can find all the Configuration APIs that enable device functionality with help of Lua scripts. Following APIs are divided into different categories fit for specific device types.

The currently implemented Lua version is 5.1.5. Please, consult Configuration API firmware changelog for potential changes and older versions.

interesting

Please note, that you may filter the articles based on the devices. The device filter can be found in the upper right corner.

Details

Example GIF Filter by device

Supported Lua Libraries

The following Lua functions are implemented in the firmware:

  • "byte"
  • "char"
  • "dump"
  • "find"
  • "format"
  • "gfind"
  • "gmatch"
  • "gsub"
  • "len"
  • "lower"
  • "match"
  • "rep"
  • "reverse"
  • "sub"
  • "upper"

ACRIOS API Table

Below is a table listing the APIs available from the ACRIOS Common API documentation, along with their brief descriptions.

Common


This category contains functions that are used for all the devices. It contains all the basic functions.

API NameBrief Description
api.ledControl(state, timeout, period, offState, pattern, Ts, patternTimeout)Turns ON or OFF the on board LED.
api.delayms(ms,mode)Pauses the execution for ms milliseconds.
api.randInt(min, max)Generates random number within given range.
api.getUniqueNumber()Generates unique number.
api.getBatteryVoltage()Retrieves the current voltage level of the battery in mV.
api.getTick(clock, reset)Returns current number of milliseconds since startup.
api.dumpArray(str, opt)Prints contents of variable as hexadecimal string (dumps array into console).
api.float("add", form, arg1, arg2)Performs addition of arg1 and arg2 with given floating point data. Only available if allowed by the firmware.
api.float("sub", form, arg1, arg2)Performs subtraction of arg2 from arg1 with given floating point data. Only available if allowed by the firmware.
api.float("mul", form, arg1, arg2)Performs multiplication of arg1 and arg2 with given floating point data. Only available if allowed by the firmware.
api.float("div", form, arg1, arg2)Performs division of arg1 by arg2 with given floating point data. Only available if allowed by the firmware.
api.float("coerce", form, arg1)Performs coercion of arg1 with given floating point data (unary operation). Only available if allowed by the firmware.
api.float("convert", form, arg1)Performs conversion of integer to float for arg1 with given floating point data (unary operation). Only available if allowed by the firmware.
api.setVar(index, value, bool)Stores an integer value (0 to 2147483647) at the specified index (0-15 for RAM, 16-47 for HEE, 48-1071 for EEPROM), with optional bitwise negation at the next address.
api.setVar(index, mode, value)Stores a string array buffer at the specified index (0-15 for RAM, 16-47 for HEE, 48-1071 for EEPROM) using the specified memory mode ("bytes" supported).
api.getVar(index, default)Retrieves an integer value from the specified index (0-15 for RAM, 16-47 for HEE, 48-1071 for EEPROM), returning the default value if the stored value matches the bitwise negation of the next address.
api.getVar(index, mode, length)Retrieves a string array buffer of specified length from the index (0-15 for RAM, 16-47 for HEE, 48-1071 for EEPROM) using the specified memory mode ("bytes" supported).
api.wakeUpAt(day, hour, minute, second, resetOnFail)Schedules the next wake up event of the device to provided day of month, hour, minute and second.
api.wakeUpIn(day, hour, minute, second, resetOnFail, milisecond)Schedules the next wake up event of the device after specified time interval.
api.getTimeDate(timezoneShift)Returns current date and time set on this device.
api.setTimeDate(year, month, day, hour, minute, second, subsecond, timezone)Set date and time on this device, or calculate the difference and synchronize the date and time.
api.setTimeDate("DIFF", day, hour, minute, second)Calculates and synchronizes the device date and time if it differs from the provided day (1-31), hour (0-23), minute (0-59), and second (0-59).
api.voltageSourceState(state, voltage)Controls voltage source.
api.voltageSourceState("measure", voltage)Returns the source voltage value for the specified voltage source.
api.voltageSourceState("set-comp-value", voltage)Sets the comparator value for the specified voltage source.
api.voltageSourceState("get-comp-value", voltage)Retrieves the comparator value for the specified voltage source.
api.stdin("start", size)Starts reading standard input data with an optional memory size (default 1024).
api.stdin("stop")Stops reading standard input data.
api.stdin("waitbutton", timeout)Waits for a control button press with an optional timeout (default 0).
api.stdin("read", maxsize)Reads standard input data up to an optional maximum size (default 0).
api.stdin("readblock", maxsize, timeout)Reads a block of standard input data up to an optional maximum size (default 0) with an optional timeout (default 0).
api.stdin("readuntil", maxsize, stopByte, timeout)Reads standard input data up to an optional maximum size (default 0) until a specified stop byte (default "\n") or an optional timeout (default 0).
api.stdout(out, size, offset)Writes to stdout (standard output) without adding line termination.
api.bsprintf(binData, format, offset, endian)Formats binary stream data according to various format specifiers, including support for characters, integers, short and long integers, floats, and doubles.
api.setVerbosity(num, opt)Controls the number of messages printed to the serial line.
api.setVerbosity(num, "TIMESTAMP_MODE")Sets the verbosity level with timestamp information when "TIMESTAMP_MODE" is specified.
api.exec("_get_wake_info")Retrieves information about the device's wake-up event.
api.exec("_free_mem")Returns the amount of free memory available on the device.
api.exec("_sysinfo")Provides system information about the device.
api.exec("_format_eeprom", filler)Erases the internal device EEPROM to an optional provided value.
api.exec("_get_last_error", reportType, action, start, end)Retrieves error information based on the specified report type ("SHORT", "TRACEBACK", "STDOUT", "STDOUT_RAW", "TRACEBACK_RAW", "ALL") and action ("len", "clear", or byte offset).
api.exec("_current_serial_log")Retrieves the current serial log from the device.
api.exec("_sleep", seconds, milliseconds)Puts the device to sleep for the specified seconds and milliseconds (default 0), without RTC timeout if seconds is 0.
api.exec("acrComTx", data)Sends a payload as an "acrCom" communication protocol frame.
api.exec("_reset", softReset)Performs a device reset, with an optional soft reset (1 for application-only restart).
api.exec("_interactive_line_maxlen", value)Sets the size of the input command buffer in bytes (default 2048).
api.exec("_cpu_temp")Retrieves the CPU temperature of the device.
api.exec("_acrComHeader", data)Computes the header for the provided string buffer using CRC16 calculation.
api.exec("_print_mode", mode)Configures print mode ("ALL", "CONNECTED", "NONE") to control serial output behavior.
api.exec("clearSwWdogNoCom")Clears the no-communication software watchdog.
api.exec("clearSwWdogNoSleep")Clears the no-sleep software watchdog.
api.exec("setSwWdogNoComReloadValue", value)Sets the no-communication watchdog reload value (default 7 days).
api.exec("setSwWdogNoSleepReloadValue", value)Sets the no-sleep watchdog reload value (default 3 days).
api.exec("_set_crlf_handler", mode)Configures CRLF handling ("noprint", "asis", "space", "newline") for serial output.
api.exec("_has_new_reset_log")Checks if a new reset log is available.
api.exec("_get_unix_time")Retrieves the current UNIX timestamp from the device.
api.exec("_set_unix_time", time)Sets the device's UNIX timestamp to the specified value.
api.exec("_serialInterrupt", enable, waitConfig)Enables or disables serial interrupts and optionally waits for configuration in the onWake function.
api.exec("_sysclk", clock)Sets the microcontroller clock speed in Hz (options: 100000 to 48000000).
api.exec("_reset_reason")Retrieves the reason for the last device reset.
api.exec("_sleep_mode", mode)Configures global sleep mode (1 for sleep if interval > 10 ms, 2 for defined milliseconds).
api.exec("_keep_source_in_sleep", state)Enables or disables keeping the power supply active during sleep (available for converters with power supply).
api.exec("_cc", cmd, value)Manages Coulomb Counter operations ("set" or "dump") or returns values if no command is provided (available for converters with Coulomb Counter).
api.exec("_sc", option)Controls supercapacitor connection (1 for connect, 0 for disconnect, -1 for floating).
api.exec("_SENSUS_BUP_parse", data, key, keyIndex)Parses input data using an optional key and key index, defaulting to a predefined key if none provided.
api.exec("_hw_features", option)Returns hardware feature report or checks specific features (e.g., "SIM7022", "SC", "NB") if an option is provided.
api.exec("_fastWake", state)Enables or disables fast wake mode (1 for enable, 0 for disable).
api.exec("_noNBIOTinit", state)Enables or disables NB-IoT initialization (1 for enable, 0 for disable).
api.table("set-max-id", maxId)Sets the maximum table index to the specified value (must be >= 1).
api.table("get-max-id")Retrieves the current maximum table index.
api.table("new", tableId, type, maxLength)Creates a new table with the specified ID, type ("U32", "I8", "U32-I8", "STR"), and maximum number of entries.
api.table("dispose", tableId)Disposes of the table with the specified ID.
api.table("insert", tableId, value)Inserts a value (integer for U32/I8, key-value for U32-I8, string for STR) into the table with the specified ID.
api.table("index-of", tableId, value)Returns the index of the specified value in the table with the given ID.
api.table("get-index", tableId, index)Retrieves the value at the specified index or key in the table with the given ID.
api.table("get-index-length", tableId, index)Returns the length of the value at the specified index or key in the table with the given ID.
api.table("set-index", tableId, index, value)Sets the value at the specified index or key in the table with the given ID.
api.table("used", tableId)Checks if the table with the specified ID is in use.
api.table("clear", tableId)Clears all entries in the table with the specified ID.
api.aes(operation, data, iv, key)Encrypts or decrypts provided payload using a key and IV with AES-CTR.

LoRaWAN


This category contains functions specific to LoRaWAN devices needed for configuration and communication within LoRaWAN.

API NameBrief Description
api.loraSend(ack, timeout, msg, port)Sends and receives LoRaWAN frames with optional acknowledgment and timeout.
api.loraJoin(int, dr)Sends a join request for LoRaWAN network activation; rejoining occurs automatically every 7 days by default.
api.loraSetup("ACTIVATION", method)Configures LoRaWAN activation method (OTAA or ABP).
api.loraSetup("ADR", state)Enables or disables Adaptive Data Rate (1 for on, 0 for off).
api.loraSetup("DR", value)Sets the LoRaWAN Data Rate (0-5).
api.loraSetup("DC", state)Configures Duty Cycle state (ON, OFF, DCTIME, GET).
api.loraSetup("RUN_FSM", timeout)Runs internal LoRaWAN Finite State Machine for specified milliseconds.
api.loraSetup("CLASS", class)Sets LoRaWAN device class (A, B, or C).
api.loraSetup("OTAA-REJOIN-CONFIRMED-FAILED-COUNTER", value)Sets number of confirmed messages that must fail before forcing a new join.
api.loraSetup("OTAA-MINIMAL-CONFIRMED-PERIOD", value)Sets period (in milliseconds) for sending join requests (default 7 days).
api.loraSetup("OTAA-REJOIN-CONFIRMED-COUNTER", number)Sets maximum number of unconfirmed messages in a row, with every Nth message sent as confirmed (default and minimum is 5).
api.loraSetup("POWER", power)Sets transmission power (0, 2, 4, 6, 8, 10, 12, 14).
api.loraSetup("TIME_SYNC", force, zone)Configures time synchronization for LoRaWAN.
api.loraListenClassBC(timeout, class)Listens for incoming messages in Class B or C until the specified timeout; requires prior Class B/C setup and network server support.
api.loraSetCredential("devADDR", address)Sets the 32-bit device address, automatically triggering a join request upon execution.
api.loraSetCredential("devEUI", eui)Sets the 64-bit end-device identifier, automatically triggering a join request upon execution.
api.loraSetCredential("nwkSKey", key)Sets the 128-bit network session key, automatically triggering a join request upon execution.
api.loraSetCredential("appSKey", key)Sets the 128-bit application session key, automatically triggering a join request upon execution.
api.loraSetCredential("appEUI", eui)Sets the 64-bit application identifier, automatically triggering a join request upon execution.
api.loraSetCredentials(devADDR, devEUI, nwsKey, appsKey, appEUI)Sets multiple LoRa credentials (device address, EUI, network session key, app session key), automatically triggering a join request.
api.loraGetDevEui(format)Retrieves the device EUI in the specified format.
api.getDeviceAddress()Retrieves the device address.

NB-IoT


This category contains functions specific to NB-IoT devices needed for configuration and communication within NB-IoT.

API NameBrief Description
api.nbSend(addr, port, timeout, msg, type, nownewdatatimeout, rxport)Sends a message to NB-IoT on the specified IP address, port, and protocol type
api.nbSend(addr, port, timeout, bufferlen, type, nownewdatatimeout, rxport)Sends a buffer to NB-IoT on the specified IP address, port, and protocol type
api.nbReceiveBuffer("activate")Activates the NB-IoT scratchpad buffer for handling received data.
api.nbReceiveBuffer("deactivate")Deactivates the NB-IoT scratchpad buffer.
api.nbReceiveBuffer("dump", size)Dumps the contents of the NB-IoT scratchpad buffer, with an optional size parameter to specify the buffer size to dump.
api.nbReceiveBuffer("set-size", size)Sets the size of the NB-IoT scratchpad buffer to the specified size (in bytes).
api.nbReceiveBuffer("get-size")Retrieves the current size of the NB-IoT scratchpad buffer.
api.nbReceiveBuffer(start, len, toWrite)Writes data to the NB-IoT scratchpad buffer at the specified start index with the given length and data string.
api.nbAT("AT_DEBUG_OFF")Disables AT command debugging on the NB-IoT module.
api.nbAT("AT_DEBUG_ON")Enables AT command debugging on the NB-IoT module.
api.nbAT("REINITIALIZE")Reinitializes the NB-IoT module.
api.nbAT("ICCID?")Retrieves the ICCID of the SIM card in the NB-IoT module.
api.nbAT("IMSI?")Retrieves the IMSI of the SIM card in the NB-IoT module.
api.nbAT("IMEI?")Retrieves the IMEI of the NB-IoT module.
api.nbAT("DOWNLINK_MAX_PERIOD", period)Sets the maximum period (in milliseconds) without a downlink for the NB-IoT module.
api.nbAT("REINIT_HARD_LIMIT_RETRY", retries)Sets the number of retries before resetting the NB-IoT module.
api.nbAT("FORCED_REINIT_DONE?")Checks if a forced reinitialization of the NB-IoT module has been completed.
api.nbAT("PSM", psmState, edrxState, edrxPeriod, edrxPTW, keepSocketOpen, forceRaiSingleUL, forceRel13, compensateTimeoutForInactTimer)Configures Power Saving Mode (PSM) and eDRX settings, including PSM state, eDRX state, period, PTW, socket behavior, RAI, Release 13 enforcement, and timeout compensation.
api.nbAT("ON_TAU_EVENT", enable)Enables or disables (1 for enable, 0 for disable) TAU event monitoring on the NB-IoT module.
api.nbAT("SLEEP_MONITOR", enable)Enables or disables (1 for enable, 0 for disable) sleep monitoring on the NB-IoT module.
api.nbAT("AT_DEBUG_ON_TX")Enables AT command debugging for transmission on the NB-IoT module.
api.nbAT("SET_CEREG_TRESHOLD", treshold)Sets the AT+CEREG switch threshold for the NB-IoT module.
api.nbAT("TAU_BLANKING", tau)Sets the TAU blanking interval for the NB-IoT module.
api.nbAT("NET_STATUS?")Retrieves the network status of the NB-IoT module.
api.nbAT("RADIO_OFF_SLEEP")Puts the NB-IoT module's radio into sleep mode.
api.nbAT("UPDATE")Triggers an update of the NB-IoT module configuration or firmware.
api.nbAT("DTLS", pskid, psk)Configures DTLS with the specified PSK ID and PSK; empty values deactivate DTLS.
api.nbAT("TIME_SYNC", force, zone)Configures time synchronization for the NB-IoT module, with optional force sync (1) and time zone ("UTC" or "LOCAL").
api.nbAT("TRANSPARENT")Enables transparent mode for the NB-IoT module.
api.nbAT("SLEEP")Puts the NB-IoT module into sleep mode.
api.nbAT("APN=apn")Sets the Access Point Name (APN) for the NB-IoT module.
api.nbAT("PLMNID=plmnid")Sets the Public Land Mobile Network ID (PLMNID) for the NB-IoT module.
api.nbAT("HARD_RX_TIMEOUT", timeout)Sets the hard RX timeout (in milliseconds) for the NB-IoT module.
api.nbAT(command, timeout, wakeUp, success, err, tryMore, setAwakeBefore, pollBeforeCommand, setAwakeOffAfter, receiveFixedBytes)Default SIMCom AT Commands

S0 Pulse


This category contains functions specific to pulse S0 devices, that are required for their configuration, readout and others.

API NameBrief Description
api.S0readCounter(channel)Reads the current S0 channel counter and updates the baseline for onThreshold().
api.S0initializeCounter(channel, value)Sets the S0 channel counter value in non-volatile memory.
api.S0setThreshold(channel, value)Sets the difference threshold that triggers onThreshold() for the channel.

DALI


This category contains functions, that are used for DALI interface communication.

API NameBrief Description
api.daliTransaction(comm, addr, isdir)Transmits Dali command to specified address.

DIO


This category contains functions, that enable pulse devices to use DIO (digital input/output).

API NameBrief Description
api.AnalogReadPin(pin)Reads the analog value from the specified pin; disabled by default and requires firmware/hardware changes to enable.
api.DIOwaitForEvent(pin, event, sync, timeout)Waits for a specified event on the defined pin, waking the device and calling the onWake() function if the event occurs.
api.DIOreadPin(pin)Reads the current state of the DIO pin specified by the pin parameter.
api.DIOwritePin(pin, state)Writes a state to the DIO pin specified by the pin parameter.

M-Bus


This category contains functions specific to M-Bus devices, that are required for their configuration, readout and others.

API NameBrief Description
api.mbusTransaction(msg, timeout, retry)Sends a custom frame or an indexed readout request and returns the status and response data.
api.mbusTransaction(index, timeout, retry)Sends a readout request with the specified secondary address.
api.mbusSetup(baudrate, parity, stopBits, dataBits)Configures the device’s M-Bus communication parameters.
api.mbusState(state)Turns the M-Bus power circuitry on or off.
api.mbusScan(filter, timeout, mode)Scans for M-Bus devices, optionally filtering by identification, manufacturer, version, or medium.
api.mbusFilter("purge")Clears all entries from the secondary-address filter table.
api.mbusFilter("populate", filter)Loads the filter table with the provided list of IDs.
api.mbusFilter("show")Displays the current secondary-address filter table.
api.mbusFilter("fetch")Returns the current contents of the secondary-address filter table.
api.mbusFilter("scan", filter, save, timeout, scan_mode, useBatteryMonitor, initialDelay, batteryMonitorTimeout, targetVoltage, minimalVoltage, minimalRaise)Scans the bus using optional ID filter, timing, save-to-filter, and battery-monitor settings.
api.mbusVifDifFilter("purge")Clears all stored VIF/DIF filters.
api.mbusVifDifFilter("populate", filters)Loads the filter set with the provided VIF/DIF filters.
api.mbusVifDifFilter("show")Displays the currently stored VIF/DIF filters.
api.mbusVifDifFilter("fetch")Returns the list of stored VIF/DIF filters.
api.mbusVifDifFilter("activate", index)Activates a filter by index; pass -1 or nothing to deactivate all.
api.mbusVifDifFilter("deactivate")Deactivates all VIF/DIF filters.
api.mbusVifDifFilter("activated")Returns the index of the active filter, or -1 if none.
api.mbusVifDifFilter("filter", mbusFrame, mbusFilter)Applies the specified VIF/DIF filter to a frame and returns the filtered result.
api.mbusVifDifFilter("filter", mbusFrame, skipIndexes, sizeLimit)Filters a frame by skipping items and limiting the output size.

Wireless M-Bus


This category contains functions specific to Wireless M-Bus devices, that are required for their configuration, readout and others.

API NameBrief Description
api.wmbusSetup(power, role, mode)Sets the wM-Bus power (dBm), device role, and mode.
api.wmbusSetup("ROLE", role)Sets the device role (master, slave, meter, concentrator, repeater).
api.wmbusSetup("MODE", mode)Sets the operating mode (S1, S2, T1, T2, T1_C, T2_C, R, METRA, SENSUS434, SONTEX433, BUP433, BUP868).
api.wmbusSetup("IGNORE_CRC", ignore)Toggles ignoring CRC on received frames.
api.wmbusSetup("DISABLE_MADDALENA_ARROW_SUPPORT", disable)Toggles Maddalena Arrow support.
api.wmbusSetup("FREQ_OFFSET", offset)Gets or sets the RF frequency offset in Hz.
api.wmbusSetup("RX_DUTY_CYCLE", dutyCycle, rxTime, sleepTime)Configures RX duty cycling with RX and sleep times.
api.wmbusSetup("SONTEX_CONFIG", pingRetry, readRetry, prePing, preRead, dither, demodulation)Sets Sontex timing, dither, and demodulation parameters.
api.wmbusSetup("SONTEX_TUNE", address, onlyRough)Tunes the Sontex frequency for a given address, optionally rough-only.
api.wmbusSetHeader(cfield, manid, id, version, devtype, ci)Sets the default header fields (C, manufacturer, ID, version, device type, CI).
api.wmbusSendFrame(data)Sends a raw wM-Bus frame.
api.wmbusReceiveFrame(timeout, id)Waits up to timeout for a frame and returns parsed fields, payload, and RSSI.
api.wmbusReceiveFrame(timeout, debugOn, useFilter)Waits up to timeout for a frame and returns parsed fields, payload, and RSSI.
api.wmbusReceiveSendFrame(ci, payload, timeout, useFilter)Receives a frame then sends a modified reply (concentrator role only).
api.wmbusSendReceiveFrame(ci, payload, debugOn, useFilter)Sends a frame and listens for a response (meter role only).
api.wmbusFilter("purge")Clears all stored IDs in the filter.
api.wmbusFilter("populate", filter)Loads the filter with a binary list of 4-byte IDs.
api.wmbusFilter("show")Returns the filter table entries.
api.wmbusFilter("fetch")Returns the current filter length.
api.wmbusFilter("show-length")Shows the number of entries in the filter.
api.wmbusFilter("show-index", index)Returns the entry at the given 1-based index.
api.wmbusFilter("add", id)Adds a single 4-byte ID to the filter.

RS485, Modbus & NVT


This category contains functions specific to RS485, Modbus, and NVT devices, that are required for their configuration, communication, and processing.

API NameBrief Description
api.rs485Send(msg)Sends a message on the RS-485 bus (turn on with api.rs485State(1) first).
api.rs485Setup(baudrate, parity, stopBits, dataBits)Configures RS-485 serial parameters (baud, parity, stop bits, data bits).
api.rs485Setup("RX_BUFFER", value)Gets or sets the RS-485 receive buffer size.
api.rs485State(state)Enables or disables the RS-485 transceiver.
api.rs485Receive(timeout, interByteTimeout)Receives data within a timeout, with optional inter-byte timeout.
api.rs485Receive(timeout, terminator)Receives data within a timeout, with optional terminator.
api.rs485Receive(timeout, interByteTimeout, terminator)Receives data within a timeout, with optional inter-byte timeout and terminator.
api.modbusCrc(msg)Computes the MODBUS RTU CRC for a request.
api.modbusRTU(address, registerClk, functionCode, typeSpec, registerCount, timeout, retry, interByteTimeout, ignoreCRC)Performs a MODBUS RTU read/write with typed packing/unpacking, timeouts, and retries.
api.nvtProcess(buf)Parses an NVT-framed message and returns the stripped payload and NVT reply.
api.nvtEncode(msg)Encodes a message into NVT format.

DS18B20 (deprecated)


API NameBrief Description
api.ds18b20GetTemp(pwrpin, datapin, numdev)Retrieves the temperature in milli degrees Celsius (m°C) from the DS18B20 sensor; supports addressing specific devices by ID when multiple sensors are connected to one data pin. Disabled by default, requires firmware and hardware changes to enable.
api.ds18b20Search(pwrpin, datapin, numdev)Searches for connected DS18B20 devices on the 1-Wire bus using the specified power and data pins.