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

Move Kodi services from 'media_player' domain to 'kodi' #25753

Merged
merged 10 commits into from Aug 10, 2019

Conversation

@JeffLIrion
Copy link
Contributor

commented Aug 7, 2019

Breaking Change:

The media_player.kodi_* services are now kodi.*.

  • media_player.kodi_add_to_playlist is now kodi.add_to_playlist
  • media_player.kodi_call_method is now kodi.call_method

Description:

Move the Kodi services to their own domain.

Related issue (if applicable): fixes #

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#10081

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 user exposed functionality or configuration variables are added/changed:

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.
JeffLIrion added 2 commits Aug 7, 2019

@JeffLIrion JeffLIrion requested a review from armills as a code owner Aug 7, 2019

@project-bot project-bot bot added this to Needs review in Dev Aug 7, 2019

@ghost ghost assigned armills Aug 7, 2019

@ghost

This comment has been minimized.

Copy link

commented Aug 7, 2019

Hey there @armills, mind taking a look at this pull request as its been labeled with a integration (kodi) you are listed as a codeowner for? Thanks!

This is a automatic comment generated by codeowners-mention to help ensure issues and pull requests are seen by the right people.

@JeffLIrion JeffLIrion changed the title Move Kodi services from 'media_player' domain to 'kodi' [WIP] Move Kodi services from 'media_player' domain to 'kodi' Aug 7, 2019

@balloob
balloob approved these changes Aug 7, 2019

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

@balloob balloob added the docs-missing label Aug 7, 2019

@JeffLIrion

This comment has been minimized.

Copy link
Contributor Author

commented Aug 7, 2019

@balloob I think DOMAIN and DATA_KODI should be merged into one constant. Right?

JeffLIrion added 2 commits Aug 7, 2019
@amelchio

This comment has been minimized.

Copy link
Contributor

commented Aug 7, 2019

When doing this for sonos (#15089), it was decided that the registration should be in the component, not a platform.

I am not sure whether the rules have changed, maybe @balloob can clarify?

@JeffLIrion JeffLIrion referenced this pull request Aug 8, 2019
2 of 2 tasks complete

@JeffLIrion JeffLIrion closed this Aug 8, 2019

Dev automation moved this from Reviewer approved to Cancelled Aug 8, 2019

@JeffLIrion JeffLIrion reopened this Aug 8, 2019

Dev automation moved this from Cancelled to Needs review Aug 8, 2019

@JeffLIrion

This comment has been minimized.

Copy link
Contributor Author

commented Aug 8, 2019

Are there any additional changes that need to be made?

@balloob

This comment has been minimized.

Copy link
Member

commented Aug 8, 2019

@amelchio is right. We should register the services in __init__.py inside an async_setup

@JeffLIrion

This comment has been minimized.

Copy link
Contributor Author

commented Aug 8, 2019

@balloob I'm not familiar with the HA setup functions and what should go in __init__.py vs..media_player.py. Any chance we could merge this as is and a subsequent pull request could move the service registration to __init__.py?

@JeffLIrion JeffLIrion changed the title [WIP] Move Kodi services from 'media_player' domain to 'kodi' Move Kodi services from 'media_player' domain to 'kodi' Aug 8, 2019

@MartinHjelmare MartinHjelmare moved this from Needs review to Review in progress in Dev Aug 9, 2019

@balloob

This comment has been minimized.

Copy link
Member

commented Aug 9, 2019

We should only merge this PR if we do it right, so that future PRs will build on top of the right foundation.

It should be the exact same code, just be put inside async_setup. https://developers.home-assistant.io/docs/en/creating_component_index.html

@JeffLIrion

This comment has been minimized.

Copy link
Contributor Author

commented Aug 9, 2019

OK, I'll give it a shot.

If we register the services in __init__.py, won't those services show up even if the user only setup the Kodi notify component, not the media player component?

@balloob

This comment has been minimized.

Copy link
Member

commented Aug 10, 2019

Then we should guard that :)

@JeffLIrion

This comment has been minimized.

Copy link
Contributor Author

commented Aug 10, 2019

Then we should guard that :)

I checked this via:

from homeassistant.components.media_player.const import DOMAIN as MP_DOMAIN


async def async_setup(hass, config):
    """Set up the Kodi integration."""
    if any(
        ((CONF_PLATFORM, DOMAIN) in cfg.items() for cfg in config.get(MP_DOMAIN, []))
    ):
        # Register the Kodi media_player services

I tried it out and it only registers the services if there is a Kodi media player config entry. But if this is not the proper way to do it, let me know.

@@ -317,6 +317,8 @@ omit =
homeassistant/components/knx/*
homeassistant/components/knx/climate.py
homeassistant/components/knx/cover.py
homeassistant/components/kodi/__init__.py

This comment has been minimized.

Copy link
@balloob

balloob Aug 10, 2019

Member

You can mark it as kodi/*

@balloob

This comment has been minimized.

Copy link
Member

commented Aug 10, 2019

Great!

@balloob

This comment has been minimized.

Copy link
Member

commented Aug 10, 2019

Kodi is slowly growing up, soon we might be able to automatically discover it and set it up using a config flow?

@balloob balloob merged commit 68ee828 into home-assistant:dev Aug 10, 2019

11 checks passed

CI Build #20190810.45 succeeded
Details
CI (FullCheck Mypy) FullCheck Mypy succeeded
Details
CI (FullCheck Pylint) FullCheck Pylint succeeded
Details
CI (Overview CheckFormat) Overview CheckFormat succeeded
Details
CI (Overview Lint) Overview Lint succeeded
Details
CI (Overview Validate) Overview Validate succeeded
Details
CI (Tests PyTest Python36) Tests PyTest Python36 succeeded
Details
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
Details
cla-bot Everyone involved has signed the CLA
codecov/patch Coverage not affected when comparing 84f464d...b7a29bd
Details
codecov/project 94.04% (target 90%)
Details

Dev automation moved this from Review in progress to Done Aug 10, 2019

@JeffLIrion

This comment has been minimized.

Copy link
Contributor Author

commented Aug 11, 2019

Don't forget about the corresponding documentation pull request!

home-assistant/home-assistant.io#10081

@lock lock bot locked and limited conversation to collaborators Aug 12, 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.