Note: The Command Custom Function feature is currently in its beta stage with further enhancements planned in the product roadmap. Contact support@zohoiot.com to enable it and for more details.
Note: The command custom function is not available by default and will be enabled on request to support@zohoiot.com{
"device_id": 6102000000346431,
"hub_ipaddress": "10.44.3.249",
"zsoid": "884225516",
"commands": [
{
"payload": [
{
"edge_command_key": "power_status",
"value": "on"
}
],
"command_name": "Power",
"correlation_id": "965a23b0-b4b7-11f0-bb09-53540001bbcd",
"user_input_value": "on"
}
] }
{"device_id": 6102000000346431,
"hub_ipaddress": "10.44.3.249",
"zsoid": "884225516",
"commands": [
{
"payload": [
{
"edge_command_key": "power_status",
"attributes": [
{
"field": "layout",
"value": {
"settings": {
"show_instance_dashboard": false,
"default_location_preference": "field"
},
"name": "Home Gateway",
"icon": "device",
"id": "6102000000346003"
}
},
{
"field": "status_update_time",
"value": {
"millis_in_gmt": 1761735856000,
"formatted": [
"10 minutes ago"
],
"value": "2025-10-29T16:34:16"
}
}
],
"value": "on"
}
],
"command_name": "Power",
"correlation_id": "74d6ed30-b4b8-11f0-bb09-53540001bbcd",
"user_input_value": "on"
}
] }
command_key = payload_map.get("commands").get(0).get("payload").get(0).get(" edge_command_key");command_value = payload_map.get("commands").get(0).get("payload").get(0).get("value");
response = map();response.put("send_to_device", true);response.put("post_function_ack", true);response.put("ack_status", 1001);response.put("command_payload", {'power_status':'on'});return response;

Note: If post_function_ack is set to true, the actual execution result of the command on the device will not be known, since the acknowledgement originates from the custom function rather than the device.response = map();response.put("send_to_device", true);response.put("command_payload", {'value': 'on', 'status':1});return response;
response = map();response.put("send_to_device", true);command_key = payload_map.get("commands").get(0).get("payload").get(0).get(" edge_command_key");command_value = payload_map.get("commands").get(0).get("payload").get(0).get("value");response.put("command_payload", {command_key, command_value});return response;
response = map();response.put("send_to_device",true);response.put("post_function_ack",true); //handles acknowledgement internallyresponse.put("ack_status",1001); //acknowledgement set to successresponse.put("command_payload",{"value":"on","status":1});return response;
response.put("send_to_device",true);response.put("post_function_ack",true); //handles acknowledgement internallyresponse.put("ack_status",1001); //acknowledgement set to successcommand_key = payload_map.get("commands").get(0).get("payload").get(0).get("edge_command_key");command_value = payload_map.get("commands").get(0).get("payload").get(0).get("value")response.put("command_payload",{command_key:command_value});return response;

Select Devices > Device in the left navigation page.
Click on the device for which the command custom function needs to be associated. For this illustration, Arduino Home GM is selected.
From the address bar of your browser, copy the 16 digit device ID.
To obtain the command custom function ID,
Note: Before proceeding with this step, make sure you have added the required Command Template to the selected model. ((recordId, functionId)=>
{
ZIOT.ajax.put("/iot/v1/devices/"+recordId, JSON.stringify({
"devices": {
"id": ""+recordId,
"command_handler": {
"id": ""+functionId
}
}
}))
})('<device_id>', '<custom_function_id>')
((recordId, functionId)=>
{
ZIOT.ajax.put("/iot/v1/devices/"+recordId, JSON.stringify({
"devices": {
"id": ""+recordId,
"command_handler": {
"id": ""+functionId
}
}
}))
})('6102000000346431', '6102000000353047')
