diff --git a/custom_components/omnik_inverter/config_flow.py b/custom_components/omnik_inverter/config_flow.py index 5349a94..eeedbc4 100644 --- a/custom_components/omnik_inverter/config_flow.py +++ b/custom_components/omnik_inverter/config_flow.py @@ -132,7 +132,7 @@ async def async_step_setup( host=user_input[CONF_HOST], source_type=self.source_type, ) as client: - await client.inverter() + await client.perform_request() except OmnikInverterError: LOGGER.exception("Failed to connect to the Omnik") errors["base"] = "cannot_connect" @@ -183,7 +183,7 @@ async def async_step_setup_html( username=user_input[CONF_USERNAME], password=user_input[CONF_PASSWORD], ) as client: - await client.inverter() + await client.perform_request() except OmnikInverterError: LOGGER.exception("Failed to connect to the Omnik") errors["base"] = "cannot_connect" @@ -237,7 +237,7 @@ async def async_step_setup_tcp( source_type=self.source_type, serial_number=user_input[CONF_SERIAL], ) as client: - await client.inverter() + await client.perform_request() except OmnikInverterError: LOGGER.exception("Failed to connect to the Omnik") errors["base"] = "cannot_connect" diff --git a/custom_components/omnik_inverter/coordinator.py b/custom_components/omnik_inverter/coordinator.py index a3c248a..65afea4 100644 --- a/custom_components/omnik_inverter/coordinator.py +++ b/custom_components/omnik_inverter/coordinator.py @@ -88,9 +88,10 @@ async def _async_update_data(self) -> OmnikInverterData: UpdateFailed: An error occurred when updating the data. """ try: + request = await self.omnikinverter.perform_request() data: OmnikInverterData = { - SERVICE_INVERTER: await self.omnikinverter.inverter(), - SERVICE_DEVICE: await self.omnikinverter.device(), + SERVICE_INVERTER: request.inverter(), + SERVICE_DEVICE: request.device(), } return data except OmnikInverterAuthError as error: