esphome / esphome/feature-requests
Add light.brightness condition
- Dominant language
- No language data
- Stars
- 450
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the problem you have/What new integration you would like**
I would like to request a light.brightness condition.
**Please describe your use case for this integration and alternatives you've tried:**
I'm coding dimmer logic and I want to stop dimming just before the light turns off (because the toggle is for that 😄).
**Additional context**
Example code:
```
- while:
condition:
- binary_sensor.is_on: switchID_1
- light.brightness:
id: dimmerID_1
above: 1
then:
- light.dim_relative:
id: dimmerID_1
relative_brightness: -1%
transition_length: 0.01s
- delay: 0.01s
```
Long example:
```
binary_sensor:
- platform: gpio
name: 'Switch 1'
id: switchID_1
pin:
number: GPIO14
mode: INPUT
internal: true
filters:
- delayed_on_off: 50ms
on_multi_click:
# single click
- timing:
- ON for at most 1s
- OFF for at least 0.5s
then:
- logger.log: "Single-Clicked"
- light.toggle: dimmerID_1
# Press and Hold button
- timing:
- ON for at most 0.5s
- OFF for at least 0.1s
- ON for at least 1s
then:
- logger.log: "Press and Hold - Dim DOWN"
- while:
condition:
- binary_sensor.is_on: switchID_1
- light.brightness:
id: dimmerID_1
above: 1
then:
- light.dim_relative:
id: dimmerID_1
relative_brightness: -1%
transition_length: 0.01s
- delay: 0.01s
# Hold button
- timing:
- ON for at least 1s
then:
- logger.log: "Hold - Dim UP"
- while:
condition:
- binary_sensor.is_on: switchID_1
then:
- light.dim_relative:
id: dimmerID_1
relative_brightness: +1%
transition_length: 0.01s
- delay: 0.01s
```
Contributor guide
No contributing guide indexed for this repository
Research direction
No source files, tests, or entry points are named. Start by locating the light condition implementations and the existing light state or brightness APIs; done means a light.brightness condition supports the shown threshold syntax for dimming logic.
Written by the indexing model from the issue text.
Assessment
- Domain
- embedded-iot
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100