Skip to main content

Lua Device Configuration

Introduction​

After years of writing Enapter Blueprints, we decided to stop forcing users to write the boilerplate code for the configuration interface in Lua scripts and added a new feature to the manifest. All you have to do is declare configuration parameters in dedicated group(s).

Best Practices for Configuration​

tip
  1. Set access_level thoughtfully:

    • Choose the appropriate access level to control who can modify which settings. This helps prevent accidental or unauthorized changes.
  2. Use default values sparingly:

    • Defaults can be helpful, but avoid setting them unless the value makes sense for most users or devices.
  3. Group related settings:

    • You can define multiple configuration groups within a single manifest to organize settings logically and improve usability.

Configuration Use Cases​

Connection Parameters​

Connection URI, device Modbus address, or unit ID — any parameters required to connect to your device should be included in the configuration section.

tip
  • Use descriptive values for each display_name.
  • Set suitable types for parameters.
  • Use format: connection_uri for the Connection URI parameter.
  • Mark required parameters.
configuration:
connection:
display_name: Connection
description: Device connection parameters
access_level: owner
parameters:
address:
display_name: Modbus Address
description: Device address in range 1-247
type: integer
required: true
conn_str:
display_name: Connection String
description: Connection URI to the runtime device
type: string
format: connection_uri
required: true

Device-Specific Information​

Some device characteristics should be explicitly set by the user. For this purpose, the configuration section is also well-suited.

tip

Write clear descriptions to explain the parameters.

Functional Settings​

configuration:
device_info:
display_name: Pressure Sensor Properties
description: To be set by the user
access_level: user
parameters:
calib_slope:
display_name: Calibration Slope
description: "`k` in the calibration line equation `Pressure = k * Current + b`"
type: float
required: true
calib_intercept:
display_name: Calibration Intercept
description: "`b` in the calibration line equation `Pressure = k * Current + b`"
type: float
required: true

Hardware Settings​

configuration:
relay:
display_name: Relay Settings
description: Relay channels for power and start
access_level: owner
parameters:
power_relay:
display_name: Power Contact Channel
description: The number of a relay channel to which an FC power contact is connected.
type: integer
required: true
start_relay:
display_name: Start Contact Channel
description: The number of a relay channel to which an FC start contact is connected.
type: integer
required: true

Third-Party API Credentials​

tip

When setting any credentials, consider using the sensitive option to protect confidential data.

configuration:
tasmota:
display_name: Tasmota Account Settings
description: Account credentials required to connect to the Tasmota device
access_level: owner
parameters:
username:
display_name: Tasmota Username
type: string
required: true
password:
display_name: Tasmota Password
type: string
required: true
sensitive: true

All Rights Reserved © 2026 Enapter AG.