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

Use voluptuous for system monitoring sensors #2813

Merged
merged 3 commits into from
Aug 19, 2016
Merged

Use voluptuous for system monitoring sensors #2813

merged 3 commits into from
Aug 19, 2016

Conversation

fabaff
Copy link
Member

@fabaff fabaff commented Aug 13, 2016

Description:

Related issue (if applicable): fixes 127528299

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

Example entry for configuration.yaml (if applicable):

Checklist:

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

If code communicates with devices, web services, or a:

  • 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.

PLATFORM_SCHEMA = vol.Schema({
vol.Required(CONF_PLATFORM): 'systemmonitor',
vol.Required(CONF_RESOURCES, default=[]): vol.All(cv.ensure_list,
[vol.All(vol.Schema({

Choose a reason for hiding this comment

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

farcy v1.1

  • 9: E128 continuation line under-indented for visual indent

Copy link
Member

Choose a reason for hiding this comment

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

There is no reason for a vol.All if you only pass in 1 argument.

@balloob
Copy link
Member

balloob commented Aug 13, 2016

Here a few guidelines that we should keep in mind when writing voluptuous:

  • import PLATFORM_SCHEMA from parent component and extend it.
  • Do not overwrite platform key because of a bug
  • Preferred order is Required first, then Optional.

@fabaff fabaff mentioned this pull request Aug 15, 2016
@@ -36,33 +38,34 @@
'process_sleeping': ['Sleeping', None]
}

PLATFORM_SCHEMA = vol.Schema({
Copy link
Member

Choose a reason for hiding this comment

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

Extend ?

@fabaff fabaff closed this Aug 19, 2016
@fabaff fabaff reopened this Aug 19, 2016
@fabaff fabaff merged commit 4f1712c into home-assistant:dev Aug 19, 2016
@fabaff fabaff deleted the voluptuous-sensors4 branch August 19, 2016 12:57
@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants