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: 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.

async handle_message(msg)

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

async init()

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

async publish_write_ack(msg)

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

async 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.

property topic_wildcard_requests

Wildcard topic to subscribe to all Property requests.

property topics

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