-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathE2_4ch_shower.yaml
77 lines (71 loc) · 2.06 KB
/
E2_4ch_shower.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
73
74
75
76
substitutions:
node_name: e2-4ch-shower
friendly_name: shower lights
# light_name_1: shower light 1
# light_name_2: shower light 2
# light_name_3: shower light 3
light_name_4: shower light
switch_name: shower 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_4
# This device is connected to 4 LED lights
light:
- platform: monochromatic
name: ${light_name_4}
output: pwm_w
id: device_light_4
# 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:
- if:
condition:
- light.is_off: device_light_4
then:
- light.turn_on:
id: device_light_4
brightness: 1.0
else:
- light.turn_off: device_light_4
on_press:
then:
- if:
condition:
light.is_off: device_light_4
then:
- delay: 0.5s
- while:
condition:
binary_sensor.is_on: device_switch
then:
- light.dim_relative:
id: device_light_4
relative_brightness: 5%
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_4
then:
- light.dim_relative:
id: device_light_4
relative_brightness: -5%
transition_length: 0.1s
- delay: 0.1s