From d986a2549fb63c6676bef758b5b5c0895f09bea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Tue, 25 Jan 2022 15:52:47 +0100 Subject: [PATCH] Add ProductBarcodeData to GrocyJSONEncoder --- custom_components/grocy/json_encode.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/custom_components/grocy/json_encode.py b/custom_components/grocy/json_encode.py index 6c55f00..96ce211 100644 --- a/custom_components/grocy/json_encode.py +++ b/custom_components/grocy/json_encode.py @@ -4,6 +4,7 @@ from typing import Any from pygrocy.data_models.product import ProductBarcode +from pygrocy.grocy_api_client import ProductBarcodeData class GrocyJSONEncoder(json.JSONEncoder): @@ -14,6 +15,8 @@ def default(self, o: Any) -> Any: if isinstance(o, ProductBarcode): return o.barcode + if isinstance(o, ProductBarcodeData): + return o.barcode if isinstance(o, datetime): return o.isoformat() if isinstance(o, set):