-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshelly_rgbw2_cct.yaml
143 lines (132 loc) · 4.14 KB
/
shelly_rgbw2_cct.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#
# ESPhome - Shelly RGBW2 CCT 2 x Chanel
#
substitutions:
devicename: "shelly_rgbw2_1"
devicename_unc: "shelly-rgbw2-1"
devicename_name: "Shelly RGBW2 - 1"
esphome:
name: ${devicename_unc}
platform: ESP8266
board: esp01_1m
# Enable logging
logger:
baud_rate: 0
# Enable Home Assistant API
api:
password: !secret api_pass
ota:
password: !secret ota_pass
# Wifi network
wifi:
ssid: !secret wifi_iot_name
password: !secret wifi_iot_pass
fast_connect: on
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${devicename_unc} Failower Hotspot"
password: !secret failower_pass
captive_portal:
# see: https://esphome.io/components/time.html
time:
- platform: homeassistant
id: homeassistant_time
# Enable Web server
#web_server:
# port: 80
# auth:
# username: admin
# password: !secret web_server_password
output:
- platform: esp8266_pwm
id: ${devicename}_out_cw_ch1
pin: GPIO12 # GPIO12 Chanel RED (R) >> Chanel 1 cold_white
frequency: 1000 Hz
- platform: esp8266_pwm
id: ${devicename}_out_ww_ch1
pin: GPIO15 # GPIO15 Chanel Green (G) >> Chanel 1 warm_white
frequency: 1000 Hz
- platform: esp8266_pwm
id: ${devicename}_out_cw_ch2
pin: GPIO14 # GPIO14 Chanel Blue (B) >> Chanel 2 cold_white
frequency: 1000 Hz
- platform: esp8266_pwm
id: ${devicename}_out_ww_ch2
pin: GPIO4 # GPIO4 Chanel White (W) >> Chanel 2 warm_white
frequency: 1000 Hz
light:
- platform: cwww
name: ${devicename_name} - Chanel 1
id: ${devicename}_ch1
cold_white: ${devicename}_out_cw_ch1 # GPIO12 Chanel RED (R) >> Chanel 1 cold_white
warm_white: ${devicename}_out_ww_ch1 # GPIO15 Chanel Green (G) >> Chanel 1 warm_white
cold_white_color_temperature: 6500 K
warm_white_color_temperature: 2700 K
constant_brightness: false
- platform: cwww
name: ${devicename_name} - Chanel 2
id: ${devicename}_ch2
cold_white: ${devicename}_out_cw_ch2 # GPIO14 Chanel Blue (B) >> Chanel 2 cold_white
warm_white: ${devicename}_out_ww_ch2 # GPIO4 Chanel White (W) >> Chanel 2 warm_white
cold_white_color_temperature: 6500 K
warm_white_color_temperature: 2700 K
constant_brightness: false
binary_sensor:
- platform: gpio
pin: GPIO5
id: light_0_touch
on_click:
then:
- if:
condition:
- light.is_off: ${devicename}_ch1
- light.is_off: ${devicename}_ch2
then:
- light.turn_on:
id: ${devicename}_ch1
#brightness: 1.0
- light.turn_on:
id: ${devicename}_ch2
#brightness: 1.0
else:
- light.turn_off: ${devicename}_ch1
- light.turn_off: ${devicename}_ch2
on_press:
then:
- if:
condition:
light.is_off: ${devicename}_ch1
then:
- delay: 0.5s
- while:
condition:
binary_sensor.is_on: light_0_touch
then:
- light.dim_relative:
id: ${devicename}_ch1
relative_brightness: 5%
transition_length: 0.1s
- delay: 0.1s
- light.dim_relative:
id: ${devicename}_ch2
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: ${devicename}_ch1
then:
- light.dim_relative:
id: ${devicename}_ch1
relative_brightness: -5%
transition_length: 0.1s
- delay: 0.1s
- light.dim_relative:
id: ${devicename}_ch2
relative_brightness: -5%
transition_length: 0.1s
- delay: 0.1s