Skip to content

Commit

Permalink
Merge pull request #109 from jjok/fix/always-use-device-name
Browse files Browse the repository at this point in the history
Advertise with device name, if configured
  • Loading branch information
gfwilliams authored Apr 21, 2023
2 parents 3ae1172 + 0ffa655 commit 9c9b817
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 9c9b817

Please sign in to comment.