-
Notifications
You must be signed in to change notification settings - Fork 3
/
shys-m5-tough-touchmenu.yaml
158 lines (133 loc) · 3.67 KB
/
shys-m5-tough-touchmenu.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
substitutions:
name: "m5-tough"
friendly_name: "M5 Tough"
m5_textsensor_id: "m5_textsensor_id" # zum reinreichen des shys_m5_tough-Textsensors
esphome:
name: ${name}
name_add_mac_suffix: false
project:
name: smarthomeyourself.m5_tough
version: "1.0"
platformio_options:
board: esp32dev
framework: arduino
lib_deps:
- WiFi
- SPI
- FS
- Wire
- EEPROM
- m5stack/M5Unified @ 0.0.7
on_boot:
priority: 0
then:
- binary_sensor.template.publish:
id: logged_in
state: off
- sensor.template.publish:
id: failed_logins
state: 0
external_components:
- source:
type: git
url: https://github.com/SmartHome-yourself/m5-tough-touchmenu-for-esphome
ref: main
components: [shys_m5_tough]
dashboard_import:
package_import_url: github://SmartHome-yourself/m5-tough-touchmenu-for-esphome/shys-m5-tough-touchmenu.yaml@main
import_full_config: false
esp32:
board: esp32dev
logger:
level: DEBUG
logs:
sensor: INFO
binary_sensor: INFO
text_sensor: INFO
api:
ota:
- platform: esphome
wifi:
ssid: ${wifi_ssid}
password: ${wifi_password}
ap:
password: "12345678"
improv_serial:
captive_portal:
binary_sensor:
- platform: template
name: "${friendly_name} Angemeldet"
id: logged_in
- platform: template
name: "${friendly_name} Display on"
id: display_on
sensor:
- platform: template
name: "${friendly_name} Failed Logins"
id: failed_logins
accuracy_decimals: 0
unit_of_measurement: "Fehler"
text_sensor:
- platform: template
id: m5_state_tpl
name: ${friendly_name} Status
lambda: |-
return {id(${m5_textsensor_id}).state};
update_interval: 500ms
on_value:
then:
- if:
condition:
text_sensor.state:
id: m5_state_tpl
state: "Login OK"
then:
- binary_sensor.template.publish:
id: logged_in
state: on
- sensor.template.publish:
id: failed_logins
state: 0
- if:
condition:
text_sensor.state:
id: m5_state_tpl
state: "Login failed"
then:
- lambda: "id(failed_logins).publish_state( id(failed_logins).state + 1 );"
- if:
condition:
- or:
- text_sensor.state:
id: m5_state_tpl
state: "Login failed"
- text_sensor.state:
id: m5_state_tpl
state: "Screen locked"
- text_sensor.state:
id: m5_state_tpl
state: "Display off"
then:
- binary_sensor.template.publish:
id: logged_in
state: OFF
- if:
condition:
- or:
- text_sensor.state:
id: m5_state_tpl
state: "Display on"
then:
- binary_sensor.template.publish:
id: display_on
state: ON
- if:
condition:
- or:
- text_sensor.state:
id: m5_state_tpl
state: "Display off"
then:
- binary_sensor.template.publish:
id: display_on
state: OFF