-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
esphome_neopixel_clock_effect.yaml
139 lines (124 loc) · 3 KB
/
esphome_neopixel_clock_effect.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
substitutions:
num_leds: "60"
esp8266:
board: nodemcuv2
framework:
version: recommended
restore_from_flash: true
esphome:
name: nodemcu_uhr
includes:
- "clock.h"
on_boot:
# set "loading" effect while initializing
priority: 500.0
then:
# enable clock effect after boot
- light.turn_on:
id: light_ring
brightness: 100%
effect: Sync
wifi:
fast_connect: True # only needed for hidden SSID
networks:
- ssid: !secret wifi_iot_ssid
bssid: !secret wifi_iot_bssid
password: !secret wifi_iot_password
hidden: true
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Clock FB AP"
password: !secret clock_fallback_ap_password
captive_portal:
ota:
platform: esphome
password: !secret clock_ota_password
globals:
- id: clock_brightness
type: int
restore_value: yes
initial_value: '255'
- id: clock_indicators_enabled
type: bool
restore_value: yes
initial_value: 'true'
- id: clock_seconds_enabled
type: bool
restore_value: yes
initial_value: 'true'
- id: wide_hour_hand_enabled
type: bool
restore_value: yes
initial_value: 'false'
time:
- platform: sntp
id: sntp_time
timezone: Europe/Berlin
on_time_sync:
then:
- light.turn_on:
id: light_ring
effect: Clock
switch:
- platform: template
name: "Clock Indicators"
icon: mdi:progress-clock
lambda: !lambda |-
return id(clock_indicators_enabled);
turn_on_action:
globals.set:
id: clock_indicators_enabled
value: 'true'
turn_off_action:
globals.set:
id: clock_indicators_enabled
value: 'false'
- platform: template
name: "Clock Seconds"
icon: mdi:update
lambda: !lambda |-
return id(clock_seconds_enabled);
turn_on_action:
globals.set:
id: clock_seconds_enabled
value: 'true'
turn_off_action:
globals.set:
id: clock_seconds_enabled
value: 'false'
- platform: template
name: "Wide Hour Hand"
lambda: !lambda |-
return id(wide_hour_hand_enabled);
turn_on_action:
globals.set:
id: wide_hour_hand_enabled
value: 'true'
turn_off_action:
globals.set:
id: wide_hour_hand_enabled
value: 'false'
light:
- id: light_ring
internal: False
platform: neopixelbus
type: GRB
variant: SK6812 # WS2812X
pin: RX #GPIO23
num_leds: "${num_leds}"
method: ESP8266_DMA
name: "NeoPixel Light"
color_correct: [50%, 50%, 50%]
effects:
- addressable_lambda:
name: "Clock"
update_interval: 32ms
lambda: |-
auto time = id(sntp_time).now();
int offset = 0;
static Color clock_ring_colors [${num_leds}];
update_clock_hands(it, time, clock_ring_colors, offset);
- addressable_scan:
name: Sync
move_interval: 100ms
scan_width: 1