Skip to content

Round current temperature#6954

Closed
aufano wants to merge 2 commits into
home-assistant:devfrom
aufano:dev
Closed

Round current temperature#6954
aufano wants to merge 2 commits into
home-assistant:devfrom
aufano:dev

Conversation

@aufano
Copy link
Copy Markdown
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
Copy Markdown

@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
Copy Markdown
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!

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

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
Copy Markdown
Member

fabaff commented Apr 6, 2017

How many decimal places did this variable show?

@balloob
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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