mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-06-20 22:30:11 -04:00
PLG: add connections attribute to mqtt #1681
This commit is contained in:
@@ -156,6 +156,13 @@ class sensor_config:
|
||||
self.state_topic = f'{topic_root}/{self.sensorType}/{self.deviceId}/state'
|
||||
self.unique_id = f'{self.deviceId}_sensor_{self.sensorName}'
|
||||
|
||||
if self.mac != "":
|
||||
connections_snippet = [
|
||||
["mac", self.mac]
|
||||
]
|
||||
else:
|
||||
connections_snippet = []
|
||||
|
||||
# Update the message dictionary, expanding it without overwriting
|
||||
self.message.update({
|
||||
"name": self.sensorName,
|
||||
@@ -166,9 +173,7 @@ class sensor_config:
|
||||
"identifiers": [f"{self.deviceId}_sensor"],
|
||||
"manufacturer": "NetAlertX",
|
||||
"name": self.deviceName,
|
||||
"connections": [
|
||||
["mac", self.mac]
|
||||
],
|
||||
"connections": connections_snippet
|
||||
},
|
||||
"icon": f'mdi:{self.icon}'
|
||||
})
|
||||
|
||||
@@ -48,7 +48,7 @@ Enable **Generate Fake MAC** when the API does not expose MAC addresses (e.g. re
|
||||
|
||||
### Example: OPNsense Dnsmasq API
|
||||
|
||||
See the [OPNsense configuration guide](https://docs.netalertx.com/PLUGINS) for details.
|
||||
See the [OPNsense configuration guide](https://docs.netalertx.com/REST_IMPORT) for details.
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
|
||||
Reference in New Issue
Block a user