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

Code quality improvements based on core feedback #385

Merged
merged 11 commits into from
Feb 19, 2021

Conversation

iMicknl
Copy link
Owner

@iMicknl iMicknl commented Feb 14, 2021

No description provided.

@github-actions github-actions bot added the enhancement New feature or request label Feb 14, 2021
update_interval = entry.options.get(CONF_UPDATE_INTERVAL, DEFAULT_UPDATE_INTERVAL)
update_interval = timedelta(
seconds=entry.options.get(CONF_UPDATE_INTERVAL, DEFAULT_UPDATE_INTERVAL)
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why change this?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I had to move the following debug from our init method in the Data Update Coordinator. Moving up the timedelta made it easier to reuse this variable for the DataUpdateCoordinator and debug logging.

_LOGGER.debug(
        "Initialized DataUpdateCoordinator with %s interval.", str(update_interval)
    )

default=self.options.get(CONF_UPDATE_INTERVAL),
default=self.config_entry.options.get(
CONF_UPDATE_INTERVAL, DEFAULT_UPDATE_INTERVAL
),
Copy link
Collaborator

Choose a reason for hiding this comment

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

What’s the difference?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Fallback to DEFAULT_UPDATE_INTERVAL, instead of setting that in the constructor.

@iMicknl iMicknl merged commit 744f920 into master Feb 19, 2021
@iMicknl iMicknl deleted the enhancement/code_quality_improvements branch February 19, 2021 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants