From 42155370475b1f6619498ec2c43c1c7f328ce1a1 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Sun, 18 Feb 2024 01:35:57 +0300 Subject: lws: wip --- include/py/homekit/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/py/homekit/util.py') diff --git a/include/py/homekit/util.py b/include/py/homekit/util.py index 7732d3b..c686f29 100644 --- a/include/py/homekit/util.py +++ b/include/py/homekit/util.py @@ -12,7 +12,7 @@ import re import os import ipaddress -from collections import namedtuple +from collections.abc import KeysView from enum import Enum from datetime import datetime from typing import Optional, List @@ -119,6 +119,8 @@ def json_serial(obj): return obj.timestamp() if isinstance(obj, Enum): return obj.value + if isinstance(obj, KeysView): + return list(obj) raise TypeError("Type %s not serializable" % type(obj)) -- cgit v1.2.3