ThingDescriptionService
hololinked.server.mqtt.services.ThingDescriptionService
Generates MQTT Thing Descriptions for Things from Thing Models.
Source code in repo/hololinked/hololinked/server/mqtt/services.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
Attributes
Functions
__init__
Initialize the Thing Description service.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The MQTT broker hostname, to fill in the TD forms |
required |
|
int
|
The MQTT broker port, to fill in the TD forms |
required |
|
BoundLogger
|
The logger to use for logging messages |
required |
|
Thing
|
The |
required |
|
bool
|
Whether the broker is using SSL or not |
True
|
Source code in repo/hololinked/hololinked/server/mqtt/services.py
generate
async
Generates the Thing Description for the specified Thing, adds observable properties and events.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
bool
|
Whether to ignore errors when generating the model and when adding properties/events to the TD |
False
|
|
list[str]
|
List of property/event names to skip when adding to the TD |
[]
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The generated MQTT Thing Description |
Source code in repo/hololinked/hololinked/server/mqtt/services.py
add_properties
add_properties(TD: dict[str, Any], thing_model: dict[str, Any], ignore_errors: bool = False, skip_names: list[str] = []) -> None
Adds observable properties to the Thing Description with MQTT forms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict[str, Any]
|
The seed Thing Description to modify in place. This method does not have a return value, therefore just supply the TD dict and it will be modified. Non-observable properties will be removed. |
required |
|
dict[str, Any]
|
The Thing Model the description is built from |
required |
|
bool
|
Whether to ignore errors when adding properties to the TD |
False
|
|
list[str]
|
List of property names to skip when adding to the TD |
[]
|
Source code in repo/hololinked/hololinked/server/mqtt/services.py
add_events
add_events(TD: dict[str, Any], thing_model: dict[str, Any], ignore_errors: bool = False, skip_names: list[str] = []) -> None
Adds events to the Thing Description with MQTT forms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict[str, Any]
|
The seed Thing Description to modify in place. This method does not have a return value, therefore just supply the TD dict and it will be modified. |
required |
|
dict[str, Any]
|
The Thing Model the description is built from |
required |
|
bool
|
Whether to ignore errors when adding events to the TD |
False
|
|
list[str]
|
List of event names to skip when adding to the TD |
[]
|