mirror of
https://github.com/esphome/esphome.git
synced 2025-03-15 07:08:20 +00:00
This commit is contained in:
parent
7f038eb5d2
commit
a7ee95f999
@ -505,11 +505,15 @@ def _get_mqtt_config_impl():
|
|||||||
}
|
}
|
||||||
|
|
||||||
mqtt_config = requests.get('http://hassio/services/mqtt', headers=headers).json()['data']
|
mqtt_config = requests.get('http://hassio/services/mqtt', headers=headers).json()['data']
|
||||||
info = requests.get('http://hassio/info', headers=headers).json()['data']
|
info = requests.get('http://hassio/host/info', headers=headers).json()['data']
|
||||||
|
host = '{}.local'.format(info['hostname'])
|
||||||
|
port = mqtt_config['port']
|
||||||
|
if port != 1883:
|
||||||
|
host = '{}:{}'.format(host, port)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'ssl': mqtt_config['ssl'],
|
'ssl': mqtt_config['ssl'],
|
||||||
'host': info['hostname'] + '.local:' + str(mqtt_config['port']),
|
'host': host,
|
||||||
'username': mqtt_config.get('username', ''),
|
'username': mqtt_config.get('username', ''),
|
||||||
'password': mqtt_config.get('password', '')
|
'password': mqtt_config.get('password', '')
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user