-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathD2_rgbw_fr.yaml
73 lines (68 loc) · 1.88 KB
/
D2_rgbw_fr.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
substitutions:
node_name: d2-overhead-fr
friendly_name: D2 - overhead fr light
light_name: fr Light
switch_name: fr Switch
packages:
device_base: !include devices/shelly-rgbw2.yaml
# Light can be turned off by Living Room Master Switch
mqtt:
on_message:
- topic: "d5-8-4chan-living/switch/master_switch/state"
then:
- light.turn_off: device_light
# This device is connected to an RGBW strip
# Light was wired incorrectly - fixed through software
light:
- platform: rgbw
name: ${light_name}
red: pwm_g
green: pwm_b
blue: pwm_r
white: pwm_w
effects:
- random:
- strobe:
- flicker:
id: device_light
# Short press on momentary switch toggles light
# Pressing and holding will dim the light
binary_sensor:
- platform: gpio
pin:
number: GPIO5
name: ${switch_name}
internal: true
id: device_switch
on_click:
then:
- light.toggle: device_light
on_press:
then:
- if:
condition:
light.is_off: device_light
then:
- delay: 0.5s
- while:
condition:
binary_sensor.is_on: device_switch
then:
- light.dim_relative:
id: device_light
relative_brightness: 2%
transition_length: 0.1s
- delay: 0.1s
else:
- delay: 0.5s
- while:
condition:
and:
- binary_sensor.is_on: device_switch
- light.is_on: device_light
then:
- light.dim_relative:
id: device_light
relative_brightness: -2%
transition_length: 0.1s
- delay: 0.1s