-
Notifications
You must be signed in to change notification settings - Fork 1
/
mcu-clock-1.yaml
166 lines (152 loc) · 3.56 KB
/
mcu-clock-1.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
substitutions:
device: clock-1
name: Clock 1
comment: "First floor: Clock"
esphome:
name: mcu-${device}
comment: ${comment}
platformio_options:
board_build.flash_mode: dio
esp32:
board: esp32-c3-devkitm-1
variant: esp32c3
framework:
type: esp-idf
version: 5.1.2
platform_version: 6.5.0
packages:
common: !include common/common.yaml
# GPIO21 UART TX
# GPIO20 UART RX
# GPIO0 I2C SCL
# GPIO1 I2C SDA
# GPIO2 RGB
# GPIO1 BUTTON
# GPIO4 DISPLAY CLOCK
# GPIO5 DISPLAY DIO
# GPIO6 GPIO
# GPIO7 GPIO
# GPIO8 GPIO
# GPIO10 GPIO
#
# GPIO9 GPIO (BUZZER?)
# https://github.com/granadaxronos/120-SONG_NOKIA_RTTTL_RINGTONE_PLAYER_FOR_ARDUINO_UNO/blob/master/RTTTL_PLAYER/songs.h
api:
services:
- service: play_rtttl
variables:
song: string
then:
- rtttl.play:
rtttl: !lambda 'return song;'
# light:
# - platform: neopixelbus
# type: GRB
# pin: 2
# variant: WS2812
# method: ESP8266_UART1
# num_leds: 1
# name: "${name} Light"
# id: neo
# effects:
# # Use default parameters:
# - random:
# # Customize parameters
# - random:
# name: "My Slow Random Effect"
# transition_length: 30s
# update_interval: 30s
# - random:
# name: "My Fast Random Effect"
# transition_length: 4s
# update_interval: 5s
# - strobe:
# - strobe:
# name: Strobe Effect With Custom Values
# colors:
# - state: True
# brightness: 100%
# red: 100%
# green: 90%
# blue: 0%
# duration: 500ms
# - state: False
# duration: 250ms
# - state: True
# brightness: 100%
# red: 0%
# green: 100%
# blue: 0%
# duration: 500ms
# - flicker:
# - flicker:
# name: Flicker Effect With Custom Values
# alpha: 95%
# intensity: 1.5%
# - addressable_rainbow:
# - addressable_rainbow:
# name: Rainbow Effect With Custom Values
# speed: 10
# width: 50
# - addressable_scan:
# - addressable_scan:
# name: Scan Effect With Custom Values
# move_interval: 100ms
globals:
- id: alarm_id
type: bool
restore_value: no
initial_value: "false"
time:
- platform: homeassistant
id: ha_time
timezone: Europe/Bratislava
display:
- platform: tm1637
id: tm1637_display
clk_pin: 4
dio_pin: 5
update_interval: 500ms
# intensity: 0
lambda: |-
static int i = 0;
i++;
if (id(alarm_id)) {
if ((i % 2) == 0)
it.print("8 8 ");
else
it.print(" 8 8");
} else {
if (((i / 10) % 2) == 0) {
//it.set_intensity(7);
if ((i % 2) == 0)
it.strftime("%H.%M", id(ha_time).now());
else
it.strftime("%H%M", id(ha_time).now());
} else {
//it.set_intensity(1);
it.printf("%.0f~C", id(temperature).state);
}
}
output:
- platform: ledc
pin: 9
id: rtttl_out
rtttl:
output: rtttl_out
sensor:
- platform: homeassistant
id: temperature
entity_id: sensor.zigbee_outside_temperature
switch:
- platform: template
name: "${name} Alarm"
optimistic: true
turn_on_action:
- globals.set:
id: alarm_id
value: 'true'
turn_off_action:
- globals.set:
id: alarm_id
value: 'false'