Skip to content

Commit 39cdbfc

Browse files
committed
PLG: add connections attribute to mqtt #1681
1 parent b6c8f9b commit 39cdbfc

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

front/plugins/_publisher_mqtt/mqtt.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ def initialize_message(self):
156156
self.state_topic = f'{topic_root}/{self.sensorType}/{self.deviceId}/state'
157157
self.unique_id = f'{self.deviceId}_sensor_{self.sensorName}'
158158

159+
if self.mac != "":
160+
connections_snippet = [
161+
["mac", self.mac]
162+
]
163+
else:
164+
connections_snippet = []
165+
159166
# Update the message dictionary, expanding it without overwriting
160167
self.message.update({
161168
"name": self.sensorName,
@@ -166,9 +173,7 @@ def initialize_message(self):
166173
"identifiers": [f"{self.deviceId}_sensor"],
167174
"manufacturer": "NetAlertX",
168175
"name": self.deviceName,
169-
"connections": [
170-
["mac", self.mac]
171-
],
176+
"connections": connections_snippet
172177
},
173178
"icon": f'mdi:{self.icon}'
174179
})

front/plugins/rest_import/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Enable **Generate Fake MAC** when the API does not expose MAC addresses (e.g. re
4848
4949
### Example: OPNsense Dnsmasq API
5050

51-
See the [OPNsense configuration guide](https://docs.netalertx.com/PLUGINS) for details.
51+
See the [OPNsense configuration guide](https://docs.netalertx.com/REST_IMPORT) for details.
5252

5353
**Response:**
5454
```json

0 commit comments

Comments
 (0)