Fix to prevent Azure Data Explorer JSON serialization from failing (#122300)

This commit is contained in:
Marcel Vriend 2024-07-21 14:08:58 +02:00 committed by GitHub
parent 48661054d9
commit 0ab1ccc5ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,7 +18,7 @@ from homeassistant.core import Event, HomeAssistant, State
from homeassistant.exceptions import ConfigEntryError from homeassistant.exceptions import ConfigEntryError
from homeassistant.helpers.entityfilter import FILTER_SCHEMA from homeassistant.helpers.entityfilter import FILTER_SCHEMA
from homeassistant.helpers.event import async_call_later from homeassistant.helpers.event import async_call_later
from homeassistant.helpers.json import JSONEncoder from homeassistant.helpers.json import ExtendedJSONEncoder
from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.typing import ConfigType
from homeassistant.util.dt import utcnow from homeassistant.util.dt import utcnow
@ -203,9 +203,7 @@ class AzureDataExplorer:
return None, dropped return None, dropped
if (utcnow() - time_fired).seconds > DEFAULT_MAX_DELAY + self._send_interval: if (utcnow() - time_fired).seconds > DEFAULT_MAX_DELAY + self._send_interval:
return None, dropped + 1 return None, dropped + 1
if "\n" in state.state:
return None, dropped + 1
json_event = json.dumps(obj=state, cls=JSONEncoder) json_event = json.dumps(obj=state, cls=ExtendedJSONEncoder)
return (json_event, dropped) return (json_event, dropped)