Skip to content

Commit 95c54bf

Browse files
committed
first release
1 parent 5f5e312 commit 95c54bf

File tree

12 files changed

+9488
-0
lines changed

12 files changed

+9488
-0
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# IDE
2+
.idea
3+
4+
# kicad
5+
kicad/#auto_saved_files#
6+
kicad/fp-info-cache
7+
kicad/manufactoring/
8+
kicad/*-backups/
9+
kicad/*.csv
10+
kicad/*.xml

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## v1.0
2+
The first release.

LICENSE.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Lukas Schulte-Tickmann <schluggi@colorfreedom.org>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining
6+
a copy of this software and associated documentation files (the
7+
"Software"), to deal in the Software without restriction, including
8+
without limitation the rights to use, copy, modify, merge, publish,
9+
distribute, sublicense, and/or sell copies of the Software, and to
10+
permit persons to whom the Software is furnished to do so, subject to
11+
the following conditions:
12+
13+
The above copyright notice and this permission notice shall be
14+
included in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

esphome/all-in-one-esp8266.yaml

Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
substitutions:
2+
name: all-in-one-bathroom
3+
4+
esphome:
5+
name: ${name}
6+
7+
esp8266:
8+
board: d1_mini
9+
10+
# Enable logging
11+
logger:
12+
baud_rate: 0 # disable logging via UART
13+
14+
# Enable Home Assistant API
15+
api:
16+
encryption:
17+
key: "<secret>"
18+
19+
ota:
20+
password: "<secret>"
21+
22+
wifi:
23+
ssid: !secret wifi_ssid
24+
password: !secret wifi_password
25+
26+
# Enable fallback hotspot (captive portal) in case wifi connection fails
27+
ap:
28+
ssid: "${name}"
29+
password: "a4FX19p4KtNy"
30+
31+
captive_portal:
32+
33+
i2c:
34+
sda: 4
35+
scl: 5
36+
scan: true
37+
38+
uart:
39+
id: uart_bus
40+
tx_pin: GPIO1
41+
rx_pin: GPIO3
42+
baud_rate: 115200
43+
# debug:
44+
# direction: BOTH
45+
# dummy_receiver: true
46+
# after:
47+
# delimiter: "\n"
48+
# sequence:
49+
# - lambda: UARTDebug::log_string(direction, bytes);
50+
51+
52+
binary_sensor:
53+
- platform: gpio
54+
name: ${name} PIR
55+
id: motion_pir
56+
pin: D4
57+
device_class: motion
58+
filters:
59+
- invert:
60+
61+
- platform: gpio
62+
name: ${name} mmWave
63+
id: motion_mmwave
64+
device_class: occupancy
65+
pin:
66+
number: GPIO16
67+
mode: INPUT_PULLDOWN
68+
69+
- platform: template
70+
name: ${name} Occupancy
71+
id: occupancy
72+
device_class: occupancy
73+
lambda: |-
74+
if (id(motion_mmwave).state or id(motion_pir).state) {
75+
return true;
76+
}
77+
else if (id(motion_mmwave).state == 0 and id(motion_pir).state == 0) {
78+
return false;
79+
}
80+
else {
81+
return id(occupancy).state;
82+
}
83+
84+
85+
sensor:
86+
- platform: bh1750
87+
name: ${name} Illuminance
88+
address: 0x23
89+
update_interval: 10s
90+
91+
- platform: bme280 # or bme680
92+
address: 0x77
93+
update_interval: 60s
94+
temperature:
95+
name: "${name} Temperature"
96+
pressure:
97+
name: "${name} Pressure"
98+
humidity:
99+
name: "${name} Humidity"
100+
# gas_resistance: # bme680 only
101+
# name: "${name} Gas Resistance"
102+
103+
104+
105+
106+
107+
switch:
108+
- platform: template
109+
name: "${name} mmWave Sensor"
110+
id: "mmwave_sensor"
111+
optimistic: true
112+
restore_state: true
113+
assumed_state: true
114+
turn_on_action:
115+
- uart.write: "sensorStart"
116+
- delay: 1s
117+
turn_off_action:
118+
- uart.write: "sensorStop"
119+
- delay: 1s
120+
121+
- platform: template
122+
name: "${name} mmWave LED"
123+
id: "mmwave_led"
124+
optimistic: true
125+
restore_state: true
126+
assumed_state: true
127+
turn_on_action:
128+
- switch.turn_off: mmwave_sensor
129+
- delay: 1s
130+
- uart.write: "setLedMode 1 0"
131+
- delay: 1s
132+
- uart.write: "saveConfig"
133+
- delay: 3s
134+
- switch.turn_on: mmwave_sensor
135+
turn_off_action:
136+
- switch.turn_off: mmwave_sensor
137+
- delay: 1s
138+
- uart.write: "setLedMode 1 1"
139+
- delay: 1s
140+
- uart.write: "saveConfig"
141+
- delay: 3s
142+
- switch.turn_on: mmwave_sensor
143+
144+
# - platform: template
145+
# name: "uart_presence_output"
146+
# id: "uart_presence_output"
147+
# optimistic: true
148+
# restore_state: true
149+
# assumed_state: true
150+
# turn_on_action:
151+
# - switch.turn_off: mmwave_sensor
152+
# - delay: 1s
153+
# - uart.write: "setUartOutput 1 1"
154+
# - delay: 1s
155+
# - uart.write: "saveConfig"
156+
# - delay: 3s
157+
# - switch.turn_on: mmwave_sensor
158+
# turn_off_action:
159+
# - switch.turn_off: mmwave_sensor
160+
# - delay: 1s
161+
# - uart.write: "setUartOutput 1 0"
162+
# - delay: 1s
163+
# - uart.write: "saveConfig"
164+
# - delay: 3s
165+
# - switch.turn_on: mmwave_sensor
166+
167+
# - platform: template
168+
# name: "uart_target_output"
169+
# id: "uart_target_output"
170+
# optimistic: true
171+
# restore_state: true
172+
# assumed_state: false
173+
# turn_on_action:
174+
# - switch.turn_off: mmwave_sensor
175+
# - delay: 1s
176+
# - uart.write: "setUartOutput 2 1 1 1"
177+
# - delay: 1s
178+
# - uart.write: "saveConfig"
179+
# - delay: 3s
180+
# - switch.turn_on: mmwave_sensor
181+
# turn_off_action:
182+
# - switch.turn_off: mmwave_sensor
183+
# - delay: 1s
184+
# - uart.write: "setUartOutput 2 0"
185+
# - delay: 1s
186+
# - uart.write: "saveConfig"
187+
# - delay: 3s
188+
# - switch.turn_on: mmwave_sensor
189+
190+
number:
191+
- platform: template
192+
name: ${name} mmWave Distance
193+
id: mmwave_distance
194+
min_value: 0
195+
max_value: 800
196+
initial_value: 315
197+
optimistic: true
198+
step: 15
199+
restore_value: true
200+
unit_of_measurement: cm
201+
mode: box
202+
set_action:
203+
- switch.turn_off: mmwave_sensor
204+
- delay: 1s
205+
- uart.write: !lambda int cm = (int)ceil(x / 15.0);
206+
std::string cms = "detRangeCfg -1 0 " + to_string(cm);
207+
return std::vector<unsigned char>(cms.begin(), cms.end());
208+
- delay: 1s
209+
- uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89"
210+
- delay: 1s
211+
- switch.turn_on: mmwave_sensor
212+
213+
- platform: template
214+
name: ${name} mmWave Off Latency
215+
id: mmwave_latency
216+
min_value: 0
217+
max_value: 65000
218+
initial_value: 12500
219+
optimistic: true
220+
step: 25
221+
restore_value: true
222+
unit_of_measurement: ms
223+
mode: box
224+
set_action:
225+
- switch.turn_off: mmwave_sensor
226+
- delay: 1s
227+
- uart.write: !lambda int ms = (int)ceil(x / 25.0);
228+
std::string mss = "outputLatency -1 0 " + to_string(ms);
229+
return std::vector<unsigned char>(mss.begin(), mss.end());
230+
- delay: 1s
231+
- uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89"
232+
- delay: 1s
233+
- switch.turn_on: mmwave_sensor
234+
235+
- platform: template
236+
name: ${name} mmWave Sensitivity
237+
id: mmwave_sensitivity
238+
min_value: 0
239+
max_value: 9
240+
initial_value: 7
241+
optimistic: true
242+
step: 1
243+
restore_value: true
244+
set_action:
245+
- switch.turn_off: mmwave_sensor
246+
- delay: 1s
247+
- uart.write:
248+
!lambda std::string mss = "setSensitivity " + to_string((int)x);
249+
return std::vector<unsigned char>(mss.begin(), mss.end());
250+
- delay: 1s
251+
- uart.write: "saveConfig"
252+
- delay: 1s
253+
- switch.turn_on: mmwave_sensor
254+
255+
button:
256+
- platform: restart
257+
name: ${name} Restart
258+
259+
- platform: template
260+
name: "${name} Factory Reset mmWave"
261+
on_press:
262+
- switch.turn_off: mmwave_sensor
263+
- delay: 1s
264+
- uart.write: "resetCfg"
265+
- delay: 3s
266+
- switch.turn_on: mmwave_sensor

images/order_jlcpcb.jpg

172 KB
Loading

images/v1.0/pcb.jpg

657 KB
Loading

images/v1.0/pcb_3d.jpg

117 KB
Loading

0 commit comments

Comments
 (0)