Skip to content

MQTT runtime configuration

hololinked.server.mqtt.config.RuntimeConfig

Bases: BaseModel

Runtime configuration for MQTT publishers, initialized in MQTTPublisher object.

Pass the attributes of this class as a dictionary to the config argument of MQTTPublisher.

Source code in repo/hololinked/hololinked/server/mqtt/config.py
class RuntimeConfig(BaseModel):
    """
    Runtime configuration for MQTT publishers, initialized in `MQTTPublisher` object.

    Pass the attributes of this class as a dictionary to the `config` argument of `MQTTPublisher`.
    """

    qos: Annotated[int, Field(ge=0, le=2)] = 1
    """The (global) MQTT QoS level to use for publishing messages"""

    topic_publisher: type[TopicPublisher] | Any = TopicPublisher
    """handler class to be used for publishing to topics (global)"""
    thing_description_publisher: type[ThingDescriptionPublisher] | Any = ThingDescriptionPublisher
    """handler class to be used for publishing thing descriptions"""

    thing_description_service: type[ThingDescriptionService] | Any = ThingDescriptionService
    """Thing Description generation service, used by `ThingDescriptionPublisher` to generate the Thing Description"""

Attributes

qos class-attribute instance-attribute

qos: Annotated[int, Field(ge=0, le=2)] = 1

The (global) MQTT QoS level to use for publishing messages

topic_publisher class-attribute instance-attribute

topic_publisher: type[TopicPublisher] | Any = TopicPublisher

handler class to be used for publishing to topics (global)

thing_description_publisher class-attribute instance-attribute

thing_description_publisher: type[ThingDescriptionPublisher] | Any = ThingDescriptionPublisher

handler class to be used for publishing thing descriptions

thing_description_service class-attribute instance-attribute

thing_description_service: type[ThingDescriptionService] | Any = ThingDescriptionService

Thing Description generation service, used by ThingDescriptionPublisher to generate the Thing Description

Pass these as a plain dictionary to the config argument of MQTTPublisher, not as a RuntimeConfig instance:

MQTTPublisher(config=dict(qos=2, topic_publisher=MyTopicPublisher))