Resource type provides link to set of tasks that can run on the group of resources. It can also be used to define metrics interface (which is linked to the sensory information) and command interface which allows you to abstract actual actuators implementation (see later). With most of the IoT platforms, you would find a ResourceType called a “template”, since they refer to this sort of modeling as a way to model different device categories using the same JSON template. In our case, we use a template in the rules context. More importantly, our abstraction allows to model both “object templating” together with rules associations, as described further.
Provisioning API allows you to associate metadata with resource. Resources are either discovered by Waylay (as soon as data is pushed towards Waylay Broker) or you can as well create them using REST call. Next to the resource CRUD related calls, waylay also allows you to create ResourceType entities, and let you link resource to a type using metadata (please see example below). As soon as a resource is linked to the resource type, all metadata values of that type are intehered for that resource. Resource can still overwrite any specific attribute in its metadata model. Let’s see how this work in practice:
Resource type feature allows you to group resources. Every resource that belongs to a particular resource type will inherit all metadata from its resource type. You can also associate templates with resource type, which will automatically create tasks (if templates are added to that resource type) or delete tasks (if templates are removed from that resource type) for every resource, which is part of that group. Tasks that are automatically created via resource type can be seen in the task overview as
One resource can’t be associated with more than one resource type.
Here is the list of resource types:
Resource type configuration
In this example, we selected Sigfox type (Nucleo) and created few attributes (we could do the same over REST)
Here also added one template to this resource type:
Note that we can add many more templates (which are either periodic, cron, reactive or onetime). Each time new resource is discovered all these tasks would be started. In this case, we want this template to run only once, hence we selected as a task type:
Now, let’s go to the resource view, where we select one resource that belongs to this type. We see the complete metamodel for that resource. Some of the properties are inhereted from the resource type.
Here is the provisiong task, which was executed only once as soon as the device sent data: