diff --git a/homeassistant/components/plugwise/__init__.py b/homeassistant/components/plugwise/__init__.py index efb97f51c414aa..07d59aad8087f6 100644 --- a/homeassistant/components/plugwise/__init__.py +++ b/homeassistant/components/plugwise/__init__.py @@ -35,8 +35,17 @@ async def async_setup(hass: HomeAssistant, config: dict): async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Plugwise Smiles from a config entry.""" websession = async_get_clientsession(hass, verify_ssl=False) + + if ":" in entry.data["host"]: + port = int(entry.data["host"].split(":")[1]) + else: + port = 80 + api = Smile( - host=entry.data["host"], password=entry.data["password"], websession=websession + host=entry.data["host"].split(":")[0], + password=entry.data["password"], + port=port, + websession=websession, ) try: diff --git a/homeassistant/components/plugwise/config_flow.py b/homeassistant/components/plugwise/config_flow.py index b02bb3cb92b927..a8148573c4258a 100644 --- a/homeassistant/components/plugwise/config_flow.py +++ b/homeassistant/components/plugwise/config_flow.py @@ -39,9 +39,16 @@ async def validate_input(hass: core.HomeAssistant, data): Data has the keys from _base_schema() with values provided by the user. """ websession = async_get_clientsession(hass, verify_ssl=False) + + if ":" in data[CONF_HOST]: + port = int(data[CONF_HOST].split(":")[1]) + else: + port = 80 + api = Smile( - host=data[CONF_HOST], + host=data[CONF_HOST].split(":")[0], password=data[CONF_PASSWORD], + port=port, timeout=30, websession=websession, )