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
Change Osram to use Github lightify dep #4256
Conversation
…tify/commits/master/osramlightify.py ) from Oct 2, 2016 and changed the REQUIRMENTS line to use the fixed lightify component with thread safety fixes
@tfriedel, thanks for your PR! By analyzing the history of the files in this pull request, we identified @olimpiurob, @tchellomello and @fabaff to be potential reviewers. |
@@ -19,7 +19,7 @@ | |||
SUPPORT_COLOR_TEMP, SUPPORT_RGB_COLOR, SUPPORT_TRANSITION, PLATFORM_SCHEMA) | |||
import homeassistant.helpers.config_validation as cv | |||
|
|||
REQUIREMENTS = ['lightify==1.0.3'] | |||
REQUIREMENTS = ['https://github.com/tfriedel/python-lightify/archive/master.zip#lightify==0.0.4'] |
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.
- 80: E501 line too long (97 > 79 characters)
|
||
if ATTR_TRANSITION in kwargs: | ||
fade = kwargs[ATTR_TRANSITION] * 10 | ||
transition = kwargs[ATTR_TRANSITION] * 10 | ||
_LOGGER.debug("turn_on requested transition time for light: %s is: %s ", |
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.
- 80: E501 line too long (84 > 79 characters)
else: | ||
fade = 0 | ||
transition = 0 | ||
_LOGGER.debug("turn_on requested transition time for light: %s is: %s ", |
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.
- 80: E501 line too long (84 > 79 characters)
|
||
if ATTR_BRIGHTNESS in kwargs: | ||
brightness = int(kwargs[ATTR_BRIGHTNESS] / 2.55) | ||
_LOGGER.debug("turn_on requested ATTR_RGB_COLOR for light: %s is: %s %s %s ", |
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.
- 80: E501 line too long (89 > 79 characters)
fade) | ||
|
||
self._light.set_luminance(brightness, fade) | ||
kelvin = int(((TEMP_MAX - TEMP_MIN) * (color_t - TEMP_MIN_HASS) / (TEMP_MAX_HASS - TEMP_MIN_HASS)) + TEMP_MIN) |
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.
- 80: E501 line too long (122 > 79 characters)
|
||
self._light.set_luminance(brightness, fade) | ||
kelvin = int(((TEMP_MAX - TEMP_MIN) * (color_t - TEMP_MIN_HASS) / (TEMP_MAX_HASS - TEMP_MIN_HASS)) + TEMP_MIN) | ||
_LOGGER.debug("turn_on requested set_temperature for light: %s: %s ", |
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.
- 80: E501 line too long (81 > 79 characters)
self._brightness = kwargs[ATTR_BRIGHTNESS] | ||
_LOGGER.debug("turn_on requested brightness for light: %s is: %s ", | ||
self._light.name, self._brightness) | ||
self._brightness = self._light.set_luminance(int(self._brightness / 2.55), transition) |
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.
- 80: E501 line too long (98 > 79 characters)
random.randrange(0, 255), | ||
random.randrange(0, 255), | ||
transition) | ||
_LOGGER.debug("turn_on requested random effect for light: %s with transition %s ", |
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.
- 80: E501 line too long (98 > 79 characters)
if ATTR_TRANSITION in kwargs: | ||
fade = kwargs[ATTR_TRANSITION] * 10 | ||
transition = kwargs[ATTR_TRANSITION] * 10 | ||
_LOGGER.debug("turn_off requested transition time for light: %s is: %s ", |
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.
- 80: E501 line too long (85 > 79 characters)
fade = 0 | ||
self._light.set_luminance(0, fade) | ||
transition = 0 | ||
_LOGGER.debug("turn_off requested transition time for light: %s is: %s ", |
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.
- 80: E501 line too long (85 > 79 characters)
|
||
if ATTR_COLOR_TEMP in kwargs: | ||
color_t = kwargs[ATTR_COLOR_TEMP] | ||
kelvin = int(((TEMP_MAX - TEMP_MIN) * (color_t - TEMP_MIN_HASS) / | ||
(TEMP_MAX_HASS - TEMP_MIN_HASS)) + TEMP_MIN) | ||
self._light.set_temperature(kelvin, fade) | ||
(TEMP_MAX_HASS - TEMP_MIN_HASS)) + TEMP_MIN) |
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.
- 17: E128 continuation line under-indented for visual indent
What is the benefit from switching to your lib instead of a lib published on PyPi? |
See this thread Paulus Schoutsen notifications@github.com schrieb am Mo., 7. Nov. 2016,
|
I have been using this version for some time already and it is very stable and working fine. Thanks for your PR @tfriedel |
@@ -19,7 +19,8 @@ | |||
SUPPORT_COLOR_TEMP, SUPPORT_RGB_COLOR, SUPPORT_TRANSITION, PLATFORM_SCHEMA) | |||
import homeassistant.helpers.config_validation as cv | |||
|
|||
REQUIREMENTS = ['lightify==1.0.3'] | |||
REQUIREMENTS = ['https://github.com/tfriedel/python-lightify/archive/' | |||
'master.zip#lightify==0.0.4'] |
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 don't point it at the master branch but at the zip of a specific commit.
You also need to specify the exact version number as is contained in the zip, so I think 1.0.4 ?
@@ -101,6 +104,9 @@ def name(self): | |||
@property | |||
def rgb_color(self): | |||
"""Last RGB color value set.""" | |||
_LOGGER.debug("rgb_color light state for light: %s is: %s %s %s ", | |||
self._light.name(), self._light.red(), | |||
self._light.green(), self._light.blue()) | |||
return self._light.rgb() |
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.
We should not make any requests to lights in properties. Instead, all access has to be moved to the update
method and data should be stored in instance variables.
|
||
@property | ||
def is_on(self): | ||
"""Update Status to True if device is on.""" | ||
self.update_lights() | ||
self.update() |
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.
Home Assistant will take care of calling update
. You cannot do any I/O inside properties.
@@ -223,6 +223,9 @@ https://github.com/robbiet480/pygtfs/archive/00546724e4bbcb3053110d844ca44e22462 | |||
# homeassistant.components.scene.hunterdouglas_powerview | |||
https://github.com/sander76/powerviewApi/archive/246e782d60d5c0addcc98d7899a0186f9d5640b0.zip#powerviewApi==0.3.15 | |||
|
|||
# homeassistant.components.light.osramlightify | |||
https://github.com/tfriedel/python-lightify/archive/master.zip#lightify==0.0.4 |
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 not in sync anymore with the platform requirement.
Looks good! 🐬 |
Description:
Related issue (if applicable): fixes #3089
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:
tox
run successfully. Your PR cannot be merged unless tests passREQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices:
tox
run successfully. Your PR cannot be merged unless tests pass…tify/commits/master/osramlightify.py ) from Oct 2, 2016 and changed the REQUIRMENTS line to use the fixed lightify component with thread safety fixes