60 lines
1.4 KiB
YAML
60 lines
1.4 KiB
YAML
.
|
|
|
|
light:
|
|
- platform: monochromatic
|
|
name: "Livingroom Ceiling light"
|
|
id: light_0
|
|
output: light_0_out
|
|
|
|
# Example output entry
|
|
output:
|
|
- platform: esp8266_pwm
|
|
id: light_0_out
|
|
pin: D4
|
|
inverted: true
|
|
|
|
binary_sensor:
|
|
- platform: gpio
|
|
pin: D2
|
|
id: light_0_touch
|
|
on_click:
|
|
then:
|
|
- if:
|
|
condition:
|
|
light.is_off: light_0
|
|
then:
|
|
light.turn_on:
|
|
id: light_0
|
|
brightness: 1.0
|
|
else:
|
|
light.turn_off: light_0
|
|
on_press:
|
|
then:
|
|
- if:
|
|
condition:
|
|
light.is_off: light_0
|
|
then:
|
|
- delay: 0.5s
|
|
- while:
|
|
condition:
|
|
binary_sensor.is_on: light_0_touch
|
|
then:
|
|
- light.dim_relative:
|
|
id: light_0
|
|
relative_brightness: 5%
|
|
transition_length: 0.1s
|
|
- delay: 0.1s
|
|
else:
|
|
- delay: 0.5s
|
|
- while:
|
|
condition:
|
|
and:
|
|
- binary_sensor.is_on: light_0_touch
|
|
- light.is_on: light_0
|
|
then:
|
|
- light.dim_relative:
|
|
id: light_0
|
|
relative_brightness: -5%
|
|
transition_length: 0.1s
|
|
- delay: 0.1s
|