Skip to content

Commit

Permalink
Update config_flow.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Xerolux authored Sep 15, 2024
1 parent 96e2c87 commit e82651c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions custom_components/violet_pool_controller/config_flow.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import logging

import aiohttp
import async_timeout
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers import aiohttp_client
from homeassistant.helpers.selector import TextSelector

from .const import DOMAIN, CONF_API_URL, CONF_POLLING_INTERVAL

Expand Down Expand Up @@ -36,7 +34,9 @@ async def async_step_user(self, user_input=None) -> FlowResult:
async with async_timeout.timeout(10):
async with session.get(api_url, ssl=False) as response:
response.raise_for_status()
await response.json()
data = await response.json()
firmware_version = data.get('FW', 'Unknown') # Get firmware from JSON

except aiohttp.ClientError as err:
_LOGGER.error("Error connecting to API: %s", err)
errors["base"] = "cannot_connect"
Expand Down

0 comments on commit e82651c

Please sign in to comment.