Skip to content

Commit

Permalink
Fix dict_to_jsonable
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbedrich committed Oct 26, 2023
1 parent 9bd3b57 commit 4ca7193
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions custom_components/zha_toolkit/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,10 @@ def dict_to_jsonable(src_dict):
for key, value in src_dict.items():
if not isJsonable(value):
LOGGER.error(f"Can't convert to JSON {value!r}")
if isinstance(value, bytes):
value = str(value, encoding="ascii")
elif callable(getattr(value, "serialize", None)):
if callable(getattr(value, "serialize", None)):
value = value.serialize()
if isinstance(value, bytes):
value = value.hex()
else:
value = repr(value)

Expand Down

0 comments on commit 4ca7193

Please sign in to comment.