mirror of
https://github.com/esphome/esphome.git
synced 2025-02-13 08:28:19 +00:00
Use hostname
This commit is contained in:
parent
a6f1e92c20
commit
ab47775475
@ -452,11 +452,12 @@ def _get_mqtt_config_impl():
|
|||||||
'X-HASSIO-KEY': os.getenv('HASSIO_TOKEN'),
|
'X-HASSIO-KEY': os.getenv('HASSIO_TOKEN'),
|
||||||
}
|
}
|
||||||
|
|
||||||
req = requests.get('http://hassio/services/mqtt', headers=headers)
|
mqtt_config = requests.get('http://hassio/services/mqtt', headers=headers).json()['data']
|
||||||
mqtt_config = req.json()['data']
|
info = requests.get('http://hassio/info', headers=headers).json()['data']
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'ssl': mqtt_config['ssl'],
|
'ssl': mqtt_config['ssl'],
|
||||||
'host': mqtt_config['host'] + ':' + str(mqtt_config['port']),
|
'host': info['hostname'] + '.local:' + str(mqtt_config['port']),
|
||||||
'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