-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
peopleCounter32.yaml
181 lines (163 loc) · 5.02 KB
/
peopleCounter32.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
substitutions:
devicename: roode32
friendly_name: $devicename
external_components:
refresh: always
source:
type: git
url: https://github.com/Lyr3x/Roode
ref: master
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: light
domain: .local
captive_portal:
api:
password: !secret api_password
reboot_timeout: 60min
services:
- service: recalibrate
then:
- lambda: "id(roode_platform)->recalibration();"
- service: set_max_threshold
variables:
newThreshold: int
then:
- lambda: "id(roode_platform)->set_max_threshold_percentage(newThreshold);id(roode_platform)->recalibration();"
- service: set_min_threshold
variables:
newThreshold: int
then:
- lambda: "id(roode_platform)->set_min_threshold_percentage(newThreshold);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
# VL53L1X sensor configuration is separate from Roode people counting algorithm
vl53l1x:
calibration:
# The ranging mode is different based on how long the distance is that the sensor need to measure.
# The longer the distance, the more time the sensor needs to take a measurement.
# Available options are: auto, shortest, short, medium, long, longer, longest
ranging: auto
roode:
id: roode_platform
# Smooth out measurements by using the minimum distance from this number of readings
sampling: 2
# This controls the size of the Region of Interest the sensor should take readings in.
roi: { height: 16, width: 6 }
# The detection thresholds for determining whether a measurement should count as a person crossing.
# A reading must be greater than the minimum and less than the maximum to count as a crossing.
# These can be given as absolute distances or as percentages.
# Percentages are based on the automatically determined idle or resting distance.
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
# The people counting algorithm works by splitting the sensor's capability reading area into two zones.
# This allows for detecting whether a crossing is an entry or exit based on which zones was crossed first.
zones:
invert: true
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:
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
filters:
- delta: 100
distance_exit:
name: $friendly_name distance zone 1
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