Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion homeassistant/components/plugwise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 8 additions & 1 deletion homeassistant/components/plugwise/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down