-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
Provide an individual color temperature range per Yeelight model #17305
Conversation
if self._min_mireds is None: | ||
model_specs = self._bulb.get_model_specs() | ||
self._min_mireds = kelvin_to_mired(model_specs['color_temp']['max']) | ||
self._max_mireds = kelvin_to_mired(model_specs['color_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.
line too long (84 > 79 characters)
@@ -306,6 +309,11 @@ def update(self) -> None: | |||
if self._bulb_device.bulb_type == yeelight.BulbType.Color: | |||
self._supported_features = SUPPORT_YEELIGHT_RGB | |||
|
|||
if self._min_mireds is None: | |||
model_specs = self._bulb.get_model_specs() | |||
self._min_mireds = kelvin_to_mired(model_specs['color_temp']['max']) |
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.
line too long (84 > 79 characters)
@@ -279,7 +282,7 @@ def _bulb(self) -> 'yeelight.Bulb': | |||
import yeelight | |||
if self._bulb_device is None: | |||
try: | |||
self._bulb_device = yeelight.Bulb(self._ipaddr) | |||
self._bulb_device = yeelight.Bulb(self._ipaddr, model=self._model) |
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.
line too long (82 > 79 characters)
I missed to update the requirements_all.txt. Will be fixed asap. |
@@ -46,6 +47,7 @@ | |||
vol.Optional(CONF_TRANSITION, default=DEFAULT_TRANSITION): cv.positive_int, | |||
vol.Optional(CONF_MODE_MUSIC, default=False): cv.boolean, | |||
vol.Optional(CONF_SAVE_ON_CHANGE, default=False): cv.boolean, | |||
vol.Optional(CONF_MODEL): cv.string, |
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.
Why would we add this? Also doesn't seem related to the PR description
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.
It's not possible to determine the yeelight model via the api. If you provide the model additional features can be enabled by the yeelight library: https://github.com/home-assistant/home-assistant/pull/17305/files#diff-1395165791bf7671502a6e2e7bd7d4cbR286
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't we get the library to just try calling different APIs to see what is available and determine model capabilities like that?
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.
In this case we would discover the device twice.
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 asked about a possibility for getting an extension for the api and the yeelight people were not at least completely against it: https://forum.yeelight.com/t/topic/7075/5 . At the moment that model information is only available either via mDNS or their custom SSDP (related home-assistant-libs/netdisco#193).
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.
Here is an idea: add config entries to Yeelight, add device info so we can store the device model in the registry and read that during setup.
You should adapt this to the newly introduced bulb type WhiteColor |
@quthla Does tie BulbType |
There's candle flicker and flash notify in the app but I'm not sure whether these are effects |
Please add config entries and device registry support next, so we don't have users needing to add their own models in their config |
|
||
# Not using hostname, as it seems to vary. | ||
name = "yeelight_%s_%s" % (device_type, | ||
name = "yeelight_%s_%s" % (legacy_device_type, |
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.
Use new style string formatting.
Description:
Related issue (if applicable): fixes #13785
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#5253
Example entry for
configuration.yaml
(if applicable):