diff --git a/homeassistant/components/recorder/pool.py b/homeassistant/components/recorder/pool.py index f2f952121af..52b6b74dfa1 100644 --- a/homeassistant/components/recorder/pool.py +++ b/homeassistant/components/recorder/pool.py @@ -55,7 +55,12 @@ class RecorderPool(SingletonThreadPool, NullPool): # type: ignore[misc] def shutdown(self) -> None: """Close the connection.""" - if self.recorder_or_dbworker and self._conn and (conn := self._conn.current()): + if ( + self.recorder_or_dbworker + and self._conn + and hasattr(self._conn, "current") + and (conn := self._conn.current()) + ): conn.close() def dispose(self) -> None: