A model is like a container that can be configured with different templates (datapoints, commands, alarm rules, and fields). Using this model, you can create multiple instances (devices, assets, and locations) with the same setup.
Each managed entity needs its own model to create an instance of it. That is, a Device model is needed to create a device instance, an Asset model to create an asset instance, and a Location model to create a location instance.
The model is created in the Developer Application, and the instances are created in the End Application.
For example, if you want to add 10 energy meters in a smart buildings application, you can create a device model called Energy Meter in the developer application and configure it with datapoints like current, power, etc. Based on this device model, you can create 10 energy meter instances in the end application.
Model - Instance Relationship
The Model-Instance relationship is a standout feature in Zoho IOT applications as it allows you to scale easily. The relationship between a model and its instances is single-way synchronous.
The characteristics of the Model-Instance relationship are listed below:
Changes made to the model will be reflected in all the instances created based on it.
Changes made to a particular instance will remain unique to that particular instance.
Changes to the model will overrule the unique changes made to a particular instance.
To understand this, let us first consider a model (can be a location, asset, or device) configured as shown below.
Model Name
| Alpha |
Datapoint Template | Temperature, Humidity |
Alarm Rule Template | Temperature High, Temperature Low |
Command Template | ON/ OFF, Adjust temperature |
Note: This model-instance approach is also applicable for Assets, and Locations Based on this model, three new instances: Instance A, Instance B, and Instance C are created. These three instances will have the same Datapoints, Alarm Rules, and Commands configured as templated in the model.
Adding/Removing Template in a Model .
Adding a datapoint template, alarm rule template or command template to a device model will include the corresponding datapoint, alarm rule or command to all the instances derived based on the model.
If a third datapoint template: Pressure in added to Model Alpha. A new pressure datapoint will be in all the three instances derived from it.
Removing a datapoint template, alarm rule template or command template from a device model will remove the corresponding datapoint, alarm rule, or command from all the devices derived based on the device model.
If the Temperature Low Alarm Rule Template is removed from model Alpha, the Temperature Low Alarm Rule will be removed from all three instances.
Adding/Removing/Disabling a Datapoint, Command, (or) Alarm Rule in a n instance
Adding a datapoint, alarm rule or command to an instance will be reflected only in that specific instance and will not affect the model, or instances based on the model.
For example, if you add a datapoint Air Quality to instance B, then the Air Quality datapoint is added only to that particular instance. As a result, Instance B will have three datapoints: Temperature, Humidity, Pressure and Air Quality. While, the remaining two instances: Instance A, and Instance C, will have only three datapoints: Temperature, Pressure, and Humidity.
Note: Adding an instance specific datapoint, command, or alarm rule is disabled by default in the application. You can enable them on the model settings page. Learn more about how to enable instance specific datapoints, commands, overview dashboards, and command.
Removing a datapoint, alarm rule or command from a instance is only possible if they were added at the instance level.
For example, in Instance B only the datapoint Air Quality can be removed directly from the instance. While it will not be possible to remove other datapoints, commands, and alarm rules only for a specific instance.
Datapoints, commands, and alarm rules for specific instances can be disabled, effectively restricting them from performing their intended functions.
If the Pressure datapoint in Instance A and Humidity datapoint in Instance C are disabled. Pressure data for Instance A and Humidity data for Instance C will not be parsed and stored for the period they are disabled.
Disabling Datapoint Templates, Command Templates, and Alarm Rule Templates in the model will disable the corresponding datapoints, commands, and alarm rules in all the instances based on the model.
If the Datapoint Template Humidity, and Command Template ON/OFF are disabled in model, then datapoint Humidity, and command ON/OFF will be disabled for all instances.
Editing Template Values
Editing a specific value of a datapoint template, command template, or alarm rule template in the device model will update the same parameter in the datapoint, command, or alarm rule in the instance level.
Consider the command template: Adjust Temperature, in model Alpha, created with the set of parameters as listed below:
Name | Adjust Temperature |
Input Type | Slider |
Slider Numeric Data Type | Numerical |
Slider Min. Number | 16 |
Slider Max. Number | 32 |
Increment/Decrement Steps | 1 |
Kind | Temperature |
Datapoint Unit | Celsius |
Command Key | set_temp |
Status | On |
The Adjust Temperature command in the three instances: Instance A, Instance B, and Instance C will have the same set of parameters.
Now, after the instances are created, the following changes are made to the Adjust Temperature command template.
Slider Min. Number | 18 |
Slider Max. Number | 28 |
Increment steps | 2 |
These values will now be updated for the Adjust Temperature command in all the three instances.
Note: The parameters allowed to be modified after a template is created are limited for and is different for datapoint templates, command templates, and alarm rule templates.
Editing a specific value of a datapoint , command, or alarm rule in a specific instance will affect only that instance.
For example, if the command key for Adjust Temperature is changed to assign_temp in Instance B. Only the command key for Instance B will be updated, while for Instance A, Instance C, and Model Alpha, the value will remain unchanged.
Note: Only parsing key for datapoints, command key for commands, and scheduled time for alarm rules can be edited at the instance level.
See Also
- Understanding Devices
- Understanding Assets
- Understanding Locations