mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-09 21:17:06 +03:00
homeassistant service discovery: derive node_id when using nested topics (#3088)
* derive correct node_id for homeassistant service discovery in nested topics (fixes #1792) * explicit use of std::string * move nodeId creation to separate function add unit-tests * add documentation about node_id generation for Home Assistant MQTT Service Discovery
This commit is contained in:
@@ -16,3 +16,5 @@ See [MQTT Result Topics](../MQTT-API#result) for a full list of topics.
|
||||
|
||||
!!! Note
|
||||
The main topic is allowed to contain `/` which can be used to split it into multiple levels, eg. `/basement/meters/watermeter/1/` if you have multiple water meters in your basement.
|
||||
|
||||
The nodeId for the Home Assistant MQTT Service Discovery must follow the schema `<discovery_prefix>/<component>/[<node_id>/]<object_id>/config`. The node_id is not configurable but derived from the `MainTopic` by stripping any but the last topic level. A `MainTopic` with the value `home/basement/watermeter` is transformed into the node_id `watermeter`, resulting in the discovery topic `homeassistant/sensor/watermeter/value/config` for the current value.
|
||||
|
||||
Reference in New Issue
Block a user