-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmcu-vehicle-suzuki-dl650.yaml
133 lines (123 loc) · 3.1 KB
/
mcu-vehicle-suzuki-dl650.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
substitutions:
device: vehicle-suzuki-dl650
name: Vehicle Suzuki DL650
comment: "BEACON | Suzuki DL650"
esphome:
name: mcu-${device}
comment: ${comment}
on_loop:
then:
lambda: |-
static uint32_t last_state = 0;
auto state = App.get_app_state();
if (state != last_state) {
if (state & STATUS_LED_ERROR) {
auto call = id(led).turn_on();
call.set_effect("ERROR");
call.perform();
} else if (state & STATUS_LED_WARNING) {
auto call = id(led).turn_on();
call.set_effect("BOOT");
call.perform();
} else {
//auto call = id(led).turn_off();
//call.perform();
auto call = id(led).turn_on();
call.set_effect("BEACON");
call.perform();
}
last_state = state;
}
esp32:
board: m5stack-atom
framework:
type: esp-idf
api:
reboot_timeout: 0s
wifi:
reboot_timeout: 0s
external_components:
- source: components
packages:
common: !include common/logger.yaml
# common: !include common/common.yaml
# debug:
# PINOUTS: M5ATOM
# IR G12
# NEO G27
# BUTTON G39
# I2C0 SDA G26
# I2C0 SCL G32
# I2C1 SDA G25
# I2C1 SCL G21
# UART0 RX G3
# UART0 TX G1
# UART1 RX G23
# UART1 TX G33
# 1-WIRE G22
# NC G19
esp32_ble_beacon:
type: iBeacon
uuid: !secret ble_beacon_suzuki_uuid
major: !secret ble_beacon_suzuki_major
minor: !secret ble_beacon_suzuki_minor
light:
- platform: esp32_rmt_led_strip
name: "${name} LED"
id: led
rgb_order: GRB
pin: 27
num_leds: 1
rmt_channel: 0
chipset: ws2812
restore_mode: ALWAYS_OFF
effects:
- strobe:
name: "BEACON"
colors:
- state: true
red: 0%
green: 0%
blue: 50%
duration: 200ms
- state: false
duration: 200ms
- state: true
red: 0%
green: 0%
blue: 50%
duration: 200ms
- state: false
duration: 10s
- lambda:
name: "ERROR"
update_interval: 0.5s
lambda: |-
static bool state = false;
auto call = id(led).turn_on();
call.set_transition_length(500);
call.set_rgb(1, 0, 0);
if (!state) {
call.set_brightness(1);
} else {
// If using 0, it freaks Home Assistant UI.
call.set_brightness(0.01);
}
call.perform();
state = !state;
- lambda:
name: "BOOT"
update_interval: 0.5s
lambda: |-
static bool state = false;
auto call = id(led).turn_on();
call.set_transition_length(500);
call.set_rgb(0, 1, 0);
if (!state) {
call.set_brightness(1);
} else {
// If using 0, it freaks Home Assistant UI.
call.set_brightness(0.01);
}
call.perform();
state = !state;