New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base_topic is not used everywhere #22559
Comments
I think "discovery_data": {
"topic": "homeassistant/binary_sensor/122105103981011015010911311611695107116_0x00124b0021b7800d/connection_state/config",
"payload": {
"device": {
"configuration_url": "http://10.9.0.33:8036/#/settings",
"hw_version": "zStack3x0 20230507",
"identifiers": [
"zigbee2mqtt_bridge_0x00124b0021b7800d"
],
"manufacturer": "Zigbee2MQTT",
"model": "Bridge",
"name": "Zigbee2MQTT Bridge",
"sw_version": "1.37.0"
},
"device_class": "connectivity",
"entity_category": "diagnostic",
"name": "Connection state",
"object_id": "zigbee2mqtt_bridge_connection_state",
"origin": {
"name": "Zigbee2MQTT",
"sw_version": "1.37.0",
"support_url": "https://www.zigbee2mqtt.io"
},
"payload_off": "offline",
"payload_on": "online",
"state_topic": "zigbee2mqtt_kt/bridge/state",
"unique_id": "bridge_0x00124b0021b7800d_connection_state_zigbee2mqtt_kt",
"value_template": "{{ value_json.state }}",
"platform": "mqtt"
}
There is comparison of device:
configuration_url: http://10.9.0.31:8036/#/settings
hw_version: zStack3x0 20230507
identifiers:
- zigbee2mqtt_bridge_0x00124b0021b7800c
manufacturer: Zigbee2MQTT
model: Bridge
name: Zigbee2MQTT Bridge
sw_version: 1.37.0
device_class: connectivity
entity_category: diagnostic
name: Connection state
object_id: zigbee2mqtt_bridge_connection_state
origin:
name: Zigbee2MQTT
sw_version: 1.37.0
support_url: https://www.zigbee2mqtt.io
payload_off: offline
payload_on: online
state_topic: zigbee2mqtt/bridge/state
unique_id: bridge_0x00124b0021b7800c_connection_state_zigbee2mqtt
value_template: '{{ value }}'
platform: mqtt device:
configuration_url: http://10.9.0.33:8036/#/settings
hw_version: zStack3x0 20230507
identifiers:
- zigbee2mqtt_bridge_0x00124b0021b7800d
manufacturer: Zigbee2MQTT
model: Bridge
name: Zigbee2MQTT Bridge
sw_version: 1.37.0
device_class: connectivity
entity_category: diagnostic
name: Connection state
object_id: zigbee2mqtt_bridge_connection_state
origin:
name: Zigbee2MQTT
sw_version: 1.37.0
support_url: https://www.zigbee2mqtt.io
payload_off: offline
payload_on: online
state_topic: zigbee2mqtt_kt/bridge/state
unique_id: bridge_0x00124b0021b7800d_connection_state_zigbee2mqtt_kt
value_template: '{{ value_json.state }}'
platform: mqtt
|
How to fix it? |
A possible enhancement would be an option to add something like a friendly name for the network and/or the coordinator, but I don't know whether @Koenkk wants to have the added complexity for a relatively niche use case. |
Adding friendly name doesn't help, the main problem is that z2m doesn't use
|
Sorry, it's been some time that I've worked on that code. It is not HA but Z2M that adds the device name. That logic is used for all discovery topics. The other points still stand. |
I'm not sure whether you understand the problem I'm trying to explain. Currently every z2m instance produces entities like |
I do understand the problem you are describing, I just don't think its impact is very severe. After all, you can rename both entities and devices in Home Assistant very easily. Edit: Also I'm not against making the bridge devices more unique per se, but using the discovery topic instead of the device name for the object ID is not the right way. Personally, I'd rather add the IEEE address of the coordinator to the device name (i.e. |
Sure, I did it already. It's easy when one knows what's happening, but it can be confusing for others. I used to use custom entities for those bridge states from the historic template - that works fine, however a friend of mine started to use two instances of z2m like me (home/cottage - quite common usecase) with current template and was quite confused why unique
That's also an option, but unique |
Adding the IEEE address to the generated friendly name would be more in line with general HA usage. I would not like to have special logic just for the bridge discovery and adding the base topic to the name would result in rather awkward entity names ( |
What happened?
I'm running two instances of Z2M with unique
base_topic
connected to a single mqtt broker and single HomeAssistant with mqtt integration. The problem is that entities likeconnection_state
fromzigbee2mqtt/lib/extension/homeassistant.ts
Line 1844 in ee5cf5a
base_topic
, but alwayszigbee2mqtt
prefix. That leads to that entities have ambiguous names and HomeAssistant gives them additional index suffix like:binary_sensor.zigbee2mqtt_bridge_connection_state
binary_sensor.zigbee2mqtt_bridge_connection_state_2
What did you expect to happen?
I would expect that every entity shall have an unique id based on configured
base_topic
like:binary_sensor.zigbee2mqtt_first_bridge_connection_state
binary_sensor.zigbee2mqtt_second_bridge_connection_state
How to reproduce it (minimal and precise)
Two instances of Z2M with unique
base_topic
.Zigbee2MQTT version
1.37.0
Adapter firmware version
20230507
Adapter
SONOFF Zigbee 3.0 USB Dongle Plus ZBDongle-P
Debug log
No response
The text was updated successfully, but these errors were encountered: