svrooij / sonos2mqtt

:speaker: Sonos mqtt controller. Control your speakers from your mqtt server. mqtt-smarthome insprired.
https://sonos2mqtt.svrooij.io/
MIT License
76 stars 18 forks source link

bug: SONOS2MQTT_FRIENDLYNAMES env var doesn't work #183

Closed tracetechnical closed 1 year ago

tracetechnical commented 1 year ago

Setting SONOS2MQTT_FRIENDLYNAMES env var to "name" doesn't seem to set the friendlynames flag as expected.

Checked yargs docs to see if I was being daft, but it appears not.

tracetechnical commented 1 year ago

Also appears that the --friendlynames flag itself doesn't work, in my testing.

svrooij commented 1 year ago

It doesn't work where exactly? According to the code that I just checked it should work for all topics except the unified topic (where the uuid is always used).

this.mqtt.publish(`status/${this.topicId(d.Name, d.Uuid)}/avtransport`,data)
svrooij commented 1 year ago

This is the result when I set SONOS2MQTT_FRIENDLYNAMES to uuid: image

That means the config is loaded correctly.

The {prefix}/{player_uuid} topic will never change, this message includes the complete status and will always use the uuid.

The SONOS2MQTT_FRIENDLYNAMES setting only influences the distinct topics, that you need to activate by setting the SONOS2MQTT_DISTINCT to true (or by including the --distinct flag.

Which will result in the following messages in the mqtt server.

set to uuid image

Set to name (or skipped because it's the default). image

I think this might need addition explanation in the docs, but is works like I build it, so I'm closing this issue for now. You can always re-open if you think this is incorrect.