Resolve hostnames (#11160)

This commit is contained in:
Pascal Vizeli 2017-12-15 22:54:54 +01:00 committed by GitHub
parent a63658d583
commit a7c8e202aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,10 +5,11 @@ For more details about this component, please refer to the documentation at
https://home-assistant.io/components/homematic/ https://home-assistant.io/components/homematic/
""" """
import asyncio import asyncio
import os
import logging
from datetime import timedelta from datetime import timedelta
from functools import partial from functools import partial
import logging
import os
import socket
import voluptuous as vol import voluptuous as vol
@ -254,7 +255,7 @@ def setup(hass, config):
# Create hosts-dictionary for pyhomematic # Create hosts-dictionary for pyhomematic
for rname, rconfig in conf[CONF_INTERFACES].items(): for rname, rconfig in conf[CONF_INTERFACES].items():
remotes[rname] = { remotes[rname] = {
'ip': rconfig.get(CONF_HOST), 'ip': socket.gethostbyname(rconfig.get(CONF_HOST)),
'port': rconfig.get(CONF_PORT), 'port': rconfig.get(CONF_PORT),
'path': rconfig.get(CONF_PATH), 'path': rconfig.get(CONF_PATH),
'resolvenames': rconfig.get(CONF_RESOLVENAMES), 'resolvenames': rconfig.get(CONF_RESOLVENAMES),
@ -267,7 +268,7 @@ def setup(hass, config):
for sname, sconfig in conf[CONF_HOSTS].items(): for sname, sconfig in conf[CONF_HOSTS].items():
remotes[sname] = { remotes[sname] = {
'ip': sconfig.get(CONF_HOST), 'ip': socket.gethostbyname(sconfig.get(CONF_HOST)),
'port': DEFAULT_PORT, 'port': DEFAULT_PORT,
'username': sconfig.get(CONF_USERNAME), 'username': sconfig.get(CONF_USERNAME),
'password': sconfig.get(CONF_PASSWORD), 'password': sconfig.get(CONF_PASSWORD),