|  Developer
Updated on March 28, 2023

cloud.controller_subscribe_abstracts

Connection Type:

  • Hub sends subscription list to cloud whenever this list is changed or hub is connected to the cloud
  • Since 2.0.41 Sends response template using which the data reported back to the hub.
Edit
Field Type Required Description
abstracts array + List of abstract subscriptions on hub
abstracts[].abstract_uuid string + Abstract unique id
abstracts[].device_id string + Device id of corresponding subscription
abstracts[].gateway_name string Name of the gateway (plugin) that owns this subscription
abstracts[].mappings array + List of abstracts
abstracts[].mappings[].capability string + Capability of an abstract
abstracts[].mappings[].variable string + Variable of an abstract
abstracts[].mappings[].item_id string +- Item id of corresponding abstract. Required for subscriptions without a field.
abstracts[].mappings[].value string or int + Value of an abstract. NOTE: cloud supports only string/int values
abstracts[].mappings[].response_type string +- Name of a response type to use to format a template. Should point to a key in the dictionary.
abstracts[].mappings[].response_data object +- Dictionary of substitutions to be used to fill a response template (see “response_type”.
abstracts[].mappings[].response_data.FIELD_NAME string A value to substitute with during the template evaluation.
abstracts[].mappings[].response_data object +- Dictionary of substitutions to be used to fill a response template (see “response_type”.
response_type object A dictionary of response templates, optional.
response_type.[{name}] object Settings of a particular response template
response_type.[{name}].template string + A response template to use as a callback command for abstract subscriptions value update mechanism. Defines a structure and parameters of a command Cloud should use to report subscription values changes instead of command.
response_type.[{name}].value_path string JSON path to the “value” field in the template.
response_type.[{name}].value_info string JSON path to the cloud value type field in the template.
response_type.[{name}].data_paths object A map of data paths that links and places of these fields in the template together.
Edit

NOTE: Failed requests will be resent 3 times with 1 min intervals and later requests will be sent with 10 min intervals.

NOTE: Cloud might unable to setup their suite quickly enough, so the first request might fail. The request must be resent with at least 30 sec timeout.

Edit
Edit
Edit
				
					{
    "id": "_request_id_",
    "method": "cloud.controller_subscribe_abstracts",
    "api": 1,
    "params": {
      "abstracts": [
         {
            "abstract_uuid": "1234-abcd-...",
            "device_id": "72613916",
            "mappings": [
              {
               "capability": "power",
               "variable": "status",
               "item_id": "32829327",
               "value": 1
              },
              {
               "capability": "indicator",
               "variable": "status",
               "item_id": "36281629",
               "value": "test-string"
              }
            ]
         },
         ...
      ]
   }
}				
			
Edit
				
					{
    "error": null,
    "id": "_ID_",
    "method": "cloud.controller_subscribe_abstracts",
    "result": {},
}				
			

The result of that call will be an abstract subscription that informs firmware about cloud Abstract object changes via command.

Edit
				
					{
    "method": "cloud.controller_subscribe_abstracts",
    "id": "_ID_",
    "params": {
       "abstracts": {
            "abstract_uuid": "4567-zxcv-...",
            "mappings": [
                {
                    "capability": "geofences",
                    "variable": "geofences",
                    "value": 1,
                    "response_type": "geofence_standard_response",
                    "response_data": {
                        "receiving_item_id": "<receivingItemId>",
                        "gateway_name": "ezlo_geofencing"
                    }
                }       
            ]
        },
        "response_type": {
            "geofence_standard_response": {
                "template": "{\"method\": \"hub.cloud.subscription.dispatch\",\"params\": { \"gatewayName\": \"\", \"_id\" : \"\",\"value\" : true}}",
                "value_path": ".params.value",
                "value_info": ".params.cloud_value_type",
                "data_paths":{
                    "receiving_item_id": ".params._id",
                    "gateway_name": ".params.gatewayName"
                }
              }
        }
    }
}				
			

Example 2: Available since Firmware Version 2.0.41.

The result of it will be an abstract subscription, that is reporting new data in the format of the command.

				
					{
    "method": "hub.cloud.subscription.dispatch",
    "id": "_ID_",
    "params": {
        "gatewayName": "<gatewayNameValue>",
        "itemId": "<itemIdValue>",
        "value": any
    }
}