Skip to content

Commit

Permalink
Allow config mqtt full topic and payload
Browse files Browse the repository at this point in the history
  • Loading branch information
azuwis committed May 16, 2023
1 parent df01031 commit ac9661c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/components/Zigbee2mqttNetworkmap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit ac9661c

Please sign in to comment.