mirror of
https://github.com/tsightler/ring-mqtt.git
synced 2025-12-24 13:18:16 +08:00
Tweak MQTT discovery
This commit is contained in:
@@ -21,7 +21,7 @@ if [ -v HASSIO_TOKEN ]; then
|
||||
export DEBUG=$(bashio::config "debug")
|
||||
|
||||
# Export MQTT service discovery data for use within NodeJS process
|
||||
if bashio::services.available 'mqtt'; then
|
||||
if bashio::var.has_value "$(bashio::services 'mqtt')"; then
|
||||
export HAMQTTHOST=$(bashio::services mqtt "host")
|
||||
export HAMQTTPORT=$(bashio::services mqtt "port")
|
||||
export HAMQTTUSER=$(bashio::services mqtt "username")
|
||||
|
||||
@@ -72,12 +72,12 @@ export default new class Config {
|
||||
mqttURL.hostname = process.env.HAMQTTHOST
|
||||
if (mqttURL.hostname === 'localhost' || mqttURL.hostname === '127.0.0.1') {
|
||||
debug(`Discovered invalid value for MQTT host: ${mqttURL.hostname}`)
|
||||
debug('Overriding with default alias for Mosquitto MQTT addon')
|
||||
debug('Overriding with default alias for the Mosquitto addon')
|
||||
mqttURL.hostname = 'core-mosquitto'
|
||||
}
|
||||
} else {
|
||||
debug('No Home Assistant MQTT service found, using Home Assistant hostname as default')
|
||||
mqttURL.hostname = process.env.HAHOSTNAME
|
||||
debug('No Home Assistant MQTT service found, using the default alias for the Mosquitto addon')
|
||||
mqttURL.hostname = 'core-mosquitto'
|
||||
}
|
||||
} else if (mqttURL.protocol === 'mqtts:') {
|
||||
mqttURL.hostname = process.env.HAHOSTNAME
|
||||
|
||||
Reference in New Issue
Block a user