From 50ff16df4834a9b9efaedb3f84919b971c170aa8 Mon Sep 17 00:00:00 2001 From: Necroneco Date: Tue, 16 Jul 2024 16:59:28 +0800 Subject: [PATCH] fix `StopIteration` error --- custom_components/ds_air/config_flow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/ds_air/config_flow.py b/custom_components/ds_air/config_flow.py index b2e37f4..e0d85db 100644 --- a/custom_components/ds_air/config_flow.py +++ b/custom_components/ds_air/config_flow.py @@ -186,7 +186,7 @@ async def async_step_bind_sensors(self, user_input: dict[str, Any] | None = None return self.async_create_entry(title="", data={"link": self._config_data}) cur_climate: str = self._climates[self._cur] cur_links = self.config_entry.options.get("link", []) - cur_link = next(link for link in cur_links if link["climate"] == cur_climate) + cur_link = next((link for link in cur_links if link["climate"] == cur_climate), None) cur_sensor_temp = cur_link.get("sensor_temp") if cur_link else None cur_sensor_humi = cur_link.get("sensor_humi") if cur_link else None return self.async_show_form(