8000 Separate climate platform and presentation units by rcloran · Pull Request #3755 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Separate climate platform and presentation units #3755

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

Merged
merged 5 commits into from
Oct 11, 2016
Merged

Separate climate platform and presentation units #3755

merged 5 commits into from
Oct 11, 2016

Conversation

rcloran
Copy link
Contributor
@rcloran rcloran commented Oct 8, 2016

Description: The unit_of_measurement method in the climate component has an overloaded meaning. Firstly, the rest of home-assistant uses it as the unit that should be displayed to the user. Secondly, platforms in the climate component use it to represent the unit used by the backing system, and have to implement it, as it raises a NotImplementedError otherwise.

This overload of meanings means that values are converted to the user's desired display unit, but the string which is appended for display is the unit used by the platform (often times not configurable).

This splits the two meanings into two separate attributes.

Related issue (if applicable): fixes #3445

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

return self.hass.config.units.temperature_unit

@property
def _platform_unit_of_measurement(self):

Choose a reason for hiding this comment

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

farcy v1.1

  • D400: First line should end with a period (not 'm')

@rcloran
Copy link
Contributor Author
rcloran commented Oct 8, 2016

Hrm. set_temperature needs similar treatment. It's now broken (in a different way to what it was before, as far as I can tell).

@justweb1
Copy link
Contributor
justweb1 commented Oct 8, 2016

@turbokongen did the backend for this and I worked on the polymer side of it.

@balloob
Copy link
Member
balloob commented Oct 8, 2016

Related issue: #3605

Copy link
Member
@balloob balloob left a comment

Choose a reason for hiding this comment

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

Great work 🐬 ! This is good to go once the property is renamed (which will solve the linting issue too)

return self.hass.config.units.temperature_unit

@property
def _platform_unit_of_measurement(self):
Copy link
Member
@balloob balloob Oct 9, 2016

Choose a reason for hiding this comment

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

Can you rename this to temperature_unit?

@balloob balloob merged commit 7c2cb6c into home-assistant:dev Oct 11, 2016
@balloob
Copy link
Member
balloob commented Oct 11, 2016

🐬 🍺

@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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nest thermostat displaying Celsius despite imperial chosen in configuration.yaml
5 participants
0