-
-
Save EverythingSmartHome/4f8c9d8e94bffb44c7b7965f172b6470 to your computer and use it in GitHub Desktop.
ESPHome Config for DFRobot mmWave SEN0395 Sensor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
esphome: | |
name: mmwave-occupancy | |
esp8266: | |
board: esp01_1m | |
# Enable logging | |
logger: | |
# Enable Home Assistant API | |
api: | |
ota: | |
password: "password" | |
wifi: | |
ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
# Enable fallback hotspot (captive portal) in case wifi connection fails | |
ap: | |
ssid: "mmWave-Occupancy" | |
password: "password" | |
substitutions: | |
device_name: mmwave-sensor | |
captive_portal: | |
web_server: | |
port: 80 | |
version: 2 | |
include_internal: true | |
http_request: | |
useragent: esphome/$device_name | |
timeout: 2s | |
switch: | |
- platform: safe_mode | |
internal: true | |
name: use_safe_mode | |
binary_sensor: | |
- platform: gpio | |
name: mmwave_in_bedroom | |
pin: | |
number: GPIO16 | |
mode: INPUT_PULLDOWN | |
uart: | |
id: uart_bus | |
tx_pin: GPIO4 | |
rx_pin: GPIO5 | |
baud_rate: 115200 | |
debug: | |
direction: BOTH | |
dummy_receiver: true | |
after: | |
delimiter: "\n" | |
sequence: | |
- lambda: UARTDebug::log_string(direction, bytes); | |
number: | |
- platform: template | |
name: distance | |
id: distance | |
min_value: 0 | |
max_value: 1350 | |
initial_value: 315 | |
optimistic: true | |
step: 15 | |
restore_value: true | |
unit_of_measurement: cm | |
set_action: | |
- uart.write: "sensorStop" | |
- delay: 1s | |
- uart.write: !lambda | |
int cm = (int)ceil(x / 15.0); | |
std::string cms = "detRangeCfg -1 0 " + to_string(cm); | |
return std::vector<unsigned char>(cms.begin(), cms.end()); | |
- delay: 1s | |
- uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89" | |
- delay: 1s | |
- uart.write: "sensorStart" | |
- platform: template | |
name: latency | |
id: latency | |
min_value: 0 | |
max_value: 65000 | |
initial_value: 12500 | |
optimistic: true | |
step: 25 | |
restore_value: true | |
unit_of_measurement: ms | |
set_action: | |
- uart.write: "sensorStop" | |
- delay: 1s | |
- uart.write: !lambda | |
int ms = (int)ceil(x / 25.0); | |
std::string mss = "outputLatency -1 0 " + to_string(ms); | |
return std::vector<unsigned char>(mss.begin(), mss.end()); | |
- delay: 1s | |
- uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89" | |
- delay: 1s | |
- uart.write: "sensorStart" | |
button: | |
- platform: restart | |
name: Restart $device_name | |
- platform: template | |
name: "factory_reset_sensor" | |
id: "factory_reset_sensor" | |
on_press: | |
- uart.write: "sensorStop" | |
- delay: 1s | |
- uart.write: "factoryReset 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89" | |
- delay: 3s | |
- uart.write: "sensorStart" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just came here searching and asking for this.
Will you publish the code for this V2?
Since I have the stuff home, I'll build one, if it works nicely you can expect a new client for a maybe 4 units.