esphome / esphome/feature-requests

Support conditional in Binary Light

Open
#2,960 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
450
Forks
29
PR merge metrics
No merged PRs in 30d

Description

I have numerous ESPHome devices installed. In all of them, I include a Template Select to allow the Binary Sensor (physical switch) to be enabled/disabled. This is super useful to prevent the kids from playing around with the physical switches in their rooms.

```
binary_sensor:
- platform: gpio
id: sw
internal: true
pin:
number: GPIO5
on_press:
- if:
condition: # only toggle relay if button is enabled
lambda: 'return (id(select_switch).state == "Enabled");'
then:
light.toggle: roomlight

select:
# option to disable switch
- platform: template
name: "${device_upper} Enable/Disable"
id: select_switch
optimistic: true
options:
- Enabled
- Disabled
initial_option: Enabled
restore_value: true
icon: mdi:circle-double
```

What cannot be disabled this way, however, are the controls in HomeAssistant. Because the Binary Light (that triggers a GPIO Output) doesn't support a conditional I cannot disable the controls.

It'd be great if this was possible in a similar way as for the Binary Sensor above.

Contributor guide

No contributing guide indexed for this repository

Research direction

Review the Binary Light and GPIO Output configuration described in the issue, then compare it with the Binary Sensor `if` condition and Template Select example. Determine how a conditional should affect the Home Assistant controls; done means a Binary Light can be conditionally enabled or disabled in the same practical way as the shown Binary Sensor.

Written by the indexing model from the issue text.

Assessment

Domain
embedded-iot
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.