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

Add event entities to Overseerr #134975

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

joostlek
Copy link
Member

@joostlek joostlek commented Jan 7, 2025

Proposed change

Add event entities to Overseerr

Type of change

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

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

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

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@joostlek joostlek marked this pull request as ready for review January 7, 2025 11:40
'\\",\\"commentedBy_settings_discordId\\":\\"{{commentedBy_settings_di'
'scordId}}\\",\\"commentedBy_settings_telegramChatId\\":\\"{{commented'
'By_settings_telegramChatId}}\\"},\\"{{extra}}\\":[]\\n}"'
'"{\\"notification_type\\":\\"{{notification_type}}\\",\\"subject\\":\\"{{subject}'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the payload has changed to use snake_case for the keys

Comment on lines +82 to +91
@callback
def _handle_coordinator_update(self) -> None:
if super().available != self._attr_available:
self._attr_available = super().available
super()._handle_coordinator_update()

@property
def available(self) -> bool:
"""Return True if entity is available."""
return self._attr_available
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this logic is to make sure we don't do unnecessary state writes. Because the entity is inheriting the coordinator entity, it would write state at every coordinator update. But I don't want to update state at every coordinator update. With this logic in place I only want to listen to if the coordinator went unavailable with that update, and if that is the case, go unavailable for the event entity as well.

This makes the user experience a bit more consistent as I don't have reasons to believe that the API is flaky, so the moments we can't fetch data is most likely due to the service being down and when that happens we obviously don't get any webhook calls from the service.

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

Successfully merging this pull request may close these issues.

2 participants