-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.status-led.yaml
112 lines (99 loc) · 2.49 KB
/
.status-led.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
#
# Custom status led and "Locate" switch.
#
substitutions:
status_led_output_platform: esp8266_pwm
status_led_output_pin: GPIO13
status_led_output_inverted: "True"
status_led_switch: no_switch
output:
- id: status_led
platform: ${status_led_output_platform}
pin: ${status_led_output_pin}
inverted: ${status_led_output_inverted}
light:
- id: status_light
platform: monochromatic
output: status_led
internal: True
effects:
- pulse:
name: Scan
transition_length: 200ms
update_interval: 400ms
- pulse:
name: Locate
transition_length: 1s
update_interval: 2s
esphome:
on_loop:
then:
- if:
condition:
and:
- not: wifi.connected
- switch.is_off: scanning
then:
- switch.turn_on: scanning
- if:
condition:
and:
- wifi.connected
- switch.is_on: scanning
then:
- switch.turn_off: scanning
- if:
condition:
and:
- switch.is_off: scanning
- switch.is_off: locate
then:
- if:
condition:
switch.is_on: ${status_led_switch}
then:
- if:
condition:
light.is_off: status_light
then:
- light.turn_on:
id: status_light
transition_length: 0s
else:
- if:
condition:
light.is_on: status_light
then:
- light.turn_off:
id: status_light
transition_length: 0s
switch:
- id: no_switch # Dummy switch to make compiler happy.
platform: template
internal: True
optimistic: True
- id: scanning
platform: template
internal: True
optimistic: True
on_turn_on:
- light.turn_on:
id: status_light
effect: Scan
on_turn_off:
- light.turn_off:
id: status_light
transition_length: 0s
- name: Locate
id: locate
platform: template
icon: mdi:home-search
optimistic: True
on_turn_on:
- light.turn_on:
id: status_light
effect: Locate
on_turn_off:
- light.turn_off:
id: status_light
transition_length: 0s