Understanding Custom Functions

Understanding Custom Functions

Custom functions in Zoho IoT allow you to extend the platform's capabilities. These functions are written using various programming languages and are easy to construct.

With custom functions, users can move beyond the default offerings of the platform and get more access to the platform environment. This flexibility helps optimise workflows and make operations more efficient.

Some cases for custom functions used in Zoho IoT are listed below:

Alarm Notifications: Write custom functions that are executed when an alarm is triggered, updated, or cleared is triggered
Data Operations: Execute custom functions when record are added, updated, or deleted in the application.

Message Handling : Use custom functions to process or transform incoming data before it is stored and forwarded.

Integration with External APIs: Write custom functions to connect Zoho IoT with external APIs, allowing your IoT solution to interact with other platforms and services, enhancing its capabilities.

Example Scenarios for Custom Functions
  • When you are monitoring air quality and temperature in an office building using Zoho IoT, you may need to automatically create a service order when the temperature crosses a defined threshold. This can be achieved by configuring a notification profiles that triggers a custom function. The custom function then creates a service order record in the application and the technician can be assigned to it.
     
  • When you want to generate a record at the end of every shift containing the number of parts produced, the machine runtime, and the power consumed during the shift, you can use a combination of a scheduler and a custom function. The scheduler triggers the custom function at the end of each shift, and the custom function aggregates the required values before creating the record.

  • When you need to extract a field value from the payload of an edge device and update a corresponding field in a device instance, you can use a message handler together with a custom function. The message handler provides access to the incoming payload, while the custom function processes the payload and updates the device instance based on the required logic.

Custom Function Categories

A custom function in Zoho IoT is always mapped to a specific category, which defines its trigger. Each category provides access to a specific set of parameters based on the feature the category refers to. For example, when used with the alarm rule category, the custom function can access alarm details, datapoint values, and field properties.
 
Below is the list of custom function categories. Select a category to view its details, examples, supported parameters, and steps to create a custom function for that category.
 
Category
Language
Trigger
Parameter
Deluge
Action defined in the alarm rule.
Alarms, Datapoint Values, Field Values
Deluge
When a command is executed
Access to the command payload
Deluge
Action defined in the workflow
Fields Value
Schedule
Deluge
Time defined in the scheduler
- Not Applicable -
Notifications Profiles
Deluge
Conditions defined in the Notification Profile
Alarms, field values
Java Script Lite
When a message payload is received
Incoming payload messages
Message Handler
Deluge
When a message payload is received
Access to incoming payload
API trigger
Deluge
When the REST API is called
REST API header and body parameters