Fix #6534#6598
Merged
Merged
Conversation
Makes sure 0 is not passes to `color_temperature_kelvin_to_mired`.
MartinHjelmare
requested changes
Mar 13, 2017
Member
MartinHjelmare
left a comment
There was a problem hiding this comment.
Is it ok to leave self._temperature not updated when o_temp is 0?
| self._rgb = self._light.rgb() | ||
| o_temp = self._light.temp() | ||
| self._temperature = color_temperature_kelvin_to_mired(o_temp) | ||
| if o_temp is not 0: |
Member
There was a problem hiding this comment.
Please use != instead of is not when comparing integers.
Contributor
Author
|
I tried to test it, by setting the temperature slider in the webfrontent
to the lowest possible position. Without the if clause, I was seeing an
error message, that told me, that 0 is not allowed. After adding this, I
was able to set the slider all the way down.
I couldn't fully test it though, because for my lights I didn't have the
problem anyways. I could not reproduce the original error, so if one of
the people with the original error could check this works, this would be
awesome.
Also I'm currently missing the developer tools in the web fronted and so
its a bit difficult to test.
…On 13.03.2017 22:36, Martin Hjelmare wrote:
***@***.**** requested changes on this pull request.
Is it ok to leave |self._temperature| not updated when |o_temp| is 0?
------------------------------------------------------------------------
In homeassistant/components/light/osramlightify.py
<#6598 (comment)>:
> @@ -215,5 +215,6 @@ def update(self):
self._name = self._light.name()
self._rgb = self._light.rgb()
o_temp = self._light.temp()
- self._temperature = color_temperature_kelvin_to_mired(o_temp)
+ if o_temp is not 0:
Please use |!=| instead of |is not| when comparing integers.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#6598 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFL2NFQPUrVL_XclA22r_4gNvoDSYxKtks5rlbbogaJpZM4Mbyaf>.
|
deisi
commented
Mar 14, 2017
| self._rgb = self._light.rgb() | ||
| o_temp = self._light.temp() | ||
| self._temperature = color_temperature_kelvin_to_mired(o_temp) | ||
| if o_temp is not 0: |
Member
|
Made a tweak for @MartinHjelmare comment. It will now set temperature to 0 when it is absent so that Home Assistant won't report this. @Photo64 can you test this too? |
MartinHjelmare
approved these changes
Mar 15, 2017
|
I updated the code in my osramlightify.py file and can confirm this also is working. |
Member
|
Cherry picked for 0.40.1 |
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes sure 0 is not passes to
color_temperature_kelvin_to_mired.I think we should make a hot-fix out of it, because it effects core functionality for quite some people.
Description:
Related issue (if applicable): fixes #6534
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:
toxrun successfully. Your PR cannot be merged unless tests passREQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.If the code does not interact with devices:
toxrun successfully. Your PR cannot be merged unless tests pass