wotpy.protocols.mqtt.client

Classes that contain the client logic for the MQTT protocol.

Classes

MQTTClient([deliver_timeout_secs, …]) Implementation of the protocol client interface for the MQTT protocol.
class wotpy.protocols.mqtt.client.MQTTClient(deliver_timeout_secs=1, msg_wait_timeout_secs=5, msg_ttl_secs=15, timeout_default=None, hbmqtt_config=None, stop_loop_timeout_secs=60)

Bases: wotpy.protocols.client.BaseProtocolClient

Implementation of the protocol client interface for the MQTT protocol.

DEFAULT_CLIENT_CONFIG = {'keep_alive': 90}
DEFAULT_DELIVER_TIMEOUT_SECS = 1
DEFAULT_MSG_TTL_SECS = 15
DEFAULT_MSG_WAIT_TIMEOUT_SECS = 5
DEFAULT_STOP_LOOP_TIMEOUT_SECS = 60
DELIVER_TERMINATE_LOOP_SLEEP_SECS = 0.1
SLEEP_SECS_DELIVER_ERR = 1.0
invoke_action(td, name, input_value, timeout=None, qos_publish=2, qos_subscribe=1)

Invokes an Action on a remote Thing. Returns a Future.

is_supported_interaction(td, name)

Returns True if the any of the Forms for the Interaction with the given name is supported in this Protocol Binding client.

on_event(td, name, qos=0)

Subscribes to an event on a remote Thing. Returns an Observable.

on_property_change(td, name, qos=0)

Subscribes to property changes on a remote Thing. Returns an Observable

on_td_change(url)

Subscribes to Thing Description changes on a remote Thing. Returns an Observable.

protocol

Protocol of this client instance. A member of the Protocols enum.

read_property(td, name, timeout=None, qos_publish=1, qos_subscribe=1)

Reads the value of a Property on a remote Thing. Returns a Future.

write_property(td, name, value, timeout=None, qos_publish=2, qos_subscribe=1, wait_ack=True)

Updates the value of a Property on a remote Thing. Due to the MQTT binding design this coroutine yields as soon as the write message has been published and will not wait for a custom write handler that yields to another coroutine Returns a Future.