Skip to content

Commit

Permalink
Advertise with device name, if configured
Browse files Browse the repository at this point in the history
  • Loading branch information
jjok committed Apr 20, 2023
1 parent 3ae1172 commit 0ffa655
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/discovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ async function onDiscovery(peripheral) {

if (config.homeassistant) homeassistant.configDiscovery(decoded, dev, peripheral, d.uuid);
for (var k in decoded) {
if (config.mqtt_advertise) mqtt.send(config.mqtt_prefix + "/advertise/" + id + "/" + k, JSON.stringify(decoded[k]));
if (config.mqtt_format_decoded_key_topic) mqtt.send(config.mqtt_prefix + "/" + k + "/" + id, JSON.stringify(decoded[k]));
if (config.mqtt_advertise) mqtt.send(config.mqtt_prefix + "/advertise/" + dev.name + "/" + k, JSON.stringify(decoded[k]));
if (config.mqtt_format_decoded_key_topic) mqtt.send(config.mqtt_prefix + "/" + k + "/" + dev.name, JSON.stringify(decoded[k]));
}

if (config.mqtt_format_json) {
Expand Down

0 comments on commit 0ffa655

Please sign in to comment.