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

Catch error if input_datetime state is incorrect #10237

Merged
merged 2 commits into from
Oct 22, 2021

Conversation

bramkragten
Copy link
Member

@bramkragten bramkragten commented Oct 11, 2021

Proposed change

Apparently the attributes can be missing...

Fixes home-assistant/core#57401

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@balloob
Copy link
Member

balloob commented Oct 20, 2021

The attributes can't miss: https://github.com/home-assistant/core/blob/dev/homeassistant/components/input_datetime/__init__.py#L347-L351

I think that the right approach is to expose those has_time and has_date as capability_attributes in core, such that they are also restored when an input-datetime with a unique ID is removed without cleaning up the entity registry.

@balloob
Copy link
Member

balloob commented Oct 20, 2021

Core PR home-assistant/core#58138

@bramkragten
Copy link
Member Author

The issue here was that the entity was actually removed from home assistant, so all attributes where missing...

@balloob
Copy link
Member

balloob commented Oct 21, 2021

If the entity is removed, it is restored from the entity registry. The capability attributes are part of that restored entity.

@balloob balloob merged commit 05711b4 into dev Oct 22, 2021
@balloob balloob deleted the catch-invalid-input-date-time branch October 22, 2021 16:47
@github-actions github-actions bot locked and limited conversation to collaborators Oct 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

History not showing data since 10.2
3 participants