Improve logging for test api

This commit is contained in:
Andre Basche 2023-07-20 23:52:46 +02:00
parent e0774677eb
commit cfee10df5f

View File

@ -278,10 +278,12 @@ class TestAPI(HonAPI):
async def load_appliances(self) -> List[Dict[str, Any]]: async def load_appliances(self) -> List[Dict[str, Any]]:
result = [] result = []
for appliance in self._path.glob("*/"): for appliance in self._path.glob("*/"):
with open( file = appliance / "appliance_data.json"
appliance / "appliance_data.json", "r", encoding="utf-8" with open(file, "r", encoding="utf-8") as json_file:
) as json_file: try:
result.append(json.loads(json_file.read())) result.append(json.loads(json_file.read()))
except json.decoder.JSONDecodeError as error:
_LOGGER.error("%s - %s", str(file), error)
return result return result
async def load_commands(self, appliance: HonAppliance) -> Dict[str, Any]: async def load_commands(self, appliance: HonAppliance) -> Dict[str, Any]:
@ -318,4 +320,5 @@ class TestAPI(HonAPI):
parameters: Dict[str, Any], parameters: Dict[str, Any],
ancillary_parameters: Dict[str, Any], ancillary_parameters: Dict[str, Any],
) -> bool: ) -> bool:
_LOGGER.info("%s - %s", str(parameters), str(ancillary_parameters))
return True return True