Skip to content

Allow scene configs to be merged#6815

Closed
Chris-V wants to merge 1 commit into
home-assistant:devfrom
Chris-V:merge_scene_configs
Closed

Allow scene configs to be merged#6815
Chris-V wants to merge 1 commit into
home-assistant:devfrom
Chris-V:merge_scene_configs

Conversation

@Chris-V
Copy link
Copy Markdown
Contributor

@Chris-V Chris-V commented Mar 27, 2017

Description:

It is currently not possible to use scenes inside packages. This PR adds a PLATFORM_SCHEMA field to scene/__init__.py so that it can be analysed and merged on boot. Existing tests still pass locally.

Related issue (if applicable): fixes #6641

Example entry for configuration.yaml (if applicable):

Scenes configuration stays the same as defined in https://home-assistant.io/components/scene/

Checklist:

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. Your PR cannot be merged unless tests pass
  • 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.

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

@mention-bot
Copy link
Copy Markdown

@Chris-V, thanks for your PR! By analyzing the history of the files in this pull request, we identified @sander76, @pvizeli and @fabaff to be potential reviewers.

@homeassistant
Copy link
Copy Markdown
Contributor

Hi @Chris-V,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!


PLATFORM_SCHEMA = vol.Schema({
vol.Required(CONF_NAME): cv.string,
vol.Required(CONF_ENTITIES): cv.ordered_dict(cv.match_all, cv.entity_id),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure about the match_all values here. As opposed to no schema validations I guess it's not that bad, but it could be improved I guess.

Copy link
Copy Markdown
Member

@pvizeli pvizeli left a comment

Choose a reason for hiding this comment

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

You add the platfrom schema from default platform homeassistant into component. I don't think that will be correct for other platform too and they have no unittests. So you pass all test but I don't think that will be pass into real world. Mybe @balloob have a better view over all platform. You need also extend it from helper/config_validator and move that to platform self.

@MartinHjelmare
Copy link
Copy Markdown
Member

I added config validation for scenes for a closed PR. I think that is the correct way. You can copy that if you like:
MartinHjelmare@416031f

@Chris-V
Copy link
Copy Markdown
Contributor Author

Chris-V commented Mar 28, 2017

Nice work and thanks a lot! I had very limited time this week to look at this :)

I can cherry-pick your commit in this branch or you can open another PR. This way credit is given where credit is due ;)

@MartinHjelmare
Copy link
Copy Markdown
Member

@Chris-V
Thanks. I've opened a PR with my rebased commit. If you can test the PR to make sure that scenes can be used with packages, that would be great.

@home-assistant home-assistant locked and limited conversation to collaborators Jul 17, 2017
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.

Can't define scene in multiple packages?

6 participants