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

Make reproduce state use platform instead of rely on function #25856

Merged
merged 3 commits into from Aug 12, 2019

Conversation

@balloob
Copy link
Member

commented Aug 10, 2019

Description:

To make reproduce_state easier to add to all entity integrations, remove the requirement that the integration needs to implemenet async_reproduce_states in __init__.py, but instead import the platform reproduce_state. This means we don't have to refactor each integration to move constants to a separate file.

We do a similar approach for config flows.

Related issue (if applicable): helps with implementing #25681

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.
@probot-home-assistant

This comment has been minimized.

Copy link

commented Aug 10, 2019

Hey there @home-assistant/core, mind taking a look at this pull request as its been labeled with a integration (group) you are listed as a codeowner for? Thanks!

@balloob balloob force-pushed the reproduce-state-platform-based branch from d053269 to c9bc007 Aug 11, 2019

@balloob balloob referenced this pull request Aug 11, 2019
5 of 5 tasks complete

Dev automation moved this from Needs review to Reviewer approved Aug 11, 2019

await component.async_reproduce_states(data, context=context)
async def worker(domain: str, states_by_domain: List[State]) -> None:
try:
component = await async_get_integration(hass, domain)

This comment has been minimized.

Copy link
@MartinHjelmare

MartinHjelmare Aug 11, 2019

Member
integration = await async_get_integration(hass, domain)
@elupus
elupus approved these changes Aug 11, 2019
Copy link
Contributor

left a comment

Seems nice. Avoids some potential cyclic import problems.

@balloob balloob merged commit cf90e49 into dev Aug 12, 2019

1 check passed

cla-bot Everyone involved has signed the CLA

Dev automation moved this from Reviewer approved to Done Aug 12, 2019

@delete-merged-branch delete-merged-branch bot deleted the reproduce-state-platform-based branch Aug 12, 2019

@lock lock bot locked and limited conversation to collaborators Aug 13, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.