diff --git a/custom_components/bahmcloud_store/core.py b/custom_components/bahmcloud_store/core.py index 04f4b5a..ebe667c 100644 --- a/custom_components/bahmcloud_store/core.py +++ b/custom_components/bahmcloud_store/core.py @@ -3,6 +3,7 @@ from __future__ import annotations import asyncio import json import logging +import time from dataclasses import dataclass from pathlib import Path from typing import Any @@ -157,13 +158,25 @@ class BCSCore: async def _load_index_repos(self) -> tuple[list[RepoItem], int]: session = async_get_clientsession(self.hass) + + # ---- CACHE BUSTING FIX (Phase B) ---- + # Force store.yaml to always be reloaded from remote: + # - add timestamp query parameter + # - disable HTTP cache via headers + url = f"{self.config.store_url}?t={int(time.time())}" + headers = { + "Cache-Control": "no-cache", + "Pragma": "no-cache", + } + try: - async with session.get(self.config.store_url, timeout=20) as resp: + async with session.get(url, timeout=20, headers=headers) as resp: if resp.status != 200: raise BCSError(f"store_url returned {resp.status}") raw = await resp.text() except Exception as e: raise BCSError(f"Failed fetching store index: {e}") from e + # ---- END CACHE BUSTING FIX ---- try: data = ha_yaml.parse_yaml(raw)