Skip to content

Modules

Modules are extensions of the IOT plugin that enable communication with specific devices. Each module is a Lua package that implements the necessary functions to interact with a device.

List of Modules

  • alemca: Main module for communication with Alemca services.
  • config: Module for managing the agent configuration.
  • modbus: Module for communicating with Modbus devices.
  • serial: Module for serial communication with devices.
  • socket: Module for network communication via sockets.
  • http: Module for HTTP communication.
  • addon: Module for communication with external software via gRPC (addon-can).
  • at: Module for communicating with devices via AT commands.
  • ping: Module for checking network connectivity.

Each module includes a Lua example showing how to use it within the IOT plugin.

List of Default Modules

  • json: Module for handling JSON data.
  • lfs: Module for local file system management.

Additional Lua Functions

  • print(string): Prints debug messages to the console in Debug mode.
  • printDebug(string): Prints debug messages to the console in Debug mode.
  • printInfo(string): Prints informational messages to the console in Info mode.
  • printError(string): Prints error messages to the console in Error mode.
  • sleep(int): Pauses script execution for a given amount of time (in milliseconds).

Additional Lua Functions for Commands

  • entity_ident: Variable containing the entity identifier.
  • entity_token: Variable containing the entity token.
  • task_ident: Variable containing the task identifier.
  • job_ident: Variable containing the job identifier.
  • job_script: Variable containing the job script.
  • job_timestamp: Variable containing the job timestamp.
  • job_scheduled_time: Variable containing the scheduled time of the job.
  • job_expire_time: Variable containing the job expiration time.
  • job_target: Variable containing the job target.
  • job_response(jobIdent, message, [status, taskIdent]): Function to send a response to the job.
  • job_error(jobIdent, message): Function to send a job response with error status.
  • variable: Variable containing the command variables.
  • constants: Variable containing the command constants.
  • attributes: Variable containing the device attributes.