-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
peopleCounter32Dev.yaml
196 lines (177 loc) · 4.73 KB
/
peopleCounter32Dev.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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
substitutions:
devicename: roode32dev
friendly_name: $devicename
external_components:
refresh: always
source: components
esphome:
name: $devicename
esp32:
board: wemos_d1_mini32
framework:
type: arduino
wifi:
networks:
- ssid: !secret ssid1
password: !secret ssid1_password
use_address: $devicename
fast_connect: True
power_save_mode: none
domain: .local
captive_portal:
api:
password: !secret api_password
reboot_timeout: 60min
services:
- service: recalibrate
then:
- lambda: "id(roode_platform)->recalibration();"
ota:
password: !secret ota_password
web_server:
port: 80
auth:
username: admin
password: !secret web_password
# Enable logging
logger:
level: INFO
i2c:
sda: 21
scl: 22
# Sensor is configured separately from Roode people counting algorithm
vl53l1x:
calibration:
# ranging: longest # defaults to "auto" for formerly "calibration: true"
# offset: 8
# xtalk: 53406
# These pins are not yet implemented but they are passed into class now
pins:
# xshut: 3 # shutdown pin to change address or multiple sensors
# interrupt: 1 # hardware callback when measurement is ready
roode:
id: roode_platform
# I removed the { size: 1 } option here since it was redundant.
# Can always add back later if we have more sampling paramaters.
sampling: 2
# defaults for both zones
roi:
# height: 14
# width: 6
detection_thresholds: # defaults for both zones. These also default to 0% & 85% as previously done.
# min: 234mm # absolute distance
max: 85% # percent based on idle distance
zones:
invert: true
entry:
roi: auto
exit:
# roi:
# height: 4
# width: 4
# center: 124
detection_thresholds:
max: 70% # override max for exit zone
button:
- platform: restart
name: $friendly_name Restart
entity_category: config
- platform: template
name: $friendly_name Recalibrate
on_press:
- lambda: id(roode_platform)->recalibration();
entity_category: config
number:
- platform: roode
people_counter:
id: peopleCounter
name: $friendly_name people counter
binary_sensor:
- platform: status
name: $friendly_name API Status
- platform: roode
presence_sensor:
name: $friendly_name presence
sensor:
- platform: roode
id: roode_sensors
distance_entry:
name: $friendly_name distance zone 0
id: entryDist
filters:
- delta: 100
distance_exit:
name: $friendly_name distance zone 1
id: exitDist
filters:
- delta: 100
max_threshold_entry:
name: $friendly_name max zone 0
max_threshold_exit:
name: $friendly_name max zone 1
min_threshold_entry:
name: $friendly_name min zone 0
min_threshold_exit:
name: $friendly_name min zone 1
roi_height_entry:
name: $friendly_name ROI height zone 0
roi_width_entry:
name: $friendly_name ROI width zone 0
roi_height_exit:
name: $friendly_name ROI height zone 1
roi_width_exit:
name: $friendly_name ROI width zone 1
sensor_status:
name: Sensor Status
- platform: wifi_signal
name: $friendly_name RSSI
update_interval: 60s
- platform: uptime
name: Uptime Sensor
id: uptime_sensor
update_interval: 60s
internal: true
on_raw_value:
then:
- text_sensor.template.publish:
id: uptime_human
state: !lambda |-
int seconds = round(id(uptime_sensor).raw_state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return (
(days ? String(days) + "d " : "") +
(hours ? String(hours) + "h " : "") +
(minutes ? String(minutes) + "m " : "") +
(String(seconds) + "s")
).c_str();
text_sensor:
- platform: roode
version:
name: $friendly_name version
- platform: roode
entry_exit_event:
name: $friendly_name last direction
- platform: template
name: $friendly_name Uptime Human Readable
id: uptime_human
icon: mdi:clock-start
font:
- file: "fonts/Roboto-Regular.ttf"
id: my_font
size: 18
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
id: screen
reset_pin: D0
address: 0x3C
update_interval: 500ms
lambda: |-
it.printf(0, 0, id(my_font), "Counter: %d", (int)id(peopleCounter).state);
it.printf(0, 20, id(my_font), "Entry dist: %d", (int)id(entryDist).state);
it.printf(0, 40, id(my_font), "Exit dist: %d", (int)id(exitDist).state);