Skip to content

Fix plant MIN_TEMPERATURE, MAX_TEMPERATURE validation#7476

Merged
pvizeli merged 2 commits into
home-assistant:devfrom
frog32:patch-plant
May 7, 2017
Merged

Fix plant MIN_TEMPERATURE, MAX_TEMPERATURE validation#7476
pvizeli merged 2 commits into
home-assistant:devfrom
frog32:patch-plant

Conversation

@frog32
Copy link
Copy Markdown
Contributor

@frog32 frog32 commented May 7, 2017

small_float only allows values from 0 to 1 so we should use float instead

Description:

the plant component uses small_float validation for temperature. Small float only covers floats from 0 to 1.

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.

small_float only allows values from 0 to 1 so we should use float instead
@mention-bot
Copy link
Copy Markdown

@frog32, thanks for your PR! By analyzing the history of the files in this pull request, we identified @ChristianKuehnel and @fabaff to be potential reviewers.

@homeassistant
Copy link
Copy Markdown
Contributor

Hi @frog32,

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!

Comment thread homeassistant/components/plant.py Outdated
vol.Optional(CONF_MIN_TEMPERATURE): cv.small_float,
vol.Optional(CONF_MAX_TEMPERATURE): cv.small_float,
vol.Optional(CONF_MIN_TEMPERATURE): vol.All(vol.Coerce(float)),
vol.Optional(CONF_MAX_TEMPERATURE): vol.All(vol.Coerce(float)),
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare May 7, 2017

Choose a reason for hiding this comment

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

You don't need vol.All since there's only one validator.

@pvizeli pvizeli merged commit c1056ea into home-assistant:dev May 7, 2017
@pvizeli pvizeli added this to the 0.44.1 milestone May 7, 2017
@balloob
Copy link
Copy Markdown
Member

balloob commented May 7, 2017

Cherry-picked for 0.44.1

balloob pushed a commit that referenced this pull request May 7, 2017
* Fix plant MIN_TEMPERATURE, MAX_TEMPERATURE validation

small_float only allows values from 0 to 1 so we should use float instead

* Do not use vol.All for a single validation
@balloob balloob mentioned this pull request May 7, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Aug 12, 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.

7 participants