Skip to content

JSON cannot serialize an EntryInfo containing a datetime #101

Open
@AixNPanes

Description

@AixNPanes

Is your feature request related to a problem? Please describe.
If _state_helper is called on a class which extends EntityInfo which contains a datetime member, the following error results:
TypeError: Object of type datetime is not JSON serializable

Describe the solution you'd like
changing the json.dumps at approximately line 771 in init.py in the write_config method from
config_message = json.dumps(self.generate_config())
to
config_message = json.dumps(self.generate_config(), default=str)
fixes the problem

Describe alternatives you've considered
Changing the EntityInfo to remove or change the datetime, this is not ideal as conversion is required for comparison

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions