Skip to content

Fix #6534#6598

Merged
balloob merged 3 commits into
home-assistant:devfrom
deisi:fix_6534
Mar 16, 2017
Merged

Fix #6534#6598
balloob merged 3 commits into
home-assistant:devfrom
deisi:fix_6534

Conversation

@deisi
Copy link
Copy Markdown
Contributor

@deisi deisi commented Mar 13, 2017

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:

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

Makes sure 0 is not passes to `color_temperature_kelvin_to_mired`.
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

Please use != instead of is not when comparing integers.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@deisi
Copy link
Copy Markdown
Contributor Author

deisi commented Mar 14, 2017 via email

Copy link
Copy Markdown
Contributor Author

@deisi deisi left a comment

Choose a reason for hiding this comment

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

@Photo64 tested it with his setup as well and he reports it to work.

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:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@balloob balloob added this to the 0.40.1 milestone Mar 15, 2017
@balloob
Copy link
Copy Markdown
Member

balloob commented Mar 15, 2017

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?

@Photo64
Copy link
Copy Markdown

Photo64 commented Mar 15, 2017

I updated the code in my osramlightify.py file and can confirm this also is working.

@balloob balloob merged commit 5b3dc7f into home-assistant:dev Mar 16, 2017
@balloob
Copy link
Copy Markdown
Member

balloob commented Mar 16, 2017

Cherry picked for 0.40.1

balloob pushed a commit that referenced this pull request Mar 16, 2017
* Fix #6534

Makes sure 0 is not passes to `color_temperature_kelvin_to_mired`.

* Update osramlightify.py

* Update osramlightify.py
@balloob balloob mentioned this pull request Mar 16, 2017
@balloob balloob mentioned this pull request Mar 24, 2017
@deisi deisi deleted the fix_6534 branch May 22, 2017 18:40
@home-assistant home-assistant locked and limited conversation to collaborators Sep 4, 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.

Osram Lightify component error with .40

7 participants