Skip to content

Commit

Permalink
Improve logging for test api
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre0512 committed Jul 20, 2023
1 parent e077467 commit cfee10d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pyhon/connection/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,12 @@ def _load_json(self, appliance: HonAppliance, file: str) -> Dict[str, Any]:
async def load_appliances(self) -> List[Dict[str, Any]]:
result = []
for appliance in self._path.glob("*/"):
with open(
appliance / "appliance_data.json", "r", encoding="utf-8"
) as json_file:
result.append(json.loads(json_file.read()))
file = appliance / "appliance_data.json"
with open(file, "r", encoding="utf-8") as json_file:
try:
result.append(json.loads(json_file.read()))
except json.decoder.JSONDecodeError as error:
_LOGGER.error("%s - %s", str(file), error)
return result

async def load_commands(self, appliance: HonAppliance) -> Dict[str, Any]:
Expand Down Expand Up @@ -318,4 +320,5 @@ async def send_command(
parameters: Dict[str, Any],
ancillary_parameters: Dict[str, Any],
) -> bool:
_LOGGER.info("%s - %s", str(parameters), str(ancillary_parameters))
return True

0 comments on commit cfee10d

Please sign in to comment.