Remove custom WLED services (#20501)

This commit is contained in:
Franck Nijhof 2021-11-29 18:32:36 +01:00 committed by GitHub
parent fdb35b673a
commit 768b8823fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -106,27 +106,6 @@ Keep Master Light:
description: Keep the master light, even if there is only 1 segment. This ensures the master light is always there, in case you are automating segments to appear and remove dynamically.
{% endconfiguration_basic %}
## Services
Currently, the WLED integration provides one service for controlling effect.
More services for other WLED features are expected to be added in the future.
### Service `wled.effect`
This service allows for controlling the WLED effect.
| Service Data Attribute | Required | Description |
| ---------------------- | -------- | --------------------------------------------------------------------------------------------------------------- |
| `entity_id` | no | A WLED entity ID, or list entity IDs, to apply the effect to. Use `entity_id: all` to target all WLED entities. |
| `effect` | no | Name or ID of the WLED light effect. |
| `intensity` | no | Intensity of the effect. Number between `0` and `255`. |
| `palette` | no | Name or ID of the WLED light palette. |
| `speed` | no | Speed of the effect. Number between `0` (slow) and `255` (fast). |
| `reverse` | no | Reverse the effect. Either `true` to reverse or `false` otherwise. |
A list of all available effects (and the behavior of the intensity for each
effect) [is documented in the WLED Knowledge base](https://kno.wled.ge/features/effects-palettes/).
## Example Automations
### Activating Random Effect
@ -136,7 +115,7 @@ You can automate changing the effect using a service call like this:
{% raw %}
```yaml
service: wled.effect
service: light.turn_on
target:
entity_id: light.wled
data:
@ -147,28 +126,18 @@ data:
### Activating Random Palette
Activating a random palette is a bit more complicated as there is currently no way to obtain a list of available palettes.
To go around this issue, one solution is to leverage the fact that palettes can be activated by their IDs.
As the IDs are based on an incrementing counter, picking a random number between zero and the number of palettes minus one works.
To do this, the first step is to use [WLED's JSON API](https://kno.wled.ge/interfaces/json-api) find out how many palettes the device supports:
```bash
$ curl --silent http://<ip address of the wled device>/json | jq ".palettes | length"
54
```
In this case (using WLED v0.11.0) there are 54 palettes, so the following service call will activate a random palette by its ID between 0 and 53:
Activating a random palette is very similar to the above random effect,
and can be done by selecting a random one from the available palette select
entity.
{% raw %}
```yaml
service: wled.effect
service: select.select_option
target:
entity_id: light.wled
entity_id: select.wled_palette
data:
palette: "{{ range(0,53) | random }}"
option: "{{ state_attr('select.wled_palette', 'options') | random }}"
```
{% endraw %}