campbellcontrol.connection package
Submodules
campbellcontrol.connection.aws module
Module for AWS specific MQTT broker connections
- class campbellcontrol.connection.aws.AWSConnection(client_id: str, *args, **kwargs)
Bases:
Connection
Connection class for the AWS MQTT client.
- get_client_bootstrap() ClientBootstrap
“The ClientBootstrap will default to the static default (Io.ClientBootstrap.get_or_create_static_default)” https://awslabs.github.io/aws-crt-python/api/io.html#awscrt.io.ClientBootstrap This example is from the mqtt_test.py util in the aws-crt-python repo. TODO - understand how this works.
- get_client(*args, **kwargs) Connection
Return the AWS MQTT client instance.
- Parameters:
*args – Additional arguments forwarded to the client.
**kwargs – Additional keyword arguments forwarded to the client.
- subscribe(topic: str, qos: QoS = QoS.EXACTLY_ONCE, callback: Callable | None = None) None
Subscribe to a topic.
- Parameters:
topic – The topic to subscribe to.
qos – The Quality of Service level for the subscription.
callback – Optional method that is called during subscription.
- publish(topic: str, payload: str | bytes | bytearray, qos: QoS, retain: bool = False) None
Publish a message to a given topic.
- Parameters:
topic – The topic to publish to.
payload – The message payload.
qos – The Quality of Service level for the publication.
retain – Whether to retain the message on the broker and deliver it to future subscribers.
campbellcontrol.connection.generic module
Module for handling generic MQTT clients
- class campbellcontrol.connection.generic.PahoConnection(endpoint: str, port: int, *args, **kwargs)
Bases:
Connection
Connection class for the generic Paho MQTT client.
- get_client(*args, **kwargs) Client
Return the Paho MQTT client instance.
campbellcontrol.connection.interface module
- class campbellcontrol.connection.interface.Connection(endpoint: str, port: int, *args, **kwargs)
Bases:
ABC
Base interface for defining MQTT broker connections.