1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-15 07:08:20 +00:00
This commit is contained in:
Otto Winter 2018-11-30 19:16:51 +01:00
parent 7f038eb5d2
commit a7ee95f999
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E

View File

@ -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', '')
} }