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

Round current temperature #6954

Closed
wants to merge 2 commits into from
Closed

Round current temperature #6954

wants to merge 2 commits into from

Conversation

aufano
Copy link
Contributor

@aufano aufano commented Apr 6, 2017

Description:

Now the variable current_temperature is rounded.

Related issue (if applicable): fixes #

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>

Example entry for configuration.yaml (if applicable):

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

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

@homeassistant
Copy link
Contributor

Hi @aufano,

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!

@@ -83,7 +83,7 @@ def update_properties(self):

# Current Temp
if self.values.temperature:
self._current_temperature = self.values.temperature.data
self._current_temperature = (round((float(self.values.temperature.data)), 1))

Choose a reason for hiding this comment

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

line too long (89 > 79 characters)

@fabaff
Copy link
Member

fabaff commented Apr 6, 2017

How many decimal places did this variable show?

@balloob
Copy link
Member

balloob commented Apr 6, 2017

It's not up to platforms to round. Rounding is already done at the component level: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/climate/__init__.py#L415-L416

@balloob balloob closed this Apr 6, 2017
@aufano
Copy link
Contributor Author

aufano commented Apr 6, 2017

@fabaff @balloob Before my fix my temperatures in my Zwave Popp radiators actuators shows 17.649999618530273 in the current_temperature field, after my fix it show 17.65 all in Celsius.

@balloob
Copy link
Member

balloob commented Apr 6, 2017

The fix was in the wrong place. Data has to be rounded on the component level and not the platform level.

@aufano
Copy link
Contributor Author

aufano commented Apr 6, 2017

Ah ok!, I will fix the component level in #6960 thanks

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

7 participants