Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON cannot serialize an EntryInfo containing a datetime #101

Open
AixNPanes opened this issue Jun 29, 2023 · 0 comments
Open

JSON cannot serialize an EntryInfo containing a datetime #101

AixNPanes opened this issue Jun 29, 2023 · 0 comments

Comments

@AixNPanes
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant