wotpy.protocols.mqtt.handlers.property

MQTT handler for Property reads, writes and subscriptions to value updates.

Classes

PropertyMQTTHandler(mqtt_server[, …]) MQTT handler for Property reads, writes and subscriptions to value updates.
class wotpy.protocols.mqtt.handlers.property.PropertyMQTTHandler(mqtt_server, qos_observe=0, qos_rw=2, callback_ms=None)

Bases: wotpy.protocols.mqtt.handlers.base.BaseMQTTHandler

MQTT handler for Property reads, writes and subscriptions to value updates.

ACTION_READ = 'read'
ACTION_WRITE = 'write'
DEFAULT_CALLBACK_MS = 2000
DEFAULT_JITTER = 0.2
KEY_ACK = 'ack'
KEY_ACTION = 'action'
KEY_VALUE = 'value'
build_property_updates_topic(thing, prop)

Returns the MQTT topic for Property updates.

handle_message(msg)

Listens to all Property request topics and responds to read and write requests.

init()

Initializes the MQTT handler. Called when the MQTT runner starts.

publish_write_ack(msg)

Takes a Property write request message and publishes the related write ACK message.

teardown()

Destroys the MQTT handler. Called when the MQTT runner stops.

classmethod to_write_ack_topic(requests_topic)

Takes a Property requests topic and returns the related write ACK topic.

topic_wildcard_requests

Wildcard topic to subscribe to all Property requests.

topics

List of topics that this MQTT handler wants to subscribe to.