diff --git a/miio/miot_cloud.py b/miio/miot_cloud.py index 3076326b6..bbaa77d46 100644 --- a/miio/miot_cloud.py +++ b/miio/miot_cloud.py @@ -96,9 +96,11 @@ def get_model_schema(self, model: str) -> Dict: release_info = specs.info_for_model(model) model_file = self._cache_dir / f"{release_info.model}.json" - spec = self._file_from_cache(model_file) - if spec is not None: + try: + spec = self._file_from_cache(model_file) return spec + except FileNotFoundError: + _LOGGER.debug(f"Cached schema not found for {model}, going to fetch it") spec = MiotSpec.get_spec_for_urn(device_urn=release_info.type) self._write_to_cache(model_file, spec)