Registered StackHub users may elect to receive email notifications whenever a new package version is released or a comment is posted on the forum.
There are 0 watchers.
Close the provided MqttClient
Create an instance of an MqttClient, connect and return it This is unrelated to Connector functionality The Dict parameter provided may contain the following url - (Str or Uri). Format is mqtt://host:port or mqtts://host:port username password - Plain Text certFile - If client cert file auth is being used (alternative to username/password) keyFile - Must be supplied if certFile is used clientId - to override a default UUID generated client ID
Publish a message to the specified topic using the provided MqttClient. Return the same provided client to it can be used again in a chain of commands
MQTT message constructor that is passed the point record, value and level
The JSON Str returned is an outer object containing an array with the property name metrics. The single object in the array has a name and a value property, and optionally a level property if provided
Example returned JSON Message:
{ "metrics": [ {"name":"pt1","value":73.0,"level":1} ] }
Migrate all existing Paho based MQTT Connectors and Points to CP MQTT based A restart of SkySpark will be required once this completes.
MQTT message parser that is passed the payload as a String and parses it as a comma separated set of values.
Default column separator is ,
and expected value positions are "curVal","curStatus"
To override this pass in a Dict as an optional second parameter. The Dict should contain the tags colSep and colNames. colSep is a single character Str and colNames is Str[]
If there are more values than column names supplied, default colnames of v1..vn are used. If curStatus is not one of the column names curStatus will be set to "ok"
This function abides by the contract for MQTT message parsers in taking a Str as its first parameter and returning a Dict with curVal and curStatus tags.
Configure it on the connector either just as the function name or follow it with a Dict containing colSep and colNames tags. e.g.
cpMqttParseCsv {colSep:",", colNames:["curVal","curStatus"]}
MQTT message parser that is passed the payload as a String and parses it as a JSON object.
The JSON Object structure is fixed. It expects the outer object to contain an array of metric objects, with the property name metrics. Each metric object in the array must have a name and a value property.
Example JSON Message:
{ "metrics": [ {"name":"pt1","value":73.0}, {"name":"pt2","value":true}, {"name":"pt3","value":"string val"} ] }
results in this Dict:
{pt1:73.0, pt2:true, pt3:"string val"}
MQTT message parser that is passed the payload as a String and uses it as the point curVal. It assumes point curStatus is "ok". Units should not be in the message body.
If no MQTT parser is configured on an CpMqtt Connector or point, this is the default parser used.
This function abides by the contract for MQTT message parsers in taking a Str as its first parameter and returning a Dict with curVal and curStatus tags.
Ping a CpMqtt connector
Examples:
read(cpMqttConn).cpMqttPing cpMqttPing(cpMqttConnId)
Side effects:
Provide a function that publishes a message to a broker on a topic This is unrelated to Connector functionality The Dict parameter provided must contain the following url - (Str or Uri). Format is mqtt://host:port or mqtts://host:port topic - What topic to publish to msg - Supports String messages only
Optionally you can also provide: username password - Plain Text certFile - If client cert file auth is being used (alternative to username/password) keyFile - Must be supplied if certFile is used clientId - to override a default UUID generated client ID qos - Int 0|1|2
Revert all existing CP based MQTT Connectors and Points to Paho MQTT based A restart of SkySpark will be required once this completes.
Subscribe all the proxy points to their MQTT topic on the MQTT Broker. Current value with asynchronously arrive on the next message received for the topic. If there is a retained message for the topic, current value will arrive almost immediately. The proxies may be any value supported by toRecList.
Each proxy point must contain:
Side effects: