-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
Fix torque degree char #26183
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run black from the project root:
black --fast homeassistant
|
||
temp_unit = data[key] | ||
if "\\xC2\\xB0" in temp_unit: | ||
temp_unit = temp_unit.replace("\\xC2\\xB0", "°") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it possible to solve this by applying the correct encoding at some point in the flow after receiving the request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check if the following would fix your issue:
units[pid] = data[key].decode("utf-8")
Do we have another suggestion or should we merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine, I think that's JSON encoding. Let's merge and see where it goes from there.
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:
tox
. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
python3 -m script.hassfest
.requirements_all.txt
by runningpython3 -m script.gen_requirements_all
..coveragerc
.If the code does not interact with devices: