Skip to content

Move several local services to their right domain#11677

Merged
balloob merged 2 commits into
home-assistant:devfrom
amelchio:rename-local-services
Jan 15, 2018
Merged

Move several local services to their right domain#11677
balloob merged 2 commits into
home-assistant:devfrom
amelchio:rename-local-services

Conversation

@amelchio
Copy link
Copy Markdown
Contributor

@amelchio amelchio commented Jan 15, 2018

Description:

Since #11479 we try to load services.yaml based on the domain of registered services. This has now revealed several platforms that register services outside their own domain, causing an exception during the services.yaml loading.

This PR renames the services to follow the usual convention of keeping the domain and prepending the platform to the service name:

todoist.new_task -> calendar.todoist_new_task

snapcast.snapcast_snapshot -> media_player.snapcast_snapshot
snapcast.snapcast_restore -> media_player.snapcast_restore

mopar.remote_command -> sensor.mopar_remote_command

broadlink.learn_command_192_168_0_107 -> switch.broadlink_learn_command_192_168_0_107
broadlink.send_packet_192_168_0_107 -> switch.broadlink_send_packet_192_168_0_107

The affected platforms were located with this command:

git grep -l 'register(' homeassistant/components/*/[a-z]*.py | xargs grep 'DOMAIN = '

I do not use any of these platforms so this is currently completely untested.

Related issue (if applicable): fixes #11654

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#4424

Checklist:

  • The code change is tested and works locally.

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

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

  • Local tests with tox run successfully.
  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

from homeassistant.util import Throttle
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
from homeassistant.components.switch import (SwitchDevice, DOMAIN,
PLATFORM_SCHEMA)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

continuation line under-indented for visual indent

@balloob balloob merged commit 8753469 into home-assistant:dev Jan 15, 2018
balloob pushed a commit that referenced this pull request Jan 16, 2018
* Move several local services to their right domain

* Fix lint
@balloob balloob mentioned this pull request Jan 16, 2018
@home-assistant home-assistant locked and limited conversation to collaborators May 29, 2018
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.

AttributeError: 'NoneType' object has no attribute '__file__'

6 participants