azuwis / zigbee2mqtt-networkmap

Home Assistant Custom Card to show Zigbee2mqtt network map
261 stars 18 forks source link

Refresh button uses same mqtt base topic with more then one zigbee2mqtt networks #44

Closed dmatik closed 1 year ago

dmatik commented 1 year ago

Describe the bug I have 2 different zigbee2mqtt networks, all working fine. So I have added 2 separate "zigbee2mqtt-networkmap" cards. The maps displayed properly, however the Refresh buttons for both publishing to the same base topic for some reason. I tried to define the "mqtt_base_topic" property to the card as well. That did not help, I can clearly see in the MQTT Explorer that for both cards the Refresh button is publishing always to the same base topic. If I refresh the Network Map for the second network from zigbee2mqtt web page, then the card will display the map properly. Seems to be the issue only with refresh button.

Home Assistant version 2023.4.6

Zigbee2mqtt version 1.30.3

OS and browser version Windows 10 Chrome 112

State attributes of sensor.zigbee2mqtt_networkmap On Home Assistant, go to Menu -> Developer tools -> STATES -> sensor.zigbee2mqtt_networkmap -> Click the link and scroll up, find State attributes (JSON, optional),

sensor.zigbee2mqtt_networkmap

links:
  - depth: 1
    linkquality: 246
    lqi: 246
    relationship: 1
    routes: []
    source:
      ieeeAddr: '0x00158d0004141928'
      networkAddress: 22325
    sourceIeeeAddr: '0x00158d0004141928'
    sourceNwkAddr: 22325
    target:
      ieeeAddr: '0x00212effff04d7ff'
      networkAddress: 0
    targetIeeeAddr: '0x00212effff04d7ff'
  - depth: 1
    linkquality: 252
    lqi: 252
    relationship: 1
    routes: []
    source:
      ieeeAddr: '0xa4c1383e71f7e935'
      networkAddress: 51011
    sourceIeeeAddr: '0xa4c1383e71f7e935'
    sourceNwkAddr: 51011
    target:
      ieeeAddr: '0x00212effff04d7ff'
      networkAddress: 0
    targetIeeeAddr: '0x00212effff04d7ff'
  - depth: 1
    linkquality: 220
    lqi: 220
    relationship: 1
    routes: []
    source:
      ieeeAddr: '0x00158d0003243f56'
      networkAddress: 13975
    sourceIeeeAddr: '0x00158d0003243f56'
    sourceNwkAddr: 13975
    target:
      ieeeAddr: '0x00212effff04d7ff'
      networkAddress: 0
    targetIeeeAddr: '0x00212effff04d7ff'
  - depth: 1
    linkquality: 252
    lqi: 252
    relationship: 1
    routes: []
    source:
      ieeeAddr: '0xa4c13839360302fd'
      networkAddress: 21035
    sourceIeeeAddr: '0xa4c13839360302fd'
    sourceNwkAddr: 21035
    target:
      ieeeAddr: '0x00212effff04d7ff'
      networkAddress: 0
    targetIeeeAddr: '0x00212effff04d7ff'
  - depth: 1
    linkquality: 252
    lqi: 252
    relationship: 1
    routes: []
    source:
      ieeeAddr: '0xa4c138e5a6b1a2d8'
      networkAddress: 44191
    sourceIeeeAddr: '0xa4c138e5a6b1a2d8'
    sourceNwkAddr: 44191
    target:
      ieeeAddr: '0x00212effff04d7ff'
      networkAddress: 0
    targetIeeeAddr: '0x00212effff04d7ff'
  - depth: 1
    linkquality: 252
    lqi: 252
    relationship: 1
    routes: []
    source:
      ieeeAddr: '0x00158d00035f3679'
      networkAddress: 10163
    sourceIeeeAddr: '0x00158d00035f3679'
    sourceNwkAddr: 10163
    target:
      ieeeAddr: '0x00212effff04d7ff'
      networkAddress: 0
    targetIeeeAddr: '0x00212effff04d7ff'
  - depth: 1
    linkquality: 252
    lqi: 252
    relationship: 1
    routes: []
    source:
      ieeeAddr: '0x00158d000359884e'
      networkAddress: 55663
    sourceIeeeAddr: '0x00158d000359884e'
    sourceNwkAddr: 55663
    target:
      ieeeAddr: '0x00212effff04d7ff'
      networkAddress: 0
    targetIeeeAddr: '0x00212effff04d7ff'
  - depth: 1
    linkquality: 252
    lqi: 252
    relationship: 1
    routes: []
    source:
      ieeeAddr: '0x00158d00054d14e1'
      networkAddress: 48581
    sourceIeeeAddr: '0x00158d00054d14e1'
    sourceNwkAddr: 48581
    target:
      ieeeAddr: '0x00212effff04d7ff'
      networkAddress: 0
    targetIeeeAddr: '0x00212effff04d7ff'
  - depth: 1
    linkquality: 252
    lqi: 252
    relationship: 1
    routes:
      - destinationAddress: 26274
        nextHop: 26274
        status: ACTIVE
    source:
      ieeeAddr: '0x00158d0003f413ae'
      networkAddress: 26274
    sourceIeeeAddr: '0x00158d0003f413ae'
    sourceNwkAddr: 26274
    target:
      ieeeAddr: '0x00212effff04d7ff'
      networkAddress: 0
    targetIeeeAddr: '0x00212effff04d7ff'
nodes:
  - definition: null
    failed: []
    friendlyName: Coordinator
    ieeeAddr: '0x00212effff04d7ff'
    lastSeen: null
    networkAddress: 0
    type: Coordinator
  - definition:
      description: Temperature & humidity sensor
      model: IH-K009
      supports: battery, temperature, humidity, voltage, linkquality
      vendor: TuYa
    friendlyName: Living Room Temperature Sensor
    ieeeAddr: '0xa4c1383129955e91'
    lastSeen: 1682171541038
    manufacturerName: _TZ3000_dowj6gyi
    modelID: TS0201
    networkAddress: 21687
    type: EndDevice
  - definition:
      description: Aqara human body movement and illuminance sensor
      model: RTCGQ11LM
      supports: >-
        battery, occupancy, device_temperature, voltage, illuminance_lux,
        illuminance, power_outage_count, linkquality
      vendor: Xiaomi
    friendlyName: Living Room Motion Sensor
    ieeeAddr: '0x00158d0004141928'
    lastSeen: 1682487054888
    manufacturerName: LUMI
    modelID: lumi.sensor_motion.aq2
    networkAddress: 22325
    type: EndDevice
  - definition:
      description: Aqara human body movement and illuminance sensor
      model: RTCGQ11LM
      supports: >-
        battery, occupancy, device_temperature, voltage, illuminance_lux,
        illuminance, power_outage_count, linkquality
      vendor: Xiaomi
    friendlyName: Kitchen Motion Sensor 2
    ieeeAddr: '0x00158d0003f413ae'
    lastSeen: 1682487731964
    manufacturerName: LUMI
    modelID: lumi.sensor_motion.aq2
    networkAddress: 26274
    type: EndDevice
  - definition:
      description: MiJia wireless switch
      model: WXKG01LM
      supports: battery, action, voltage, power_outage_count, linkquality
      vendor: Xiaomi
    friendlyName: Bedside Dima Button
    ieeeAddr: '0x00158d0003243f56'
    lastSeen: 1682486170748
    manufacturerName: LUMI
    modelID: lumi.sensor_switch
    networkAddress: 13975
    type: EndDevice
  - definition:
      description: MiJia wireless switch
      model: WXKG01LM
      supports: battery, action, voltage, power_outage_count, linkquality
      vendor: Xiaomi
    friendlyName: Bedside Galit Button
    ieeeAddr: '0x00158d00035f3679'
    lastSeen: 1682488946914
    manufacturerName: LUMI
    modelID: lumi.sensor_switch
    networkAddress: 10163
    type: EndDevice
  - definition:
      description: MiJia wireless switch
      model: WXKG01LM
      supports: battery, action, voltage, power_outage_count, linkquality
      vendor: Xiaomi
    friendlyName: Makeup Button
    ieeeAddr: '0x00158d00035a99fc'
    lastSeen: 1681746919549
    manufacturerName: LUMI
    modelID: lumi.sensor_switch
    networkAddress: 55591
    type: EndDevice
  - definition:
      description: MiJia wireless switch
      model: WXKG01LM
      supports: battery, action, voltage, power_outage_count, linkquality
      vendor: Xiaomi
    friendlyName: Kitchen Strips Left Button
    ieeeAddr: '0x00158d0003598968'
    lastSeen: 1681748431730
    manufacturerName: LUMI
    modelID: lumi.sensor_switch
    networkAddress: 11100
    type: EndDevice
  - definition:
      description: MiJia wireless switch
      model: WXKG01LM
      supports: battery, action, voltage, power_outage_count, linkquality
      vendor: Xiaomi
    friendlyName: Kitchen Strips Right Button
    ieeeAddr: '0x00158d000359884e'
    lastSeen: 1682487105403
    manufacturerName: LUMI
    modelID: lumi.sensor_switch
    networkAddress: 55663
    type: EndDevice
  - definition:
      description: Aqara human body movement and illuminance sensor
      model: RTCGQ11LM
      supports: >-
        battery, occupancy, device_temperature, voltage, illuminance_lux,
        illuminance, power_outage_count, linkquality
      vendor: Xiaomi
    friendlyName: Kitchen Motion Sensor
    ieeeAddr: '0x00158d00054d14e1'
    lastSeen: 1682486409123
    manufacturerName: LUMI
    modelID: lumi.sensor_motion.aq2
    networkAddress: 48581
    type: EndDevice
  - definition:
      description: Temperature & humidity sensor
      model: IH-K009
      supports: battery, temperature, humidity, voltage, linkquality
      vendor: TuYa
    friendlyName: Kfir Room Temperature Sensor
    ieeeAddr: '0xa4c13839360302fd'
    lastSeen: 1682489643373
    manufacturerName: _TZ3000_dowj6gyi
    modelID: TS0201
    networkAddress: 21035
    type: EndDevice
  - definition:
      description: Temperature & humidity sensor
      model: IH-K009
      supports: battery, temperature, humidity, voltage, linkquality
      vendor: TuYa
    friendlyName: Ronen Room Temperature Sensor
    ieeeAddr: '0xa4c138e5a6b1a2d8'
    lastSeen: 1682488790336
    manufacturerName: _TZ3000_dowj6gyi
    modelID: TS0201
    networkAddress: 44191
    type: EndDevice
  - definition:
      description: Temperature & humidity sensor
      model: IH-K009
      supports: battery, temperature, humidity, voltage, linkquality
      vendor: TuYa
    friendlyName: Bedroom Temperature Sensor
    ieeeAddr: '0xa4c1383e71f7e935'
    lastSeen: 1682488631282
    manufacturerName: _TZ3000_dowj6gyi
    modelID: TS0201
    networkAddress: 51011
    type: EndDevice
friendly_name: Zigbee2mqtt Networkmap

sensor.zigbee2mqtt_basement_networkmap

links:
  - depth: 1
    linkquality: 186
    lqi: 186
    relationship: 1
    routes: []
    source:
      ieeeAddr: '0xa4c138afa0e9386d'
      networkAddress: 12070
    sourceIeeeAddr: '0xa4c138afa0e9386d'
    sourceNwkAddr: 12070
    target:
      ieeeAddr: '0x00124b002a2ee44a'
      networkAddress: 0
    targetIeeeAddr: '0x00124b002a2ee44a'
nodes:
  - definition: null
    failed: []
    friendlyName: Coordinator
    ieeeAddr: '0x00124b002a2ee44a'
    lastSeen: null
    networkAddress: 0
    type: Coordinator
  - definition:
      description: Temperature & humidity sensor
      model: IH-K009
      supports: battery, temperature, humidity, voltage, linkquality
      vendor: TuYa
    friendlyName: Basement Temperature Sensor
    ieeeAddr: '0xa4c138afa0e9386d'
    lastSeen: 1682429504303
    manufacturerName: _TZ3000_dowj6gyi
    modelID: TS0201
    networkAddress: 12070
    type: EndDevice
friendly_name: Zigbee2mqtt Basement Networkmap

Additional context My cards configuration in YAML

                - type: custom:zigbee2mqtt-networkmap
                  entity: "sensor.zigbee2mqtt_networkmap"
                  mqtt_base_topic: "zigbee2mqtt"

                - type: custom:zigbee2mqtt-networkmap
                  entity: "sensor.zigbee2mqtt_basement_networkmap"
                  mqtt_base_topic: "z2m_basement"
dmatik commented 1 year ago

Found an issue in my code. It is working now. Issue can be closed.