Topic publishers
hololinked.server.mqtt.handlers.TopicPublisher
Publishes an event to an MQTT topic. Supply a different class in MQTTPublisher to use a different one.
Source code in repo/hololinked/hololinked/server/mqtt/handlers.py
Attributes
Functions
__init__
__init__(client: Client, resource: EventAffordance | PropertyAffordance, config: RuntimeConfig, logger: BoundLogger, thing: Thing) -> None
Initialize the publisher for one event or observable property.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Client
|
The MQTT client to use for publishing messages |
required |
|
EventAffordance | PropertyAffordance
|
dataclass representation of observable property or event to be published |
required |
|
RuntimeConfig
|
The runtime configuration for the |
required |
|
BoundLogger
|
The logger to use for logging messages |
required |
|
Thing
|
the |
required |
Source code in repo/hololinked/hololinked/server/mqtt/handlers.py
publish
async
Publishes events to the MQTT broker in an infinite loop.
Source code in repo/hololinked/hololinked/server/mqtt/handlers.py
hololinked.server.mqtt.handlers.ThingDescriptionPublisher
Publishes Thing Description to an MQTT Topic. Supply a different class in MQTTPublisher to use a different one.
Source code in repo/hololinked/hololinked/server/mqtt/handlers.py
Attributes
thing_description
instance-attribute
thing_description = thing_description_service(hostname=_hostname, port=_port, logger=logger, thing=thing, ssl=_ssl_context is not None)
Functions
__init__
Initialize the Thing Description publisher.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Client
|
The MQTT client to use for publishing messages |
required |
|
RuntimeConfig
|
The runtime configuration for the MQTT publisher |
required |
|
BoundLogger
|
The logger to use for logging messages |
required |
|
Thing
|
The |
required |
Source code in repo/hololinked/hololinked/server/mqtt/handlers.py
publish
async
Publishes Thing Description to the MQTT broker, one-time at startup, with qos=2 and retain=True.