Class MqttPlugin new

The class MqttPlugin implements the base class of all smart-plugins that use MQTT. The implemented methods are described below.

In addition the methods implemented in lib.utils.Utils are inherited.

class lib.model.mqttplugin.MqttPlugin[source]

Bases: lib.model.smartplugin.SmartPlugin

start_subscriptions()[source]

Start subscription to all topics

Should be called from the run method of a plugin

stop_subscriptions()[source]

Stop subscription to all topics

Should be called from the stop method of a plugin

add_subscription(topic, payload_type, bool_values=None, item=None, callback=None)[source]
Parameters:
  • topic – topic to subscribe to
  • payload_type – payload type of the topic (for this subscription to the topic)
  • bool_values – bool values (for this subscription to the topic)
  • item – item that should receive the payload as value. Used by the standard handler (if no callback function is specified)
  • callback – a plugin can provide an own callback function, if special handling of the payload is needed
Returns:

publish_topic(topic, payload, item=None, qos=None, retain=False, bool_values=None)[source]
broker_config = {}
broker_monitoring = False
get_broker_info()[source]
broker_uptime()[source]

Return formatted uptime of broker

mqtt_init()[source]

Dummy method - should not be called any more :return: Bool value True :rtype: bool