mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-22 16:56:50 +00:00
Add config flow to yeelight (#13948)
Co-authored-by: Florian Gareis <TheZoker@users.noreply.github.com> Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
6d12d6f27e
commit
8a42bda8a5
@ -5,49 +5,78 @@ ha_category:
|
||||
- Light
|
||||
ha_release: 0.32
|
||||
ha_iot_class: Local Polling
|
||||
ha_config_flow: true
|
||||
ha_codeowners:
|
||||
- '@rytilahti'
|
||||
- '@zewelor'
|
||||
- '@shenxn'
|
||||
ha_domain: yeelight
|
||||
---
|
||||
|
||||
The `yeelight` integration allows you to control your Yeelight Wi-Fi bulbs with Home Assistant. There are two possible methods for configuration of the Yeelight: Manual or Automatic.
|
||||
The `yeelight` integration allows you to control your Yeelight Wi-Fi bulbs with Home Assistant.
|
||||
|
||||
There is currently support for the following device types within Home Assistant:
|
||||
There is support for the following device types within Home Assistant:
|
||||
|
||||
- **Light** - The Yeelight platform for supporting lights.
|
||||
- **Sensor** - The Yeelight platform for supporting sensors. Currently only nightlight mode sensor, for ceiling lights.
|
||||
- **Binary Sensor** - The Yeelight platform for supporting binary sensors. Currently, only nightlight mode sensor for ceiling lights.
|
||||
|
||||
## Example configuration (Automatic)
|
||||
## Configuration
|
||||
|
||||
After the lights are connected to the Wi-Fi network and have been detected in Home Assistant, the discovered names will be shown in the `Light` section of the `Overview` view. Add the following lines to your `customize.yaml` file:
|
||||
To set up this integration, go to **Integrations** under **Configuration** and find Yeelight in the `+` menu. You can leave the IP address field empty to set up discovered devices. To configure the devices, use the "Options" button in the integration card.
|
||||
|
||||
### Custom effects
|
||||
|
||||
Custom effects can only be set up through YAML configuration. To turn on the effect you can use [light.turn_on](/integrations/light/#service-lightturn_on) service.
|
||||
|
||||
Possible transitions are `RGBTransition`, `HSVTransition`, `TemperatureTransition`, `SleepTransition`.
|
||||
|
||||
Where the array values are as per the following:
|
||||
|
||||
- RGBTransition: [red, green, blue, duration, brightness] with red/green/blue being an number between 0 and 255, the duration being in milliseconds (with a minimum of 50) and the final brightness to transition to 1-100 (%).
|
||||
- HSVTransition: [hue, saturation, duration, brightness] with hue being an number between 0 and 359, saturation 0 -100, the duration in milliseconds (with a minimum of 50) and the final brightness 1-100 (%).
|
||||
- TemperatureTransition: [temp, duration, brightness] with temp being the final color temperature between 1700 and 6500, the duration in milliseconds (with a minimum of 50) and the final brightness to transition to 1-100 (%).
|
||||
- SleepTransition: [duration] with duration being an number for the effect time in milliseconds (with a minimum of 50).
|
||||
|
||||
More info about transitions and their expected parameters can be found in [python-yeelight documentation](https://yeelight.readthedocs.io/en/stable/flow.html).
|
||||
|
||||
```yaml
|
||||
# Example customize.yaml entry
|
||||
light.yeelight_color1_XXXXXXXXXXXX:
|
||||
friendly_name: Living Room
|
||||
light.yeelight_color2_XXXXXXXXXXXX:
|
||||
friendly_name: Downstairs Toilet
|
||||
yeelight:
|
||||
custom_effects:
|
||||
- name: 'Fire Flicker'
|
||||
flow_params:
|
||||
count: 0
|
||||
transitions:
|
||||
- TemperatureTransition: [1900, 1000, 80]
|
||||
- TemperatureTransition: [1900, 2000, 60]
|
||||
- SleepTransition: [1000]
|
||||
```
|
||||
|
||||
## Example configuration (Manual)
|
||||
### Full configuration
|
||||
|
||||
To enable those lights, add the following lines to your `configuration.yaml` file:
|
||||
This example shows how you can use the optional configuration options.
|
||||
|
||||
```yaml
|
||||
# Example configuration.yaml entry
|
||||
discovery:
|
||||
ignore:
|
||||
- yeelight
|
||||
yeelight:
|
||||
devices:
|
||||
192.168.1.25:
|
||||
name: Living Room
|
||||
transition: 1000
|
||||
use_music_mode: true
|
||||
save_on_change: true
|
||||
custom_effects:
|
||||
- name: 'Fire Flicker'
|
||||
flow_params:
|
||||
count: 0
|
||||
transitions:
|
||||
- TemperatureTransition: [1900, 1000, 80]
|
||||
- TemperatureTransition: [1900, 2000, 60]
|
||||
- SleepTransition: [1000]
|
||||
```
|
||||
|
||||
{% configuration %}
|
||||
devices:
|
||||
required: true
|
||||
required: false
|
||||
description: List of Yeelight devices.
|
||||
type: map
|
||||
keys:
|
||||
@ -110,14 +139,14 @@ custom_effects:
|
||||
|
||||
### Music mode
|
||||
|
||||
Per default the bulb limits the amount of requests per minute to 60, a limitation which can be bypassed by enabling the music mode. In music mode the bulb is commanded to connect back to a socket provided by the integration and it tries to keep the connection open, which may not be wanted in all use-cases.
|
||||
Per default, the bulb limits the number of requests per minute to 60, a limitation that can be bypassed by enabling the music mode. In music mode, the bulb is commanded to connect back to a socket provided by the integration and it tries to keep the connection open, which may not be wanted in all use-cases.
|
||||
**Also note that bulbs in music mode will not update their state to "unavailable" if they are disconnected, which can cause delays in Home Assistant. Bulbs in music mode may also not react to commands from Home Assistant the first time if the connection is dropped. If you experience this issue, turn the light off and back on again in the frontend and everything will return to normal.**
|
||||
|
||||
### Initial setup
|
||||
|
||||
<div class='note'>
|
||||
|
||||
Before trying to control your light through Home Assistant, you have to setup your bulb using Yeelight app. ( [Android](https://play.google.com/store/apps/details?id=com.yeelight.cherry&hl=fr), [IOS](https://itunes.apple.com/us/app/yeelight/id977125608?mt=8) ).
|
||||
Before trying to control your light through Home Assistant, you have to set up your bulb using the Yeelight app. ( [Android](https://play.google.com/store/apps/details?id=com.yeelight.cherry&hl=fr), [IOS](https://itunes.apple.com/us/app/yeelight/id977125608?mt=8) ).
|
||||
In the bulb property, you have to enable "LAN Control" (previously called "Developer mode"). LAN Control may only be available with the latest firmware installed on your bulb. Firmware can be updated in the application after connecting the bulb.
|
||||
Determine your bulb IP (using router, software, ping...).
|
||||
Information on how to enable "LAN Control" can be found [here](https://www.yeelight.com/faqs/lan_control).
|
||||
@ -127,7 +156,7 @@ Information on how to enable "LAN Control" can be found [here](https://www.yeeli
|
||||
### Supported models
|
||||
|
||||
<div class='note warning'>
|
||||
This integration is tested to work with the following models. If you have a different model and it is working please let us know.
|
||||
This integration is tested to work with the following models. If you have a different model and it is working, please let us know.
|
||||
</div>
|
||||
|
||||
| Model ID | Model number | Product name |
|
||||
@ -175,7 +204,7 @@ Start flow with specified transitions
|
||||
| `entity_id` | no | Only act on specific lights. |
|
||||
| `count` | yes | The number of times to run this flow (0 to run forever). |
|
||||
| `action` | yes | The action to take after the flow stops. Can be 'recover', 'stay', 'off'. Default 'recover' |
|
||||
| `transitions` | no | Array of transitions. See [examples below](#custom-effects). |
|
||||
| `transitions` | no | Array of transitions. See [custom effects](#custom-effects). |
|
||||
|
||||
### Service `yeelight.set_color_scene`
|
||||
|
||||
@ -209,14 +238,14 @@ Changes the light to the specified color temperature. If the light is off, it wi
|
||||
|
||||
### Service `yeelight.set_color_flow_scene`
|
||||
|
||||
Starts a color flow. Difference between this and [yeelight.start_flow](#service-yeelightstart_flow), this service call uses different Yeelight API call. If the light was off, it will be turned on. There might be some firmware differences, in handling complex flows, etc.
|
||||
Starts a color flow. Difference between this and [yeelight.start_flow](#service-yeelightstart_flow), this service call uses different a Yeelight API call. If the light was off, it will be turned on. There might be some firmware differences in handling complex flows, etc.
|
||||
|
||||
| Service data attribute | Optional | Description |
|
||||
|---------------------------|----------|---------------------------------------------------------------------------------------------|
|
||||
| `entity_id` | no | Only act on specific lights. |
|
||||
| `count` | yes | The number of times to run this flow (0 to run forever). |
|
||||
| `action` | yes | The action to take after the flow stops. Can be 'recover', 'stay', 'off'. Default 'recover' |
|
||||
| `transitions` | no | Array of transitions. See [examples below](#custom-effects). |
|
||||
| `transitions` | no | Array of transitions. See [custom effects](#custom-effects). |
|
||||
|
||||
### Service `yeelight.set_auto_delay_off_scene`
|
||||
|
||||
@ -227,65 +256,3 @@ Turns the light on to the specified brightness and sets a timer to turn it back
|
||||
| `entity_id` | no | Only act on specific lights. |
|
||||
| `minutes` | no | The minutes to wait before automatically turning the light off. |
|
||||
| `brightness` | no | The brightness value to set (1-100). |
|
||||
|
||||
## Examples
|
||||
|
||||
In this section you find some real-life examples of how to use this light.
|
||||
|
||||
### Full configuration
|
||||
|
||||
This example shows how you can use the optional configuration options.
|
||||
|
||||
```yaml
|
||||
# Example configuration.yaml entry
|
||||
yeelight:
|
||||
devices:
|
||||
192.168.1.25:
|
||||
name: Living Room
|
||||
transition: 1000
|
||||
use_music_mode: true
|
||||
save_on_change: true
|
||||
```
|
||||
|
||||
### Multiple bulbs
|
||||
|
||||
This example shows how you can add multiple bulbs in your configuration.
|
||||
|
||||
```yaml
|
||||
yeelight:
|
||||
devices:
|
||||
192.168.1.25:
|
||||
name: Living Room
|
||||
192.168.1.13:
|
||||
name: Front Door
|
||||
```
|
||||
|
||||
### Custom effects
|
||||
|
||||
This example shows how you can add your custom effects in your configuration. To turn on the effect you can use [light.turn_on](/integrations/light/#service-lightturn_on) service.
|
||||
|
||||
Possible transitions are `RGBTransition`, `HSVTransition`, `TemperatureTransition`, `SleepTransition`.
|
||||
|
||||
Where the array values are as per the following:
|
||||
|
||||
- RGBTransition: [red, green, blue, duration, brightness] with red / green / blue being an integer between 0 and 255, duration being in milliseconds (minimum of 50) and final brightness to transition to 1-100 (%).
|
||||
- HSVTransition: [hue, saturation, duration, brightness] with hue being an integer between 0 and 359, saturation 0 -100, duration in milliseconds (minimum 50) and final brightness 1-100 (%).
|
||||
- TemperatureTransition: [temp, duration, brightness] with temp being the final color temperature between 1700 and 6500, duration in milliseconds (minimum 50) and final brightness to transition to 1-100 (%).
|
||||
- SleepTransition: [duration] with duration being in integer for effect time in milliseconds (minimum 50).
|
||||
|
||||
More info about transitions and their expected parameters can be found in [python-yeelight documentation](https://yeelight.readthedocs.io/en/stable/flow.html).
|
||||
|
||||
```yaml
|
||||
yeelight:
|
||||
devices:
|
||||
192.168.1.25:
|
||||
name: Living Room
|
||||
custom_effects:
|
||||
- name: 'Fire Flicker'
|
||||
flow_params:
|
||||
count: 0
|
||||
transitions:
|
||||
- TemperatureTransition: [1900, 1000, 80]
|
||||
- TemperatureTransition: [1900, 2000, 60]
|
||||
- SleepTransition: [1000]
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user