- Home
- Documentation
- Lua
- Device Programming
SatVUE Device - LUA Programming
Lua/SatVUE Device Examples
Lua scripts executed on the SatVUE have the potential to disrupt the normal operation of your SatVUE device.
Overview
The SatVUE devices support executing a custom Lua script at periodic intervals, or before/after a perodic event. This allows you to extend the base functionality of the SatVUE to perform more complex calculations or control external equipment without the need to wait for the Satellite Network latencies.
A Lua script can be configured to run on the following events:
- Config: The is not executed by any events, but can be included by your other scripts to provide some configurable variables or constants.
- PeriodicTimer: The periodic timer can be set to be trigger anywhere between 1 minute and 1440 minutes. When this timer triggers, the Lua script will be executed.
- PreSample: The Lua script will be executed just before the SatVUE samples its EIO Ports and Modbus devices.
- PostSample The Lua script will be executed just after the SatVUE samples its EIO Ports and Modbus devices.
- PreMessageSend: The Lua script will be executed just before a message is transmitted over the Satellite Network.
- PostMessageSend: The Lua script will be executed just after a message is transmitted over the Satellite Network.
- PreFileLogging: The Lua script will be executed just before the SatVUE samples its EIO Ports and Modbus devices, when the sample is logged internally to a file.
- PostFileLogging: The Lua script will be executed just after the SatVUE samples its EIO Ports and Modbus devices, when the sample is logged internally to a file.
Lua scripts can be added/edited/deleted via the Device Programming interface which can be accessed via Devices -> Edit Device -> Device Programming.
Creating Scripts
When the Edit button is clicked on a Lua Script Execution event (see above), then you will be presented with a text editor for entering in your Lua script. The example below will be executed after the SatVUE samples all its ports and attached Modbus devices. It will then check to see if a Modbus value has changed by more than 10, and if so, it will send all its Modbus data to the SatVUE portal, for futher processing and alarm notifications.
Once a Lua script has been saved, it needs to be sent to the SatVUE device. The script will remain in a Pending state until the SatVUE acknowledges the update. Once the script is acknowledged, it will begin to be executed at the required event.