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

Fix torque degree char #26183

Merged
merged 3 commits into from Sep 18, 2019

Conversation

@roblandry
Copy link
Contributor

commented Aug 24, 2019

Breaking Change:

None

Description:

When sensors are added to home-assistant, those with degree symbols are shown as \\xC2\\xB0 instead of °. This PR corrects the symbol.

Related issue (if applicable):
None. Created a PR instead of issue. :-)

Pull request with documentation for home-assistant.io (if applicable):
None

Example entry for configuration.yaml (if applicable):

Nothing changes

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

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

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.
roblandry added 2 commits Aug 24, 2019
Copy link
Member

left a comment

Please run black from the project root:

black --fast homeassistant
Dev automation moved this from Needs review to Review in progress Aug 31, 2019
@roblandry roblandry requested a review from MartinHjelmare Sep 9, 2019

temp_unit = data[key]
if "\\xC2\\xB0" in temp_unit:
temp_unit = temp_unit.replace("\\xC2\\xB0", "°")

This comment has been minimized.

Copy link
@MartinHjelmare

MartinHjelmare Sep 11, 2019

Member

Isn't it possible to solve this by applying the correct encoding at some point in the flow after receiving the request?

This comment has been minimized.

Copy link
@roblandry

roblandry Sep 11, 2019

Author Contributor

To be honest, I am not a proficient python coder, and this was the only way i was able to correct the units. The posted url is a query string with these characters. Seeing as how this was left effectively broken, I tinkered until I found a working solution. I'm all ears if you have a cleaner solution.

This comment has been minimized.

Copy link
@tsvi

tsvi Sep 16, 2019

Contributor

Can you check if the following would fix your issue:

units[pid] = data[key].decode("utf-8")
@project-bot project-bot bot moved this from Review in progress to Second opinion wanted in Dev Sep 12, 2019
@MartinHjelmare

This comment has been minimized.

Copy link
Member

commented Sep 12, 2019

Do we have another suggestion or should we merge?

@MartinHjelmare MartinHjelmare changed the title Torque degree char fix Fix torque degree char Sep 14, 2019
Copy link
Member

left a comment

This is fine, I think that's JSON encoding. Let's merge and see where it goes from there.

@balloob balloob merged commit 873d331 into home-assistant:dev Sep 18, 2019
12 checks passed
12 checks passed
CI Build #20190909.26 succeeded
Details
CI (FullCheck Mypy) FullCheck Mypy succeeded
Details
CI (FullCheck Pylint) FullCheck Pylint succeeded
Details
CI (Overview CheckFormat) Overview CheckFormat succeeded
Details
CI (Overview Lint) Overview Lint succeeded
Details
CI (Overview Validate) Overview Validate succeeded
Details
CI (Tests PyTest Python36) Tests PyTest Python36 succeeded
Details
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
Details
cla-bot Everyone involved has signed the CLA
codecov/patch Coverage not affected when comparing 691e3f6...2c0c13a
Details
codecov/project 94.01% (target 90%)
Details
docs-missing Documentation ok.
Dev automation moved this from Second opinion wanted to Done Sep 18, 2019
@lock lock bot locked and limited conversation to collaborators Sep 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
5 participants
You can’t perform that action at this time.