esphome config added
Signed-off-by: Benny <benny@hierl.dev>
This commit is contained in:
parent
53c0e1a5a4
commit
f1d0e2f953
4 changed files with 252 additions and 1 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
secrets.yaml
|
71
README.md
71
README.md
|
@ -1,2 +1,71 @@
|
||||||
# ESP32-mmWave-Sensor
|
# Presence Sensor Project with ESP32-S3 Board and mmWave
|
||||||
|
|
||||||
|
ESPHome configuration for the HMMD mmWave Sensor S3KM1110 on an ESP32-S3 board.
|
||||||
|
|
||||||
|
> **Tested with:** ESPHome version 2025.2.2
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- MQTT integration for Home Assistant
|
||||||
|
- Optional native Home Assistant API (disabled by default)
|
||||||
|
- Status LED via WS2812
|
||||||
|
- WiFi fallback Access Point
|
||||||
|
- Easy customization via `secrets_template.yaml`
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
### 1. Prepare secrets.yaml
|
||||||
|
|
||||||
|
Copy the template and add your details:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp secrets_template.yaml secrets.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Adjust device name (optional)
|
||||||
|
|
||||||
|
Change the device name and friendly name at the top of the YAML:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
substitutions:
|
||||||
|
device_name: presence_sensor
|
||||||
|
friendly_name: "Presence Sensor"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Flash your ESP32-S3
|
||||||
|
|
||||||
|
Use ESPHome CLI or Home Assistant ESPHome Add-On.
|
||||||
|
|
||||||
|
### 4. Optional: Enable Home Assistant API
|
||||||
|
|
||||||
|
Uncomment the `api:` section and provide the API encryption key in `secrets.yaml` if you prefer native API over MQTT.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# api:
|
||||||
|
# encryption:
|
||||||
|
# key: !secret api_encryption_key
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. Add to Home Assistant
|
||||||
|
|
||||||
|
If using MQTT with discovery enabled, your device will appear automatically.
|
||||||
|
|
||||||
|
## Hardware
|
||||||
|
|
||||||
|
This configuration was tested with the following hardware:
|
||||||
|
|
||||||
|
- ✅ HMMD mmWave Sensor (S3KM1110)
|
||||||
|
- [Amazon Link](https://www.amazon.de/gp/aw/d/B0CT8JTMJM)
|
||||||
|
- [Waveshare Wiki](https://www.waveshare.com/wiki/HMMD_mmWave_Sensor)
|
||||||
|
|
||||||
|
- ✅ ESP32-S3 board (Waveshare ESP32-S3 Zero)
|
||||||
|
- [Amazon Link](https://www.amazon.de/Waveshare-Development-ESP32-S3FH4R2-Castellated-Applications/dp/B0CHYHGYRH?th=1&psc=1)
|
||||||
|
- [Waveshare Wiki](https://www.waveshare.com/wiki/ESP32-S3-Zero)
|
||||||
|
|
||||||
|
**Wiring:**
|
||||||
|
|
||||||
|
- ESP32-S3 TX (GPIO7) → Sensor RX
|
||||||
|
- ESP32-S3 RX (GPIO6) → Sensor TX
|
||||||
|
- Sensor VCC → 3.3V on ESP32-S3
|
||||||
|
- Sensor GND → GND on ESP32-S3
|
||||||
|
- WS2812 LED Data → GPIO21 on ESP32-S3
|
||||||
|
|
158
esphome.yaml
Normal file
158
esphome.yaml
Normal file
|
@ -0,0 +1,158 @@
|
||||||
|
substitutions:
|
||||||
|
device_name: presence_sensor # Change the device name here
|
||||||
|
friendly_name: "Presense Sensor"
|
||||||
|
|
||||||
|
esphome:
|
||||||
|
name: ${device_name}
|
||||||
|
comment: "HMMD mmWave Sensor S3KM1110 - ${friendly_name}"
|
||||||
|
on_boot:
|
||||||
|
priority: 550.0
|
||||||
|
then:
|
||||||
|
- light.turn_on:
|
||||||
|
id: led
|
||||||
|
brightness: 100%
|
||||||
|
red: 100%
|
||||||
|
green: 0%
|
||||||
|
blue: 0%
|
||||||
|
|
||||||
|
esp32:
|
||||||
|
board: esp32-s3-devkitc-1
|
||||||
|
framework:
|
||||||
|
type: arduino
|
||||||
|
|
||||||
|
# Enable logging
|
||||||
|
logger:
|
||||||
|
hardware_uart: USB_CDC
|
||||||
|
|
||||||
|
# Optional: Enable Home Assistant API (uncomment to use)
|
||||||
|
# api:
|
||||||
|
# encryption:
|
||||||
|
# key: !secret api_encryption_key
|
||||||
|
|
||||||
|
mqtt:
|
||||||
|
broker: !secret mqtt_broker
|
||||||
|
port: !secret mqtt_port
|
||||||
|
username: !secret mqtt_username
|
||||||
|
password: !secret mqtt_password
|
||||||
|
reboot_timeout: 0s
|
||||||
|
discovery: true
|
||||||
|
birth_message:
|
||||||
|
topic: "${device_name}/status"
|
||||||
|
payload: "online"
|
||||||
|
will_message:
|
||||||
|
topic: "${device_name}/status"
|
||||||
|
payload: "offline"
|
||||||
|
on_connect:
|
||||||
|
then:
|
||||||
|
- light.turn_on:
|
||||||
|
id: led
|
||||||
|
brightness: 100%
|
||||||
|
red: 0%
|
||||||
|
green: 100%
|
||||||
|
blue: 0%
|
||||||
|
- delay: 3s
|
||||||
|
- light.turn_off:
|
||||||
|
id: led
|
||||||
|
|
||||||
|
ota:
|
||||||
|
- platform: esphome
|
||||||
|
password: !secret ota_password
|
||||||
|
|
||||||
|
wifi:
|
||||||
|
ssid: !secret wifi_ssid
|
||||||
|
password: !secret wifi_password
|
||||||
|
power_save_mode: none
|
||||||
|
|
||||||
|
manual_ip:
|
||||||
|
static_ip: !secret device_ip
|
||||||
|
gateway: !secret gateway_ip
|
||||||
|
subnet: !secret subnet
|
||||||
|
|
||||||
|
on_connect:
|
||||||
|
- light.turn_on:
|
||||||
|
id: led
|
||||||
|
brightness: 100%
|
||||||
|
red: 100%
|
||||||
|
green: 65%
|
||||||
|
blue: 0%
|
||||||
|
|
||||||
|
ap:
|
||||||
|
ssid: "${friendly_name}"
|
||||||
|
password: !secret ap_password
|
||||||
|
|
||||||
|
captive_portal:
|
||||||
|
|
||||||
|
light:
|
||||||
|
- platform: esp32_rmt_led_strip
|
||||||
|
rgb_order: RGB
|
||||||
|
pin: GPIO21
|
||||||
|
num_leds: 1
|
||||||
|
chipset: ws2812
|
||||||
|
id: led
|
||||||
|
rmt_channel: 0
|
||||||
|
|
||||||
|
# UART configuration
|
||||||
|
uart:
|
||||||
|
id: ld2420_uart
|
||||||
|
tx_pin: GPIO7
|
||||||
|
rx_pin: GPIO6
|
||||||
|
baud_rate: 115200
|
||||||
|
parity: NONE
|
||||||
|
stop_bits: 1
|
||||||
|
|
||||||
|
# LD2420 sensor configuration
|
||||||
|
ld2420:
|
||||||
|
|
||||||
|
text_sensor:
|
||||||
|
- platform: ld2420
|
||||||
|
fw_version:
|
||||||
|
name: "LD2420 Firmware"
|
||||||
|
- platform: wifi_info
|
||||||
|
ip_address:
|
||||||
|
name: "${friendly_name} IP Address"
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: ld2420
|
||||||
|
moving_distance:
|
||||||
|
name: "${friendly_name} Motion Distance"
|
||||||
|
|
||||||
|
binary_sensor:
|
||||||
|
- platform: ld2420
|
||||||
|
has_target:
|
||||||
|
name: "${friendly_name} Presence"
|
||||||
|
id: has_target
|
||||||
|
|
||||||
|
select:
|
||||||
|
- platform: ld2420
|
||||||
|
operating_mode:
|
||||||
|
name: "${friendly_name} Operating Mode"
|
||||||
|
|
||||||
|
number:
|
||||||
|
- platform: ld2420
|
||||||
|
presence_timeout:
|
||||||
|
name: "${friendly_name} Presence Timeout (s)"
|
||||||
|
min_gate_distance:
|
||||||
|
name: "${friendly_name} Minimum Distance (Gate)"
|
||||||
|
max_gate_distance:
|
||||||
|
name: "${friendly_name} Maximum Distance (Gate)"
|
||||||
|
gate_select:
|
||||||
|
name: "${friendly_name} Gate Selection (Gate Number)"
|
||||||
|
still_threshold:
|
||||||
|
name: "${friendly_name} Still Threshold (Sensitivity)"
|
||||||
|
move_threshold:
|
||||||
|
name: "${friendly_name} Motion Threshold (Sensitivity)"
|
||||||
|
gate_move_sensitivity:
|
||||||
|
name: "${friendly_name} Motion Sensitivity (Factor)"
|
||||||
|
gate_still_sensitivity:
|
||||||
|
name: "${friendly_name} Still Sensitivity (Factor)"
|
||||||
|
|
||||||
|
button:
|
||||||
|
- platform: ld2420
|
||||||
|
apply_config:
|
||||||
|
name: "${friendly_name} Apply Config"
|
||||||
|
factory_reset:
|
||||||
|
name: "${friendly_name} Factory Reset"
|
||||||
|
restart_module:
|
||||||
|
name: "${friendly_name} Sensor Restart"
|
||||||
|
revert_config:
|
||||||
|
name: "${friendly_name} Revert Changes"
|
23
secrets_template.yaml
Normal file
23
secrets_template.yaml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# WiFi Configuration
|
||||||
|
wifi_ssid: "YourWiFiSSID"
|
||||||
|
wifi_password: "YourWiFiPassword"
|
||||||
|
|
||||||
|
# Manual IP configuration (adjust to your network)
|
||||||
|
device_ip: "192.168.50.100"
|
||||||
|
gateway_ip: "192.168.50.1"
|
||||||
|
subnet: "255.255.255.0"
|
||||||
|
|
||||||
|
# Access Point fallback password
|
||||||
|
ap_password: "ChangeThisToASecurePassword"
|
||||||
|
|
||||||
|
# OTA (Over-the-Air) Update password
|
||||||
|
ota_password: "YourOTAPassword"
|
||||||
|
|
||||||
|
# MQTT configuration
|
||||||
|
mqtt_broker: "192.168.50.10"
|
||||||
|
mqtt_port: 1883
|
||||||
|
mqtt_username: "mqtt_user"
|
||||||
|
mqtt_password: "mqtt_password"
|
||||||
|
|
||||||
|
# Home Assistant API encryption key (only if you enable api:)
|
||||||
|
api_encryption_key: "your_api_encryption_key"
|
Loading…
Add table
Reference in a new issue