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
Added Ledenet protocol support to flux_led #5097
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,15 +10,15 @@ | |
|
||
import voluptuous as vol | ||
|
||
from homeassistant.const import CONF_DEVICES, CONF_NAME | ||
from homeassistant.const import CONF_DEVICES, CONF_NAME, CONF_PROTOCOL | ||
from homeassistant.components.light import ( | ||
ATTR_BRIGHTNESS, ATTR_RGB_COLOR, ATTR_EFFECT, EFFECT_RANDOM, | ||
SUPPORT_BRIGHTNESS, SUPPORT_EFFECT, SUPPORT_RGB_COLOR, Light, | ||
PLATFORM_SCHEMA) | ||
import homeassistant.helpers.config_validation as cv | ||
|
||
REQUIREMENTS = ['https://github.com/Danielhiversen/flux_led/archive/0.10.zip' | ||
'#flux_led==0.10'] | ||
REQUIREMENTS = ['https://github.com/Danielhiversen/flux_led/archive/0.11.zip' | ||
'#flux_led==0.11'] | ||
|
||
_LOGGER = logging.getLogger(__name__) | ||
|
||
|
@@ -34,6 +34,8 @@ | |
vol.Optional(CONF_NAME): cv.string, | ||
vol.Optional(ATTR_MODE, default='rgbw'): | ||
vol.All(cv.string, vol.In(['rgbw', 'rgb'])), | ||
vol.Optional(CONF_PROTOCOL, default=None): | ||
vol.All(cv.string, vol.In(['ledenet'])), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bah2830 : You have to change the library to support lower case. https://github.com/Danielhiversen/flux_led/blob/master/flux_led/__init__.py#L642 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The setprotocol method of the library uppers everything so this will work There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, i see |
||
}) | ||
|
||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ | ||
|
@@ -51,6 +53,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): | |
device = {} | ||
device['name'] = device_config[CONF_NAME] | ||
device['ipaddr'] = ipaddr | ||
device[CONF_PROTOCOL] = device_config[CONF_PROTOCOL] | ||
device[ATTR_MODE] = device_config[ATTR_MODE] | ||
light = FluxLight(device) | ||
if light.is_valid: | ||
|
@@ -87,11 +90,14 @@ def __init__(self, device): | |
|
||
self._name = device['name'] | ||
self._ipaddr = device['ipaddr'] | ||
self._protocol = device[CONF_PROTOCOL] | ||
self._mode = device[ATTR_MODE] | ||
self.is_valid = True | ||
self._bulb = None | ||
try: | ||
self._bulb = flux_led.WifiLedBulb(self._ipaddr) | ||
if self._protocol: | ||
self._bulb.setProtocol(self._protocol) | ||
except socket.error: | ||
self.is_valid = False | ||
_LOGGER.error( | ||
|
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.
If the changes to add LEDENET protocol to flux_led pypi package allow for controlling all five channels (RGBWW), we need to consider adding RGBWW as a mode in the near future. For now, let's just get LEDENET added in working condition and stable for all users.
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.
I agree. I need to get a true RGBWW light to test it with though. Most are just RGB(warm)W and not actually a 5th channel for the fancy white hue changing leds.