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

Avoid polling in the sensor #1652

Merged
merged 1 commit into from
Nov 14, 2020
Merged

Avoid polling in the sensor #1652

merged 1 commit into from
Nov 14, 2020

Conversation

bdraco
Copy link
Contributor

@bdraco bdraco commented Nov 14, 2020

Listen for the hacs/status status event instead

Listen for the hacs/status status event instead
async def async_added_to_hass(self) -> None:
"""Register for status events."""
self.async_on_remove(
self.hass.bus.async_listen("hacs/status", self._update_and_write_state)
Copy link
Member

Choose a reason for hiding this comment

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

This is overkill? that even is used too much
Currently, I don't think there are any good events for this, but in general, I like the idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ideally there would be a specific dispatch/event when repository changes pending_update status, but this seemed better than polling every 15 seconds since this effectively disappears from the profile in most cases:

Screen Shot 2020-11-14 at 9 19 54 AM

Copy link
Member

Choose a reason for hiding this comment

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

I want to add a task/job manager, that could create a separate event when done with the different tasks, but until then I guess status is fine 👍

@bdraco bdraco marked this pull request as ready for review November 14, 2020 19:56
@ludeeus ludeeus merged commit b678717 into hacs:main Nov 14, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Aug 27, 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.

2 participants