Low-Code Tools (Scripting)
Introduction
What are scripts?
Scripts are code snippets, written in JavaScript, that allow extending the platform's functionality, especially for device data processing, executing complex actions, or defining user-defined devices for which there is no native support in the platform.
What languages can scripts be written in?
Currently, the Gear Studio platform allows writing scripts in JavaScript, which is a mature and widely known language, but support for other languages is planned for the future.
What are the limitations of scripts?
Scripts are extremely flexible and allow extending the platform easily. However, to prevent a poorly written or malicious script from negatively affecting the platform's performance, the following restrictions apply:
- Scripts are limited to a maximum execution time of 10 seconds.
- They are limited in memory usage, to prevent recursion issues.
- They can only use the objects described in the documentation.
Scripting Use Cases
Actions
To streamline the execution of specific business logic or perform custom actions, our platform offers the ability to use scripts that can collect, process, and store data, as well as trigger other actions within the platform environment. These scripts provide extraordinary flexibility for automating specific tasks, enabling greater efficiency and adaptability in process and operations management. Whether for advanced data analysis, triggering specific events, or simply customizing the user experience, scripts become an essential tool for optimizing your operations on our platform.
Device Configuration
When creating a new model for a device that is not natively supported by the platform, it is advisable to define some scripts that enhance the user experience and provide more functionality. The scripts will then be used by all devices of that model, which also saves a great deal of work, since it only needs to be done once.
For more information, see this section.
Data Conversion for LoRaWAN and MQTT Devices
As part of a device model configuration, a script can be created for processing data received from it through LoRaWAN or MQTT. This allows:
- Processing each received payload (uplink)
- Updating the information of endpoints associated with the device, applying functions to convert data when necessary.
- Updating information about the device itself, such as RSSI levels, battery, etc., applying functions to convert data when necessary.
- Creating specific payloads intended for the device (downlink)
- Processing standard or custom commands defined in the Gear platform, and generating a payload with the format expected by the device.
For more information, see this section.