diff --git a/custom_components/aliexpress_openplatform/sensor.py b/custom_components/aliexpress_openplatform/sensor.py index d63ddaa..70686f3 100644 --- a/custom_components/aliexpress_openplatform/sensor.py +++ b/custom_components/aliexpress_openplatform/sensor.py @@ -202,6 +202,10 @@ def _determine_time_range(self, now: datetime) -> tuple[datetime, datetime]: def _get_api_credentials(self) -> dict[str, str]: """Extract API credentials from the configuration entry.""" + if self.config_entry is None: + error_message = "Config entry is None. Cannot access configuration data." + raise ValueError(error_message) + return { "app_key": self.config_entry.data[CONF_APP_KEY], "app_secret": self.config_entry.data[CONF_APP_SECRET],