azuwis / zigbee2mqtt-networkmap

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

TypeError: Cannot read property 'attributes' of undefined #24

Closed alexgraupera closed 4 years ago

alexgraupera commented 4 years ago

Hi!

I have the same error as reported issue: https://github.com/azuwis/zigbee2mqtt-networkmap/issues/20

zigbee2mqtt-networkmap.js?v=0.6.0:formatted:802 TypeError: Cannot read property 'attributes' of undefined
    at a.hass (zigbee2mqtt-networkmap.js?v=0.6.0:formatted:4765)
    at nr.run (zigbee2mqtt-networkmap.js?v=0.6.0:formatted:1963)
    at Kn (zigbee2mqtt-networkmap.js?v=0.6.0:formatted:1847)
    at Array.<anonymous> (zigbee2mqtt-networkmap.js?v=0.6.0:formatted:847)
    at ue (zigbee2mqtt-networkmap.js?v=0.6.0:formatted:810)

I installed card from HACS (version 1.0.3) and followed this installation steps:

When I access to lovelace tab with new card, this show blank result, and console output show the javascript error. I cleaned the cache.

My Setup:

arch: armv7 channel: stable docker: 19.03.8 hassos: "4.8" homeassistant: 0.110.4 hostname: hassio logging: info machine: raspberrypi3 supervisor: "226" supported_arch:

  • armv7
  • armhf

zigbee2mqtt 1.13.1.1 hacs 1.0.3

If you need more information, feel free to request me Thank you in advance (and sorry for my english)

azuwis commented 4 years ago

I've just upgraded zigbee2mqtt to 1.13.1, it works fine.

Make sure sensor.zigbee2mqtt_networkmap exists, you can tell by Developer Tools -> STATES.

If sensor.zigbee2mqtt_networkmap does not exist, your configuration is wrong.

sensor:
  - platform: mqtt
    name: Zigbee2mqtt Networkmap
    # if you change base_topic of Zigbee2mqtt, change state_topic accordingly
    state_topic: zigbee2mqtt/bridge/networkmap/raw
    value_template: >-
      {{ now().strftime('%Y-%m-%d %H:%M:%S') }}
    # again, if you change base_topic of Zigbee2mqtt, change json_attributes_topic accordingly
    json_attributes_topic: zigbee2mqtt/bridge/networkmap/raw
alexgraupera commented 4 years ago

Yup! This is the problem. Although I have the sensor declaration in configuration.yaml, this does not exist

image

As You can see in the image, I have a configuration distributed in several folders, grouped by elements, and imported content with includes

What I have done? I removed the sensor creation from the configuration.yaml and created a new one inside the folder structure as shown in the image below

image

I am very newbie (sorry) and I did not notice that I had two sensor statements. Maybe this invalidates each other

After reboot for apply the configuration settings, now is working for me (upgraded too zigbee2mqtt at 1.13.1) :-)

Thank you for your support and sorry for the inconvenience