Parameter | Possible Value | Sub-Parameter | Possible Value | Description | Example | |
action | publish | host | An IP address | Publish a message to an MQTT server. | // The message to send - can also listen to local chat, for instance.
string text = "Hello!";
llInstantMessage(CORRADE,
wasKeyValueEncode(
[
"command", "MQTT",
"group", wasURLEscape(GROUP),
"password", wasURLEscape(PASSWORD),
"action", "publish",
"host", "127.0.0.1",
"port", 1443,
"username", "corrade",
"secret", "corrade",
"topic", "SIML",
// The payload, ie: wasURLEscape( "Hash=something&Message=Hello!" )
// Note the double escaping that is necessary to prevent collisions!
"payload", wasURLEscape(
wasKeyValueEncode(
[
// The hash is an identifier that will allow responses from Corrade AI
// for various messages to be distinguished. It can be any identifier
// but a handy way of generating an identifier is to hash the message.
"Hash", llSHA1String(text),
// Note the double escaping!
"Message", wasURLEscape(text)
]
)
),
"callback", wasURLEscape(URL)
]
)
);
| |
port | A port number. | |
topic | A topic to send the message to. | |
payload | A message payload. | |
username | The username and password to use for authentication to the MQTT server. | |
secret | |
type | Set to either text or binary . | |
QoS | Quality of service level (defaults to 0 ). |
retain | Whether to retain the message (defaults to False ). |
subscribe | host | An IP address | Subscribe to a topic from an MQTT server. | llInstantMessage(CORRADE,
wasKeyValueEncode(
[
"command", "MQTT",
"group", wasURLEscape(GROUP),
"password", wasURLEscape(PASSWORD),
// Subscribe...
"action", "subscribe",
// ... to an MQTT broker at 127.0.0.1
"host", "127.0.0.1",
// ... on port 1443
"port", 1443,
// ... using the following credentials
"username", "corrade",
"secret", "corrade",
// ... to the SIML topic on the broker
"topic", "SIML",
// Send the result of the MQTT command to this URL.
"callback", wasURLEscape(URL),
// By adding an URL, Corrade will subscribe AND bind to the "MQTT" notification.
"URL", wasURLEscape(URL)
]
)
);
| |
port | A port number. | |
topic | A topic to send the message to. | |
username | The username and password to use for authentication to the MQTT server. | |
secret | |
execute | True or False (default, False ) | Whether to execute commands sent to the topic that Corrade subscribes to. | |
notifications | A list of notifications. | Publish the requested notifications on the MQTT topic that Corrade subscribes to. | |
URL | Optionally bind an MQTT notification for the subscription. | |
type | Set to either text or binary . |
QoS | Quality of service level (defaults to 0 ). |
ID | An UUID used to track the binding (generated randomly by default). |
unsubscribe | session | An MQTT subscription UUID | Unsubscribe from an MQTT server topic. | llInstantMessage(CORRADE,
wasKeyValueEncode(
[
"command", "MQTT",
"group", wasURLEscape(GROUP),
"password", wasURLEscape(PASSWORD),
"action", "unsubscribe",
"session", "8384fd9d-1d86-4991-a925-3dc2cf22f06c",
// Also remove the notification URL.
"URL", wasURLEscape(URL)
]
)
);
| |
URL | Optionally remove the MQTT notification. | |
list | | | List all MQTT subscriptions for the calling group | llInstantMessage(CORRADE,
wasKeyValueEncode(
[
"command", "MQTT",
"group", wasURLEscape(GROUP),
"password", wasURLEscape(PASSWORD),
"action", "list",
"callback", wasURLEscape(URL)
]
)
);
| |