Subscribe/Unsubscribe COV
In addition to above commands, the concept of COV can be implemented with subscribe/unsubscribe points command. If a point in agent is subscribed, values for that point must be published only when there occured any change in its value. It will be helpful in real time monitoring, as the point value is pushed instantly to the cloud on change, instead of regular intervals.
This command subscribes/unsubscribes any point/points in a controller.
#
Command- Sample
- Schema
{ "agent": "agent-name", "command": 335, "msgid": 1007, "controllerType": 0, "controller": {} "name": "spinfo_23" }, "points": [ { "name": "point-name-1", "path": "path/of/the/point1 }, { "name": "point-name-2", "path": "path/of/the/point2 } ], "publishType": 4}
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "agent": { "type": "string", "description": "Name of the agent" }, "command": { "type": "integer", "description": "Command enum. 355 for subscribe, 357 for unsubscribe", "enum": [335, 337] }, "msgid": { "type": "integer", "description": "Message ID , will be used to send the ACKs" }, "controller": { "type": "object", "properties": { "name": { "type": "string", "description": "Name of the controller" } }, "required": ["name"] }, "points": { "type": "array", "items": [ { "type": "object", "description": "This object depends on the controller type", "properties": { "name": { "type": "string", "description": "Name of the point" }, "path": { "type": "string", "description": "Name of the point" } }, "required": ["name", "path"] } ] }, "controllerType": { "type": "integer", "description": "Controller Type enum", "const": 0 }, "publishType": { "type": "integer", "description": "Publish Type enum", "const": 4 } }, "required": [ "agent", "command", "msgid", "controllerType", "points", "publishType" ]}
#
Agent Response- Sample
- Schema
{ "agent": "agent-name", "controller": { "name":"controller-name-1" } "controllerType": 0, "publishType": 4, "data": [ { "name": "point-name-1", "path": "path/of/the/point1", "subscribed": true }, { "name": "point-name-2", "path": "path/of/the/point2", "subscribed": false } ]}
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "agent": { "type": "string", "description": "Name of the agent" }, "controller": { "type": "object", "properties": { "name": { "type": "string", "description": "Name of the controller" } "required": [ "name" ] }, "data": { "type": "array", "items": [ { "type": "object", "properties": { "name": { "type": "string", "description": "Name of the point" }, "path": { "type": "string", "description": "path of the point" }, "subscribed": { "type": "boolean", "description": "true if subscribed/false if unsubscribed" } }, "required": [ "name","path","subscribe" ] } ] }, "controllerType": { "type": "integer", "description": "Controller Type enum", "const": 1 }, "publishType": { "type": "integer", "description": "Publish Type enum", "const": 4 } }, "required": [ "agent", "controller", "data", "controllerType", "publishType" ]}