blob: 39346833193a31205175c9b93592ba462119e65c (
plain)
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
|
substitutions:
project_ver_let: "f"
packages:
kauf_plug_update: !include kauf-plug-update.yaml
esphome:
on_boot:
then:
# little sequence so factory can confirm firwmare is working.
- if:
condition:
lambda: 'return id(first_boot);'
then:
# get AP going ASAP
- lambda: 'wifi_wificomponent->set_ap_timeout(1);'
# disable button toggling relay
- select.set:
id: select_button
option: "Don't Toggle"
# turn on relay to draw current
- switch.turn_on: relay
- delay: 1s
- light.turn_off: blue_led
# wait until button is pressed, then turn on led
- while:
condition:
binary_sensor.is_off: button_in
then:
- light.turn_off: blue_led
- delay: 50ms
- while:
condition:
binary_sensor.is_on: button_in
then:
- light.turn_on: blue_led
- delay: 50ms
# give it some time to see if a crash occurs with both AP and relay on
- delay: 8s
# test passed, clear first_boot variable so we don't run this again
- globals.set:
id: first_boot
value: 'false'
# re-enable button toggling relay
- select.set:
id: select_button
option: "Toggle on Release"
# delay time to save above changes
- delay: 3s
# blink blue led to indicate pass test until button is pressed then stay on
- while:
condition:
binary_sensor.is_off: button_in
then:
- light.toggle: blue_led
- delay: 100ms
globals:
- id: first_boot # used to run routine at factory to confirm
type: bool # correct firmware is running.
restore_value: yes
initial_value: 'true'
|