Closed pixeldoc2000 closed 2 years ago
Thank you so much for this :-) @pixeldoc2000 👍
Hello.
I am still struggling to make this to work. To make debugging easier, I was thinking to look at the MQTT broker instead, and then search why it's not working with HA.
I was using the proposed template on my zigbee2mqtt-data/configuration.yaml
file, by having exactly these values alongside existing mqtt: entry, thus the final entry is:
mqtt:
base_topic: zigbee2mqtt
server: mqtt://192.168.1.4:1883
user: ***
password: ***
sensor:
- name: Zigbee2mqtt Networkmap
state_topic: zigbee2mqtt/bridge/response/networkmap
value_template: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
json_attributes_topic: zigbee2mqtt/bridge/response/networkmap
json_attributes_template: '{{ value_json.data.value | tojson }}'
Then I tried to connect directly to MQTT broker, to see what's happening, but there's nothing under zigbee2mqtt/bridge/response/networkmap
. Of course, zigbee2mqtt/bridge
exists, but I was expecting to find the rest too.
Am I missing something?
Thank you!
You can debug the zigbee2mqtt MQTT api using:
# run in one console
mosquitto_sub -h 192.168.1.4 -u user -P pass -t 'zigbee2mqtt/bridge/response/networkmap'
# run in another console
mosquitto_pub -h 192.168.1.4 -u user -P pass -t 'zigbee2mqtt/bridge/request/networkmap' -m '{"type": "raw", "routes": true}'
Wait about a minute, you should see some JSON data in the mosquitto_sub console.
Did you misunderstand the configuration? This config:
mqtt:
sensor:
- name: Zigbee2mqtt Networkmap
# if you change base_topic of Zigbee2mqtt, change state_topic accordingly
state_topic: zigbee2mqtt/bridge/response/networkmap
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/response/networkmap
json_attributes_template: "{{ value_json.data.value | tojson }}"
is to be put into config/configuration.yaml
of Home-Assistant, not Zigbee2mqtt.
Did you misunderstand the configuration? This config: ... is to be put into
config/configuration.yaml
of Home-Assistant, not Zigbee2mqtt.
Right, I misunderstood. Maybe the README should be updated to clearly state that this configuration should be put in HA's config instead?
Also, now I can see the sensor, but when I try to set a custom lovelace card, it's empty. Here is the sensor:
Here is the lovelace configuration (maybe this should be in documentation too?)
type: custom:zigbee2mqtt-networkmap
And here's what I see. The fact that I see the "Refresh" button, seems to be an indication that the card is loading but with wrong data.
Please open a new issue and fill the issue template, especially I need full plain text of the state attributes of sensor.zigbee2mqtt_networkmap
.
Old mqtt config;
New mqtt: