|  Developer
Updated on March 8, 2023

hub.cloud.subscription.update

Connection Type:

  • Update a subscription on a controller
Edit
Field Type Required Description
abstractUUID string + Abstract unique id
gatewayName string Name of the gateway (plugin) to redirect this request
mappings array + List of abstracts to be mapped to hub items
mappings[].capability string + Capability of an abstract. Note: firmware items does not have analogy for this field
mappings[].variable string + Variable of an abstract. Note: this field is similar to name of a firmware item
mappings[].valueType string Value type. This field is similar to item /
mappings[].dictionaryType bool Whether item value is a dictionary type
mappings[].value depends on Value of an abstract
mappings[].maxValue depends on Upper limit of item’s value field
mappings[].mimValue depends on Lower limit of item’s value field
mappings[].enum strings array Finite array of possible token values
Edit

NOTE: Update subscription on a controller:

add capability variables; remove capability variables; change item schema

This command gives the ability to update an existing subscription without removing its components.

  • 1) To add a new subscription of an existing abstract, add its definition according to hub.cloud.subscription.create rules. It should add a new item in an existing device of an ‘abstract’ category with the schema defined.
  • 2) To modify the existing item’s structure, do the same, but change the item’s schema. It should modify an existing item without changing its identifier.
  • 3) To remove a capability/variable, just add fields and WITHOUT all other fields.
Edit
Edit
				
					{
    "method": "hub.cloud.subscription.update",
    "id": "_ID_",
    "params": {
        "abstractUUID": "1234-abcd-...",
        "mappings": [
            {
                "capability": "<capability-name-to-add>",
                "variable": "<variable-name-to-add>",
                "valueType": "int",
                "dictionaryType": false,
                "value": 1
            },
            {
                "capability": "<capability-name-to-add>",
                "variable": "<variable-name-to-add>",
                "valueType": "int",
                "dictionaryType": false,
                "value": 20,
                "minValue": 10,
                "maxValue": 30
            },
            {
                "capability": "<capability-name-to-add>",
                "variable": "<variable-name-to-add>",
                "valueType": "token",
                "dictionaryType": false,
                "enum":["one", "two"]
            },
            {
                "capability": "<capability-name-to-remove>",
                "variable": "<variable-name-to-remove>",
            }
        ]
    }
}				
			
Edit
				
					{
    "error": null,
    "id": "_ID_",
    "method": "hub.cloud.subscription.update",
    "result": {},
}				
			
Edit
Broadcasts Description
hub.item.added Broadcast when the subscription was changed
hub.item.removed Broadcast when the subscription was removed