Skip to content

mqttmanaged Lua Interface


get

Get a pointer to the MQTTManaged object

Arguments:
any ptr Pointer to Module object
Returns:
mqttmanaged ptr Pointer to casted MQTTManaged object

Example

ptr = mqttmanaged:.get(ptr)


getConfig

Get the configuration object for the plugin

Arguments:

Returns:
table obj Map with configurations

Example

obj = mqttmanaged:.getConfig()


saveConfig

Save the configuration object for the plugin

Arguments:
any ptr Pointer to MQTTManaged object
table new_config Map with configurations

Example

mqttmanaged:.saveConfig(ptr,new_config)


getName

Get the plugin name

Arguments:

Returns:
string name Plugin Name

Example

name = mqttmanaged:.getName()


connect

Connect to the MQTT server

Arguments:

Example

mqttmanaged:.connect()


subscribe

Subscribe to an MQTT topic

Arguments:
string topic MQTT Topic to write to
Returns:
string name Plugin Name

Example

name = mqttmanaged:.subscribe(topic)


readMessage

Read a message from the MQTT broker

Arguments:

Returns:
string msg Representation from the underliyng Json MQTT message

Example

msg = mqttmanaged:.readMessage()


readJsonMessage

Read a json message from the MQTT broker

Arguments:

Returns:
any obj Lua table Representation from the underliyng Json MQTT message

Example

obj = mqttmanaged:.readJsonMessage()


writeMessage

Write a message to the MQTT client

Arguments:
string topic MQTT Topic to write to
string msg Object to send

Example

mqttmanaged:.writeMessage(topic,msg)