def _update_state_and_attributes(self) -> None:
        """Update sensor state with the configured model."""
        provider = self._entry.data.get(CONF_PROVIDER)
        if not provider:
            self._attr_native_value = STATE_UNKNOWN
            return

        model_key = PROVIDER_TO_MODEL_KEY_MAP.get(provider)
        if not model_key:
            self._attr_native_value = "Unknown Model Key"
            _LOGGER.warning("No model key found for provider: %s", provider)
            return

        self._attr_native_value = self._entry.options.get(
            model_key,
            self._entry.data.get(model_key, DEFAULT_MODELS.get(provider, "unknown"))
        ) if model_key else "unknown"
Update sensor state with the configured model.
custom_components/ai_automation_suggester/sensor.py