From ac9661cec21330b1724271439005a105da8c39d4 Mon Sep 17 00:00:00 2001 From: Zhong Jianxin Date: Tue, 16 May 2023 10:07:42 +0800 Subject: [PATCH] Allow config mqtt full topic and payload --- README.md | 2 ++ src/components/Zigbee2mqttNetworkmap.vue | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e0e3ece..df538ba 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,8 @@ views: entity: sensor.zigbee2mqtt_networkmap # the following are optional: mqtt_base_topic: zigbee2mqtt # if you change base_topic of Zigbee2mqtt, change it accordingly + mqtt_topic: zigbee2mqtt/bridge/request/networkmap # or you can specify the full mqtt topic, see https://www.zigbee2mqtt.io/guide/usage/mqtt_topics_and_messages.html#zigbee2mqtt-bridge-request + mqtt_payload: { type: 'raw', routes: true } force: 3000 # decrease it to get smaller map if you have many devices node_size: 16 font_size: 12 diff --git a/src/components/Zigbee2mqttNetworkmap.vue b/src/components/Zigbee2mqttNetworkmap.vue index 49e66b8..9ca401e 100644 --- a/src/components/Zigbee2mqttNetworkmap.vue +++ b/src/components/Zigbee2mqttNetworkmap.vue @@ -164,9 +164,11 @@ export default { refresh () { this.state = 'Refreshing...' const mqttBaseTopic = this.config.mqtt_base_topic || 'zigbee2mqtt' + const mqttTopic = this.config.mqtt_topic || mqttBaseTopic + '/bridge/request/networkmap' + const payload = this.config.mqtt_payload || { type: 'raw', routes: true } this.hass.callService('mqtt', 'publish', { - topic: mqttBaseTopic + '/bridge/request/networkmap', - payload: JSON.stringify({ type: 'raw', routes: true }) + topic: mqttTopic, + payload: JSON.stringify(payload) }) }, update () {