Compare commits
52 Commits
V230902_1_
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc35b79fd0 | ||
|
|
8a9176a8c1 | ||
|
|
51ae28f4aa | ||
|
|
7691ec381b | ||
|
|
2463b7df59 | ||
|
|
396e597e99 | ||
|
|
d33f5c98a2 | ||
|
|
fbd3107cf1 | ||
|
|
5d26858a95 | ||
|
|
56fd154edb | ||
|
|
33000d2c7d | ||
|
|
a0d04643a2 | ||
|
|
4a46abca2c | ||
|
|
db2b68d53d | ||
|
|
ae0cb8f694 | ||
|
|
dae3b64753 | ||
|
|
0a79c4488f | ||
|
|
590cac7b7f | ||
|
|
3780f499c9 | ||
|
|
34b12bb3fd | ||
|
|
b08ba8f8cc | ||
|
|
402c6f57f6 | ||
|
|
1b251de387 | ||
|
|
565e7147b7 | ||
|
|
31d40b75c9 | ||
|
|
e1d3438972 | ||
|
|
01a2d1d9b1 | ||
|
|
11519a1373 | ||
|
|
06f5726673 | ||
|
|
3cdec91387 | ||
|
|
c34f2f8264 | ||
|
|
48179d02f3 | ||
|
|
bad4dca45c | ||
|
|
6f463c3b79 | ||
|
|
9b8f9fea27 | ||
|
|
baf247c932 | ||
|
|
c8e6fd3884 | ||
|
|
6c35ad0edc | ||
|
|
a233c453a6 | ||
|
|
c11b6e21fa | ||
|
|
6238924f63 | ||
|
|
d9ab720b14 | ||
|
|
9a237b7355 | ||
|
|
0d366088b0 | ||
|
|
4e3dd082fb | ||
|
|
4f6a13ee3d | ||
|
|
a78e9b8050 | ||
|
|
509b209523 | ||
|
|
b60cc289f1 | ||
|
|
291a4d4ba8 | ||
|
|
ed74f58897 | ||
|
|
d8018761b8 |
|
|
@ -9,21 +9,10 @@ esphome:
|
||||||
platformio_options:
|
platformio_options:
|
||||||
board_build.flash_mode: dio
|
board_build.flash_mode: dio
|
||||||
board_build.f_cpu: 80000000L
|
board_build.f_cpu: 80000000L
|
||||||
on_boot:
|
|
||||||
priority: 900
|
|
||||||
then:
|
|
||||||
lambda: |-
|
|
||||||
id(cpu_speed) = ESP.getCpuFreqMHz() ;
|
|
||||||
project:
|
project:
|
||||||
name: Screek.Human_Presence_Sensor
|
name: Screek.Human_Presence_Sensor
|
||||||
version: 1U
|
version: 1U
|
||||||
min_version: 2023.6.1
|
min_version: 2025.5.1
|
||||||
|
|
||||||
globals:
|
|
||||||
- id: cpu_speed
|
|
||||||
type: int
|
|
||||||
restore_value: no
|
|
||||||
initial_value: '0'
|
|
||||||
|
|
||||||
external_components:
|
external_components:
|
||||||
# - source: github://screek-workshop/custom_components_support_for_screek_1u
|
# - source: github://screek-workshop/custom_components_support_for_screek_1u
|
||||||
|
|
@ -31,14 +20,12 @@ external_components:
|
||||||
type: git
|
type: git
|
||||||
url: https://github.com/screek-workshop/custom_components_support_for_screek_1u
|
url: https://github.com/screek-workshop/custom_components_support_for_screek_1u
|
||||||
ref: master
|
ref: master
|
||||||
# components: [ ld2410, uart ]
|
components: [ ld2410 ]
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: lolin_s2_mini
|
board: lolin_s2_mini
|
||||||
framework:
|
framework:
|
||||||
type: arduino
|
type: esp-idf
|
||||||
version: 2.0.9
|
|
||||||
platform_version: 6.3.2
|
|
||||||
|
|
||||||
improv_serial:
|
improv_serial:
|
||||||
|
|
||||||
|
|
@ -50,12 +37,9 @@ api:
|
||||||
# key: "YOUR-API-PASSWORD"
|
# key: "YOUR-API-PASSWORD"
|
||||||
|
|
||||||
ota:
|
ota:
|
||||||
# This won't work for the original firmware(we use diffrent ota password),
|
- platform: esphome
|
||||||
# so if you want to turn it into your own OTA,
|
# use your own ota password plz. this is a words by Socrates.
|
||||||
# make sure to completely flash your custom yaml in the firmware once.
|
|
||||||
# after that, you may always ota with your own password.
|
|
||||||
password: "all-things-in-their-being-are-good-for-something" # words by Socrates
|
password: "all-things-in-their-being-are-good-for-something" # words by Socrates
|
||||||
safe_mode: False
|
|
||||||
|
|
||||||
# By automatically importing to the console,
|
# By automatically importing to the console,
|
||||||
# subsequent adjustments can be easily made without having to manually fix a specific name.
|
# subsequent adjustments can be easily made without having to manually fix a specific name.
|
||||||
|
|
@ -90,29 +74,12 @@ binary_sensor:
|
||||||
name: Still Target
|
name: Still Target
|
||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
- platform: template
|
- platform: internal_temperature
|
||||||
name: "ESP Cpu Speed"
|
|
||||||
accuracy_decimals: 0
|
|
||||||
unit_of_measurement: Mhz
|
|
||||||
lambda: |-
|
|
||||||
return (id(cpu_speed));
|
|
||||||
entity_category: "diagnostic"
|
|
||||||
|
|
||||||
# - platform: internal_temperature
|
|
||||||
# id: sys_esp_temperature
|
|
||||||
# name: ESP Temperature
|
|
||||||
# unit_of_measurement: °C
|
|
||||||
# device_class: TEMPERATURE
|
|
||||||
# update_interval: 1s
|
|
||||||
# entity_category: "diagnostic"
|
|
||||||
|
|
||||||
- platform: template
|
|
||||||
id: sys_esp_temperature
|
id: sys_esp_temperature
|
||||||
name: ESP Temperature
|
name: ESP Temperature
|
||||||
lambda: return temperatureRead();
|
|
||||||
unit_of_measurement: °C
|
unit_of_measurement: °C
|
||||||
device_class: TEMPERATURE
|
device_class: TEMPERATURE
|
||||||
update_interval: 5s
|
update_interval: 45s
|
||||||
entity_category: "diagnostic"
|
entity_category: "diagnostic"
|
||||||
|
|
||||||
- platform: uptime
|
- platform: uptime
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ external_components:
|
||||||
type: git
|
type: git
|
||||||
url: https://github.com/screekworkshop/custom_components_support_for_screek_1w
|
url: https://github.com/screekworkshop/custom_components_support_for_screek_1w
|
||||||
ref: main
|
ref: main
|
||||||
components: [esp32, uart, ld2410]
|
components: [uart, ld2410]
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: esp32-c3-devkitm-1
|
board: esp32-c3-devkitm-1
|
||||||
|
|
|
||||||
3
1wx/yaml/experiment/README.yaml
Normal file
3
1wx/yaml/experiment/README.yaml
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
Experimental YAML Configurations
|
||||||
|
|
||||||
|
The YAML configuration files in this directory are experimental and are intended for testing and exploratory development purposes. They have not undergone comprehensive testing or validation and may contain unresolved bugs and issues. Please use these configurations with caution, keeping in mind that they are meant solely for experimentation and learning, and their functionality and stability cannot be guaranteed.
|
||||||
156
1wx/yaml/experiment/human-sensor-1wx-experiment-v1.yaml
Normal file
156
1wx/yaml/experiment/human-sensor-1wx-experiment-v1.yaml
Normal file
|
|
@ -0,0 +1,156 @@
|
||||||
|
esphome:
|
||||||
|
name: screek-humen-sensor-1wx
|
||||||
|
comment: Screek Human Sensor 1WX
|
||||||
|
friendly_name: Human Sensor 1WX
|
||||||
|
name_add_mac_suffix: True
|
||||||
|
platformio_options:
|
||||||
|
board_build.flash_mode: dio
|
||||||
|
project:
|
||||||
|
name: Screek.Human_Sensor
|
||||||
|
version: 1W
|
||||||
|
|
||||||
|
external_components:
|
||||||
|
- source:
|
||||||
|
type: git
|
||||||
|
url: https://github.com/screekworkshop/custom_components_support_for_screek_1w
|
||||||
|
ref: main
|
||||||
|
components: [esp32, uart]
|
||||||
|
|
||||||
|
esp32:
|
||||||
|
board: esp32-c3-devkitm-1
|
||||||
|
|
||||||
|
logger:
|
||||||
|
|
||||||
|
api:
|
||||||
|
|
||||||
|
ota:
|
||||||
|
- platform: esphome
|
||||||
|
password: "YOUR_OTA_PASSWORD"
|
||||||
|
|
||||||
|
wifi:
|
||||||
|
# ssid: !secret wifi_ssid
|
||||||
|
# password: !secret wifi_password
|
||||||
|
# fast_connect: True
|
||||||
|
|
||||||
|
power_save_mode: NONE
|
||||||
|
# output_power: 20dB
|
||||||
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||||
|
ap:
|
||||||
|
ssid: "HUMAN-SENSOR 1WX"
|
||||||
|
|
||||||
|
captive_portal:
|
||||||
|
|
||||||
|
web_server:
|
||||||
|
port: 80
|
||||||
|
|
||||||
|
binary_sensor:
|
||||||
|
- platform: status
|
||||||
|
name: Online
|
||||||
|
id: ink_ha_connected
|
||||||
|
- platform: ld2410
|
||||||
|
has_target:
|
||||||
|
name: Presence
|
||||||
|
has_moving_target:
|
||||||
|
name: Moving Target
|
||||||
|
has_still_target:
|
||||||
|
name: Still Target
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: template
|
||||||
|
id: sys_esp_temperature
|
||||||
|
name: ESP Temperature
|
||||||
|
lambda: return temperatureRead();
|
||||||
|
unit_of_measurement: °C
|
||||||
|
device_class: TEMPERATURE
|
||||||
|
update_interval: 30s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: uptime
|
||||||
|
name: Uptime
|
||||||
|
id: sys_uptime
|
||||||
|
update_interval: 10s
|
||||||
|
- platform: wifi_signal
|
||||||
|
name: RSSI
|
||||||
|
id: wifi_signal_db
|
||||||
|
update_interval: 1s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: template
|
||||||
|
id: esp_memory
|
||||||
|
icon: mdi:memory
|
||||||
|
name: ESP Free Memory
|
||||||
|
lambda: return heap_caps_get_free_size(MALLOC_CAP_INTERNAL) / 1024;
|
||||||
|
unit_of_measurement: 'kB'
|
||||||
|
state_class: measurement
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: ld2410
|
||||||
|
moving_distance:
|
||||||
|
name : Moving Distance
|
||||||
|
id: moving_distance
|
||||||
|
still_distance:
|
||||||
|
name: Still Distance
|
||||||
|
id: still_distance
|
||||||
|
moving_energy:
|
||||||
|
name: Move Energy
|
||||||
|
still_energy:
|
||||||
|
name: Still Energy
|
||||||
|
detection_distance:
|
||||||
|
name: Detection Distance
|
||||||
|
light:
|
||||||
|
name: Sun Light
|
||||||
|
|
||||||
|
time:
|
||||||
|
- platform: sntp
|
||||||
|
id: time_now
|
||||||
|
servers:
|
||||||
|
- ntp.aliyun.com
|
||||||
|
|
||||||
|
uart:
|
||||||
|
id: uart_ld2410
|
||||||
|
tx_pin: GPIO7
|
||||||
|
rx_pin: GPIO6
|
||||||
|
baud_rate: 256000
|
||||||
|
parity: NONE
|
||||||
|
stop_bits: 1
|
||||||
|
|
||||||
|
switch:
|
||||||
|
- platform: ld2410
|
||||||
|
engineering_mode:
|
||||||
|
name: "engineering mode"
|
||||||
|
bluetooth:
|
||||||
|
name: "control bluetooth"
|
||||||
|
|
||||||
|
ld2410:
|
||||||
|
id: ld2410_radar
|
||||||
|
|
||||||
|
text_sensor:
|
||||||
|
- platform: ld2410
|
||||||
|
version:
|
||||||
|
name: "firmware version"
|
||||||
|
mac_address:
|
||||||
|
name: "mac address"
|
||||||
|
|
||||||
|
button:
|
||||||
|
- platform: ld2410
|
||||||
|
factory_reset:
|
||||||
|
name: "ld2410 factory reset"
|
||||||
|
restart:
|
||||||
|
name: "LD2410 Reboot"
|
||||||
|
icon: mdi:radar
|
||||||
|
entity_category: "config"
|
||||||
|
- platform: restart
|
||||||
|
icon: mdi:power-cycle
|
||||||
|
name: "ESP Reboot"
|
||||||
|
- platform: factory_reset
|
||||||
|
disabled_by_default: True
|
||||||
|
name: Factory Reset
|
||||||
|
id: factory_reset_all
|
||||||
|
|
||||||
|
number:
|
||||||
|
- platform: ld2410
|
||||||
|
timeout:
|
||||||
|
name: timeout
|
||||||
|
light_threshold:
|
||||||
|
name: light threshold
|
||||||
|
max_move_distance_gate:
|
||||||
|
name: max move distance gate
|
||||||
|
max_still_distance_gate:
|
||||||
|
name: max still distance gate
|
||||||
168
1wx/yaml/human-sensor-1wx-github.yaml
Normal file
168
1wx/yaml/human-sensor-1wx-github.yaml
Normal file
|
|
@ -0,0 +1,168 @@
|
||||||
|
esphome:
|
||||||
|
name: screek-humen-sensor-1wx
|
||||||
|
comment: Screek Human Sensor 1WX
|
||||||
|
friendly_name: Human Sensor 1WX
|
||||||
|
name_add_mac_suffix: True
|
||||||
|
platformio_options:
|
||||||
|
board_build.flash_mode: dio
|
||||||
|
project:
|
||||||
|
name: Screek.Human_Sensor
|
||||||
|
version: 1W
|
||||||
|
|
||||||
|
external_components:
|
||||||
|
- source:
|
||||||
|
type: git
|
||||||
|
url: https://github.com/screekworkshop/custom_components_support_for_screek_1w
|
||||||
|
ref: main
|
||||||
|
components: [uart, ld2410]
|
||||||
|
|
||||||
|
esp32:
|
||||||
|
board: esp32-c3-devkitm-1
|
||||||
|
|
||||||
|
logger:
|
||||||
|
|
||||||
|
api:
|
||||||
|
|
||||||
|
ota:
|
||||||
|
- platform: esphome
|
||||||
|
password: "YOUR_OTA_PASSWORD"
|
||||||
|
|
||||||
|
wifi:
|
||||||
|
# ssid: !secret wifi_ssid
|
||||||
|
# password: !secret wifi_password
|
||||||
|
# fast_connect: True
|
||||||
|
|
||||||
|
power_save_mode: NONE
|
||||||
|
# output_power: 20dB
|
||||||
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||||
|
ap:
|
||||||
|
ssid: "SCREEK HUMAN-SENSOR"
|
||||||
|
|
||||||
|
captive_portal:
|
||||||
|
|
||||||
|
web_server:
|
||||||
|
port: 80
|
||||||
|
|
||||||
|
binary_sensor:
|
||||||
|
- platform: status
|
||||||
|
name: Online
|
||||||
|
id: ink_ha_connected
|
||||||
|
- platform: ld2410
|
||||||
|
has_target:
|
||||||
|
name: Presence
|
||||||
|
has_moving_target:
|
||||||
|
name: Moving Target
|
||||||
|
has_still_target:
|
||||||
|
name: Still Target
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: template
|
||||||
|
id: sys_esp_temperature
|
||||||
|
name: ESP Temperature
|
||||||
|
lambda: return temperatureRead();
|
||||||
|
unit_of_measurement: °C
|
||||||
|
device_class: TEMPERATURE
|
||||||
|
update_interval: 30s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: uptime
|
||||||
|
name: Uptime
|
||||||
|
id: sys_uptime
|
||||||
|
update_interval: 10s
|
||||||
|
- platform: wifi_signal
|
||||||
|
name: RSSI
|
||||||
|
id: wifi_signal_db
|
||||||
|
update_interval: 1s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: template
|
||||||
|
id: esp_memory
|
||||||
|
icon: mdi:memory
|
||||||
|
name: ESP Free Memory
|
||||||
|
lambda: return heap_caps_get_free_size(MALLOC_CAP_INTERNAL) / 1024;
|
||||||
|
unit_of_measurement: 'kB'
|
||||||
|
state_class: measurement
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: ld2410
|
||||||
|
moving_distance:
|
||||||
|
name : Moving Distance
|
||||||
|
id: moving_distance
|
||||||
|
still_distance:
|
||||||
|
name: Still Distance
|
||||||
|
id: still_distance
|
||||||
|
moving_energy:
|
||||||
|
name: Move Energy
|
||||||
|
still_energy:
|
||||||
|
name: Still Energy
|
||||||
|
detection_distance:
|
||||||
|
name: Detection Distance
|
||||||
|
light:
|
||||||
|
name: Sun Light
|
||||||
|
|
||||||
|
time:
|
||||||
|
- platform: sntp
|
||||||
|
id: time_now
|
||||||
|
servers:
|
||||||
|
- ntp.aliyun.com
|
||||||
|
|
||||||
|
uart:
|
||||||
|
id: uart_ld2410
|
||||||
|
tx_pin: GPIO7
|
||||||
|
rx_pin: GPIO6
|
||||||
|
baud_rate: 256000
|
||||||
|
parity: NONE
|
||||||
|
stop_bits: 1
|
||||||
|
|
||||||
|
ld2410:
|
||||||
|
timeout: 150s
|
||||||
|
id: ld2410_radar
|
||||||
|
# max_move_distance : 6m
|
||||||
|
# max_still_distance: 0.75m
|
||||||
|
# g0_move_threshold: 10
|
||||||
|
# g0_still_threshold: 20
|
||||||
|
# g1_move_threshold: 10
|
||||||
|
# g1_still_threshold: 20
|
||||||
|
# g2_move_threshold: 20
|
||||||
|
# g2_still_threshold: 21
|
||||||
|
# g3_move_threshold: 30
|
||||||
|
# g3_still_threshold: 31
|
||||||
|
# g4_move_threshold: 40
|
||||||
|
# g4_still_threshold: 41
|
||||||
|
# g5_move_threshold: 50
|
||||||
|
# g5_still_threshold: 51
|
||||||
|
# g6_move_threshold: 60
|
||||||
|
# g6_still_threshold: 61
|
||||||
|
# g7_move_threshold: 70
|
||||||
|
# g7_still_threshold: 71
|
||||||
|
# g8_move_threshold: 80
|
||||||
|
# g8_still_threshold: 81
|
||||||
|
|
||||||
|
button:
|
||||||
|
- platform: template
|
||||||
|
name: "Enable LD2410 BLE"
|
||||||
|
entity_category: "config"
|
||||||
|
icon: mdi:bluetooth
|
||||||
|
on_press:
|
||||||
|
lambda: |-
|
||||||
|
id(ld2410_radar) -> ble_control(true);
|
||||||
|
- platform: template
|
||||||
|
name: "Disable LD2410 BLE"
|
||||||
|
entity_category: "config"
|
||||||
|
icon: mdi:bluetooth-off
|
||||||
|
on_press:
|
||||||
|
lambda: |-
|
||||||
|
id(ld2410_radar) -> ble_control(false);
|
||||||
|
- platform: template
|
||||||
|
name: "LD2410 Reboot"
|
||||||
|
icon: mdi:radar
|
||||||
|
entity_category: "config"
|
||||||
|
on_press:
|
||||||
|
lambda: |-
|
||||||
|
// auto* radar = LD2410Component::get(ld2410);
|
||||||
|
// radar -> roboot();
|
||||||
|
id(ld2410_radar) -> reboot();
|
||||||
|
- platform: restart
|
||||||
|
icon: mdi:power-cycle
|
||||||
|
name: "ESP Reboot"
|
||||||
|
- platform: factory_reset
|
||||||
|
disabled_by_default: True
|
||||||
|
name: Factory Reset
|
||||||
|
id: factory_reset_all
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
Current version synchronized with public version: V230818_2_beta
|
|
||||||
|
|
||||||
More Doc: https://docs.screek.io/2a
|
|
||||||
|
|
||||||
Thank you for supporting Screek.
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -8,6 +8,9 @@ Consider the current privacy so extravagant, and the severe dependence on cloud
|
||||||
If you would like to purchase one of our DIY products, or take a look at our documentation, feel free to visit
|
If you would like to purchase one of our DIY products, or take a look at our documentation, feel free to visit
|
||||||
https://www.screek.io/
|
https://www.screek.io/
|
||||||
|
|
||||||
|
Our Store:
|
||||||
|
https://shop.screek.io
|
||||||
|
|
||||||
Our eBay Store:
|
Our eBay Store:
|
||||||
https://www.ebay.com/str/screekworkshop
|
https://www.ebay.com/str/screekworkshop
|
||||||
|
|
||||||
|
|
@ -19,6 +22,10 @@ https://www.reddit.com/r/screekworkshop/
|
||||||
|
|
||||||
Happy DIYing!
|
Happy DIYing!
|
||||||
|
|
||||||
|
## 🙏
|
||||||
|
The sensor builds and code have gotten a lot of concerted effort, and ingenuity, from many, many people.
|
||||||
|
|
||||||
|
|
||||||
## Something else to say
|
## Something else to say
|
||||||
|
|
||||||
We insist on keeping our principles of code openness on Home Assistant sensors because we strongly believe in it:
|
We insist on keeping our principles of code openness on Home Assistant sensors because we strongly believe in it:
|
||||||
|
|
|
||||||
5
f2/yaml/README.md
Normal file
5
f2/yaml/README.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
sensor main page: https://docs.screek.io/f2
|
||||||
|
|
||||||
|
The main LD1125F part of the code comes from the LD1125H code driver from [Link_mmWave_Radar_ESPHome](https://github.com/patrick3399/Hi-Link_mmWave_Radar_ESPHome).
|
||||||
|
|
||||||
|
Acknowledgements patrick3399, ssieb.
|
||||||
516
f2/yaml/beta-version/human-sensor-f2-beta.yaml
Normal file
516
f2/yaml/beta-version/human-sensor-f2-beta.yaml
Normal file
|
|
@ -0,0 +1,516 @@
|
||||||
|
# screek f2 yaml code
|
||||||
|
# main ld1125h code from: https://github.com/patrick3399/Hi-Link_mmWave_Radar_ESPHome
|
||||||
|
#
|
||||||
|
substitutions:
|
||||||
|
devicename: ""
|
||||||
|
upper_devicename: ""
|
||||||
|
|
||||||
|
esphome:
|
||||||
|
name: screek-human-sensor-f2
|
||||||
|
comment: Screek Human Sensor F2
|
||||||
|
friendly_name: Human Sensor F2
|
||||||
|
name_add_mac_suffix: True
|
||||||
|
platformio_options:
|
||||||
|
board_build.flash_mode: dio
|
||||||
|
# board_build.f_cpu: 80000000L
|
||||||
|
project:
|
||||||
|
name: Screek.Human_Presence_Sensor
|
||||||
|
version: F2
|
||||||
|
on_boot:
|
||||||
|
- priority: 100
|
||||||
|
then:
|
||||||
|
lambda: |-
|
||||||
|
id(cpu_speed) = ESP.getCpuFreqMHz();
|
||||||
|
- priority: 300
|
||||||
|
then:
|
||||||
|
lambda: |-
|
||||||
|
id(screek_version).publish_state("Beta_V240708_1");
|
||||||
|
- priority: -200
|
||||||
|
then:
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string th1st = "mth1=" + str_sprintf("%.0f",id(LD1125F_mth1).state) +"\r\n";
|
||||||
|
return std::vector<uint8_t>(th1st.begin(), th1st.end());
|
||||||
|
- delay: 100ms
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string th2st = "mth2=" + str_sprintf("%.0f",id(LD1125F_mth2).state) +"\r\n";
|
||||||
|
return std::vector<uint8_t>(th2st.begin(), th2st.end());
|
||||||
|
- delay: 100ms
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string th3st = "mth3=" + str_sprintf("%.0f",id(LD1125F_mth3).state) +"\r\n";
|
||||||
|
return std::vector<uint8_t>(th3st.begin(), th3st.end());
|
||||||
|
- delay: 100ms
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string rmaxst = "rmax=" + str_sprintf("%.1f",id(LD1125F_rmax).state) +"\r\n";
|
||||||
|
return std::vector<uint8_t>(rmaxst.begin(), rmaxst.end());
|
||||||
|
- delay: 100ms
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string utonsst = "utons=" + str_sprintf("%.1f",id(LD1125F_utons).state) +"\r\n";
|
||||||
|
return std::vector<uint8_t>(utonsst.begin(), utonsst.end());
|
||||||
|
|
||||||
|
|
||||||
|
safe_mode:
|
||||||
|
disabled: true
|
||||||
|
|
||||||
|
preferences:
|
||||||
|
flash_write_interval: 5s
|
||||||
|
|
||||||
|
external_components:
|
||||||
|
- source:
|
||||||
|
type: git
|
||||||
|
url: https://github.com/screekworkshop/custom_components_support_for_screek_2a
|
||||||
|
ref: main
|
||||||
|
components: [uart]
|
||||||
|
- source:
|
||||||
|
type: git
|
||||||
|
url: https://github.com/ssieb/custom_components #Thanks for @ssieb components.
|
||||||
|
components: [ serial ]
|
||||||
|
|
||||||
|
esp32:
|
||||||
|
board: lolin_c3_mini
|
||||||
|
framework:
|
||||||
|
type: arduino
|
||||||
|
version: 2.0.9
|
||||||
|
platform_version: 6.3.0
|
||||||
|
|
||||||
|
globals:
|
||||||
|
- id: cpu_speed
|
||||||
|
type: int
|
||||||
|
restore_value: no
|
||||||
|
initial_value: '0'
|
||||||
|
- id: last_update_ld2450
|
||||||
|
type: unsigned long
|
||||||
|
restore_value: no
|
||||||
|
initial_value: '0'
|
||||||
|
- id: init_zone_publish
|
||||||
|
type: bool
|
||||||
|
restore_value: no
|
||||||
|
initial_value: "false"
|
||||||
|
- id: last_illuminance
|
||||||
|
type: float
|
||||||
|
restore_value: no
|
||||||
|
initial_value: "-1"
|
||||||
|
- id: LD1125F_Last_Time
|
||||||
|
type: time_t
|
||||||
|
restore_value: no
|
||||||
|
initial_value: time(NULL)
|
||||||
|
- id: LD1125F_Last_Mov_Time
|
||||||
|
type: time_t
|
||||||
|
restore_value: no
|
||||||
|
initial_value: time(NULL)
|
||||||
|
- id: LD1125F_Clearence_Status
|
||||||
|
type: bool
|
||||||
|
restore_value: no
|
||||||
|
initial_value: "false"
|
||||||
|
|
||||||
|
improv_serial:
|
||||||
|
|
||||||
|
logger:
|
||||||
|
logs:
|
||||||
|
bh1750.sensor: INFO
|
||||||
|
|
||||||
|
debug:
|
||||||
|
update_interval: 30s
|
||||||
|
|
||||||
|
# Enable Home Assistant API
|
||||||
|
api:
|
||||||
|
# encryption:
|
||||||
|
# key: "your-api-key"
|
||||||
|
|
||||||
|
ota:
|
||||||
|
- platform: esphome
|
||||||
|
password: "your-ota-password"
|
||||||
|
|
||||||
|
wifi:
|
||||||
|
# output_power: 15dB
|
||||||
|
power_save_mode: LIGHT
|
||||||
|
# power_save_mode: NONE
|
||||||
|
reboot_timeout: 10min
|
||||||
|
ap:
|
||||||
|
ssid: "HUMAN-SENSOR F2"
|
||||||
|
|
||||||
|
captive_portal:
|
||||||
|
|
||||||
|
web_server:
|
||||||
|
port: 80
|
||||||
|
|
||||||
|
text_sensor:
|
||||||
|
- platform: template
|
||||||
|
name: "SCREEK Version"
|
||||||
|
id: screek_version
|
||||||
|
icon: mdi:information-outline
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
update_interval: never
|
||||||
|
|
||||||
|
- platform: debug
|
||||||
|
reset_reason:
|
||||||
|
name: "ESP Reset Reason"
|
||||||
|
icon: mdi:anchor
|
||||||
|
disabled_by_default: True
|
||||||
|
- platform: wifi_info
|
||||||
|
ip_address:
|
||||||
|
name: ESP IP Address
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
disabled_by_default: True
|
||||||
|
icon: mdi:ip-network
|
||||||
|
mac_address:
|
||||||
|
name: ESP MAC
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
icon: mdi:ip-network
|
||||||
|
disabled_by_default: True
|
||||||
|
- platform: serial
|
||||||
|
uart_id: LD1125F_UART_BUS
|
||||||
|
name: ${upper_devicename} UART Text
|
||||||
|
id: LD1125F_UART_Text
|
||||||
|
icon: "mdi:format-text"
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
internal: False #If Don't Want to See UART Receive Data, Set To True
|
||||||
|
filters:
|
||||||
|
- lambda: |-
|
||||||
|
static std::string last;
|
||||||
|
if (x == last)
|
||||||
|
return {};
|
||||||
|
last = x;
|
||||||
|
return x;
|
||||||
|
on_value:
|
||||||
|
lambda: |-
|
||||||
|
std::string uart_text = id(LD1125F_UART_Text).state;
|
||||||
|
|
||||||
|
if (uart_text == "null"){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float distance = -1;
|
||||||
|
std::string uart_state = "";
|
||||||
|
if (uart_text.length() > 3) {
|
||||||
|
uart_state = id(LD1125F_UART_Text).state.substr(0,3);
|
||||||
|
if (uart_text.length() >= 9) {
|
||||||
|
if (uart_state == "occ" || uart_state == "mov") {
|
||||||
|
distance = std::stof(uart_text.substr(9));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uart_state == "occ" && distance > 0) {
|
||||||
|
id(LD1125F_Distance).publish_state(distance);
|
||||||
|
if ((time(NULL)-id(LD1125F_Last_Mov_Time)) >= id(LD1125F_Mov_Time).state) {
|
||||||
|
id(LD1125F_Occupancy).publish_state("Occupancy");
|
||||||
|
if (id(LD1125F_MovOcc_Binary).state == false) {
|
||||||
|
id(LD1125F_MovOcc_Binary).publish_state(true);
|
||||||
|
}
|
||||||
|
if (id(LD1125F_Mov_Binary).state == true) {
|
||||||
|
id(LD1125F_Mov_Binary).publish_state(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (id(LD1125F_MovOcc_Binary).state == false) {
|
||||||
|
id(LD1125F_MovOcc_Binary).publish_state(true);
|
||||||
|
}
|
||||||
|
id(LD1125F_Last_Time) = time(NULL);
|
||||||
|
if (id(LD1125F_Clearence_Status) == true) {
|
||||||
|
id(LD1125F_Clearence_Status) = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (uart_state == "mov" && distance > 0) {
|
||||||
|
id(LD1125F_Distance).publish_state(distance);
|
||||||
|
id(LD1125F_Occupancy).publish_state("Movement");
|
||||||
|
if (id(LD1125F_MovOcc_Binary).state == false) {
|
||||||
|
id(LD1125F_MovOcc_Binary).publish_state(true);
|
||||||
|
}
|
||||||
|
if (id(LD1125F_Mov_Binary).state == false) {
|
||||||
|
id(LD1125F_Mov_Binary).publish_state(true);
|
||||||
|
}
|
||||||
|
id(LD1125F_Last_Mov_Time) = time(NULL);
|
||||||
|
id(LD1125F_Last_Time) = time(NULL);
|
||||||
|
if (id(LD1125F_Clearence_Status) == true) {
|
||||||
|
id(LD1125F_Clearence_Status) = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} Occupancy Status
|
||||||
|
id: LD1125F_Occupancy
|
||||||
|
icon: "mdi:motion-sensor"
|
||||||
|
|
||||||
|
binary_sensor:
|
||||||
|
- platform: status
|
||||||
|
name: Online
|
||||||
|
id: ink_ha_connected
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} Occupancy or Movement
|
||||||
|
id: LD1125F_MovOcc_Binary
|
||||||
|
device_class: occupancy
|
||||||
|
publish_initial_state: True
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} Movement
|
||||||
|
id: LD1125F_Mov_Binary
|
||||||
|
device_class: motion
|
||||||
|
publish_initial_state: True
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: template
|
||||||
|
name: "ESP CPU Speed"
|
||||||
|
accuracy_decimals: 0
|
||||||
|
icon: mdi:cpu-32-bit
|
||||||
|
unit_of_measurement: Mhz
|
||||||
|
disabled_by_default: True
|
||||||
|
lambda: |-
|
||||||
|
return (id(cpu_speed));
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
update_interval: 600s
|
||||||
|
- platform: template
|
||||||
|
id: sys_esp_temperature
|
||||||
|
name: ESP Temperature
|
||||||
|
lambda: return temperatureRead();
|
||||||
|
unit_of_measurement: "°C"
|
||||||
|
device_class: TEMPERATURE
|
||||||
|
update_interval: 45s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: uptime
|
||||||
|
name: ESP Uptime
|
||||||
|
id: sys_uptime
|
||||||
|
update_interval: 60s
|
||||||
|
- platform: wifi_signal
|
||||||
|
name: RSSI
|
||||||
|
id: wifi_signal_db
|
||||||
|
update_interval: 60s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: template
|
||||||
|
id: esp_memory
|
||||||
|
icon: mdi:memory
|
||||||
|
name: ESP Free Memory
|
||||||
|
lambda: return heap_caps_get_free_size(MALLOC_CAP_INTERNAL) / 1024;
|
||||||
|
unit_of_measurement: 'kB'
|
||||||
|
state_class: measurement
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
update_interval: 60s
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} Distance
|
||||||
|
id: LD1125F_Distance
|
||||||
|
icon: "mdi:signal-distance-variant"
|
||||||
|
unit_of_measurement: "m"
|
||||||
|
accuracy_decimals: 2
|
||||||
|
# filters: # Use Fliter To Debounce
|
||||||
|
# - sliding_window_moving_average:
|
||||||
|
# window_size: 8
|
||||||
|
# send_every: 2
|
||||||
|
# - heartbeat: 0.2s
|
||||||
|
- platform: bh1750
|
||||||
|
name: "Illuminance"
|
||||||
|
accuracy_decimals: 1
|
||||||
|
id: bh1750_light
|
||||||
|
update_interval: 1s
|
||||||
|
filters:
|
||||||
|
- delta: 0.1
|
||||||
|
|
||||||
|
light:
|
||||||
|
- platform: status_led
|
||||||
|
name: sys_status
|
||||||
|
pin:
|
||||||
|
number: GPIO13
|
||||||
|
ignore_pin_validation_error: true
|
||||||
|
internal: True
|
||||||
|
restore_mode: ALWAYS_OFF
|
||||||
|
- platform: binary
|
||||||
|
name: "Red Info Light"
|
||||||
|
output: board_info_ed
|
||||||
|
entity_category: "config"
|
||||||
|
restore_mode: ALWAYS_OFF
|
||||||
|
|
||||||
|
i2c:
|
||||||
|
sda: GPIO7
|
||||||
|
scl: GPIO11
|
||||||
|
scan: true
|
||||||
|
id: bus_a
|
||||||
|
|
||||||
|
output:
|
||||||
|
- platform: gpio
|
||||||
|
id: board_info_ed
|
||||||
|
pin:
|
||||||
|
number: GPIO12
|
||||||
|
ignore_pin_validation_error: true
|
||||||
|
|
||||||
|
switch:
|
||||||
|
- platform: factory_reset
|
||||||
|
name: Factory Reset
|
||||||
|
disabled_by_default: True
|
||||||
|
icon: mdi:heart-broken
|
||||||
|
|
||||||
|
button:
|
||||||
|
- platform: restart
|
||||||
|
icon: mdi:power-cycle
|
||||||
|
name: "ESP Reboot"
|
||||||
|
entity_category: diagnostic
|
||||||
|
|
||||||
|
uart:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
rx_pin: GPIO5
|
||||||
|
tx_pin: GPIO4
|
||||||
|
baud_rate: 115200
|
||||||
|
data_bits: 8
|
||||||
|
stop_bits: 1
|
||||||
|
parity: NONE
|
||||||
|
|
||||||
|
interval:
|
||||||
|
- interval: 1s #Clearance Scan Time
|
||||||
|
setup_priority: -200
|
||||||
|
then:
|
||||||
|
lambda: |-
|
||||||
|
if ((time(NULL)-id(LD1125F_Last_Time))>id(LD1125F_Clear_Time).state) {
|
||||||
|
if (id(LD1125F_Distance).state != 0){
|
||||||
|
id(LD1125F_Distance).publish_state(0);
|
||||||
|
}
|
||||||
|
if ((id(LD1125F_Clearence_Status) == false) || (id(LD1125F_Occupancy).state != "Clearance")) {
|
||||||
|
id(LD1125F_Occupancy).publish_state("Clearance");
|
||||||
|
id(LD1125F_Clearence_Status) = true;
|
||||||
|
}
|
||||||
|
if (id(LD1125F_MovOcc_Binary).state == true) {
|
||||||
|
id(LD1125F_MovOcc_Binary).publish_state(false);
|
||||||
|
}
|
||||||
|
if (id(LD1125F_Mov_Binary).state == true) {
|
||||||
|
id(LD1125F_Mov_Binary).publish_state(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
number:
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} mth1 #mth1 is 0~2.8m Sensitivity.
|
||||||
|
id: LD1125F_mth1
|
||||||
|
icon: "mdi:cogs"
|
||||||
|
optimistic: true
|
||||||
|
entity_category: config
|
||||||
|
restore_value: true #If you don't want to store the setting at ESP, set it to false.
|
||||||
|
initial_value: "60.0" #Default mth1 Setting
|
||||||
|
min_value: 10.0
|
||||||
|
max_value: 600.0
|
||||||
|
step: 5.0
|
||||||
|
set_action:
|
||||||
|
then:
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string th1st = "mth1=" + str_sprintf("%.0f",x) +"\r\n";
|
||||||
|
return std::vector<uint8_t>(th1st.begin(), th1st.end());
|
||||||
|
- delay: 100ms
|
||||||
|
- uart.write: # save
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: "save\r\n"
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} mth2 #mth2 is 2.8~8m Sensitivity.
|
||||||
|
id: LD1125F_mth2
|
||||||
|
icon: "mdi:cogs"
|
||||||
|
optimistic: true
|
||||||
|
entity_category: config
|
||||||
|
restore_value: true #If you don't want to store the setting at ESP, set it to false.
|
||||||
|
initial_value: "30" #Default mth2 Setting
|
||||||
|
min_value: 5
|
||||||
|
max_value: 300
|
||||||
|
step: 5
|
||||||
|
set_action:
|
||||||
|
then:
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string th2st = "mth2=" + str_sprintf("%.0f",x) +"\r\n";
|
||||||
|
return std::vector<uint8_t>(th2st.begin(), th2st.end());
|
||||||
|
- delay: 100ms
|
||||||
|
- uart.write: # save
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: "save\r\n"
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} mth3 #mth3 is above 8m Sensitivity.
|
||||||
|
id: LD1125F_mth3
|
||||||
|
icon: "mdi:cogs"
|
||||||
|
entity_category: config
|
||||||
|
optimistic: true
|
||||||
|
restore_value: true #If you don't want to store the setting at ESP, set it to false.
|
||||||
|
initial_value: "20" #Default mth3 Setting
|
||||||
|
min_value: 5
|
||||||
|
max_value: 200
|
||||||
|
step: 5
|
||||||
|
set_action:
|
||||||
|
then:
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string th3st = "mth3=" + str_sprintf("%.0f",x) +"\r\n";
|
||||||
|
return std::vector<uint8_t>(th3st.begin(), th3st.end());
|
||||||
|
- delay: 100ms
|
||||||
|
- uart.write: # save
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: "save\r\n"
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} Max Distance #rmax is max detection distance.
|
||||||
|
id: LD1125F_rmax
|
||||||
|
icon: "mdi:cogs"
|
||||||
|
entity_category: config
|
||||||
|
optimistic: true
|
||||||
|
unit_of_measurement: m
|
||||||
|
restore_value: true #If you don't want to store the setting at ESP, set it to false.
|
||||||
|
initial_value: "8" #Default rmax Setting
|
||||||
|
min_value: 0.4
|
||||||
|
max_value: 12
|
||||||
|
step: 0.2
|
||||||
|
set_action:
|
||||||
|
then:
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string rmaxst = "rmax=" + str_sprintf("%.1f",x) +"\r\n";
|
||||||
|
return std::vector<uint8_t>(rmaxst.begin(), rmaxst.end());
|
||||||
|
- delay: 100ms
|
||||||
|
- uart.write: # save
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: "save\r\n"
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} LD1125F Refresh Rate
|
||||||
|
id: LD1125F_utons
|
||||||
|
icon: "mdi:refresh"
|
||||||
|
entity_category: config
|
||||||
|
optimistic: true
|
||||||
|
unit_of_measurement: ms
|
||||||
|
restore_value: true
|
||||||
|
initial_value: "100"
|
||||||
|
min_value: 100
|
||||||
|
max_value: 5000
|
||||||
|
step: 50
|
||||||
|
set_action:
|
||||||
|
then:
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string utonsst = "utons=" + std::to_string(x) + "\r\n";
|
||||||
|
return std::vector<uint8_t>(utonsst.begin(), utonsst.end());
|
||||||
|
- delay: 100ms
|
||||||
|
- uart.write: # save
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: "save\r\n"
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} Clearence Time
|
||||||
|
id: LD1125F_Clear_Time
|
||||||
|
icon: "mdi:cogs"
|
||||||
|
optimistic: true
|
||||||
|
entity_category: config
|
||||||
|
restore_value: true #If you don't want to store the setting at ESP, set it to false.
|
||||||
|
initial_value: "5" #LD1125F Mov/Occ > Clearence Time Here
|
||||||
|
min_value: 0.5
|
||||||
|
max_value: 20
|
||||||
|
step: 0.5
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} Movement Time
|
||||||
|
id: LD1125F_Mov_Time
|
||||||
|
icon: "mdi:cogs"
|
||||||
|
optimistic: true
|
||||||
|
entity_category: config
|
||||||
|
restore_value: true #If you don't want to store the setting at ESP, set it to false.
|
||||||
|
initial_value: "1" #LD1125F Mov > Occ Time Here
|
||||||
|
min_value: 0.5
|
||||||
|
max_value: 10
|
||||||
|
step: 0.5
|
||||||
482
f2/yaml/human-sensor-f2-stable.yaml
Normal file
482
f2/yaml/human-sensor-f2-stable.yaml
Normal file
|
|
@ -0,0 +1,482 @@
|
||||||
|
# screek f2 yaml code
|
||||||
|
# main ld1125h code from: https://github.com/patrick3399/Hi-Link_mmWave_Radar_ESPHome
|
||||||
|
#
|
||||||
|
substitutions:
|
||||||
|
devicename: ""
|
||||||
|
upper_devicename: ""
|
||||||
|
|
||||||
|
esphome:
|
||||||
|
name: screek-human-sensor-f2
|
||||||
|
comment: Screek Human Sensor F2
|
||||||
|
friendly_name: Human Sensor F2
|
||||||
|
name_add_mac_suffix: True
|
||||||
|
platformio_options:
|
||||||
|
board_build.flash_mode: dio
|
||||||
|
# board_build.f_cpu: 80000000L
|
||||||
|
project:
|
||||||
|
name: Screek.Human_Presence_Sensor
|
||||||
|
version: F2
|
||||||
|
on_boot:
|
||||||
|
- priority: 300
|
||||||
|
then:
|
||||||
|
lambda: |-
|
||||||
|
id(screek_version).publish_state("V251104_1");
|
||||||
|
- priority: -200
|
||||||
|
then:
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string th1st = "mth1=" + str_sprintf("%.0f",id(LD1125F_mth1).state) +"\r\n";
|
||||||
|
return std::vector<uint8_t>(th1st.begin(), th1st.end());
|
||||||
|
- delay: 100ms
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string th2st = "mth2=" + str_sprintf("%.0f",id(LD1125F_mth2).state) +"\r\n";
|
||||||
|
return std::vector<uint8_t>(th2st.begin(), th2st.end());
|
||||||
|
- delay: 100ms
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string th3st = "mth3=" + str_sprintf("%.0f",id(LD1125F_mth3).state) +"\r\n";
|
||||||
|
return std::vector<uint8_t>(th3st.begin(), th3st.end());
|
||||||
|
- delay: 100ms
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string rmaxst = "rmax=" + str_sprintf("%.1f",id(LD1125F_rmax).state) +"\r\n";
|
||||||
|
return std::vector<uint8_t>(rmaxst.begin(), rmaxst.end());
|
||||||
|
- delay: 100ms
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string utonsst = "utons=" + str_sprintf("%.1f",id(LD1125F_utons).state) +"\r\n";
|
||||||
|
return std::vector<uint8_t>(utonsst.begin(), utonsst.end());
|
||||||
|
|
||||||
|
|
||||||
|
safe_mode:
|
||||||
|
disabled: true
|
||||||
|
|
||||||
|
preferences:
|
||||||
|
flash_write_interval: 5s
|
||||||
|
|
||||||
|
external_components:
|
||||||
|
- source:
|
||||||
|
type: git
|
||||||
|
url: https://github.com/ssieb/custom_components #Thanks for @ssieb components.
|
||||||
|
components: [ serial ]
|
||||||
|
|
||||||
|
esp32:
|
||||||
|
board: lolin_c3_mini
|
||||||
|
framework:
|
||||||
|
type: esp-idf
|
||||||
|
# version: 2.0.9
|
||||||
|
# platform_version: 6.3.0
|
||||||
|
|
||||||
|
globals:
|
||||||
|
- id: last_update_ld2450
|
||||||
|
type: unsigned long
|
||||||
|
restore_value: no
|
||||||
|
initial_value: '0'
|
||||||
|
- id: init_zone_publish
|
||||||
|
type: bool
|
||||||
|
restore_value: no
|
||||||
|
initial_value: "false"
|
||||||
|
- id: last_illuminance
|
||||||
|
type: float
|
||||||
|
restore_value: no
|
||||||
|
initial_value: "-1"
|
||||||
|
- id: LD1125F_Last_Time
|
||||||
|
type: time_t
|
||||||
|
restore_value: no
|
||||||
|
initial_value: time(NULL)
|
||||||
|
- id: LD1125F_Last_Mov_Time
|
||||||
|
type: time_t
|
||||||
|
restore_value: no
|
||||||
|
initial_value: time(NULL)
|
||||||
|
- id: LD1125F_Clearence_Status
|
||||||
|
type: bool
|
||||||
|
restore_value: no
|
||||||
|
initial_value: "false"
|
||||||
|
|
||||||
|
improv_serial:
|
||||||
|
|
||||||
|
logger:
|
||||||
|
|
||||||
|
debug:
|
||||||
|
update_interval: 30s
|
||||||
|
|
||||||
|
# Enable Home Assistant API
|
||||||
|
api:
|
||||||
|
# encryption:
|
||||||
|
# key: "your-api-key"
|
||||||
|
|
||||||
|
ota:
|
||||||
|
- platform: esphome
|
||||||
|
password: "your-ota-password"
|
||||||
|
|
||||||
|
wifi:
|
||||||
|
# output_power: 15dB
|
||||||
|
power_save_mode: LIGHT
|
||||||
|
# power_save_mode: NONE
|
||||||
|
reboot_timeout: 10min
|
||||||
|
ap:
|
||||||
|
ssid: "HUMAN-SENSOR F2"
|
||||||
|
|
||||||
|
captive_portal:
|
||||||
|
|
||||||
|
web_server:
|
||||||
|
port: 80
|
||||||
|
|
||||||
|
text_sensor:
|
||||||
|
- platform: template
|
||||||
|
name: "SCREEK Version"
|
||||||
|
id: screek_version
|
||||||
|
icon: mdi:information-outline
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
update_interval: never
|
||||||
|
|
||||||
|
- platform: debug
|
||||||
|
reset_reason:
|
||||||
|
name: "ESP Reset Reason"
|
||||||
|
icon: mdi:anchor
|
||||||
|
disabled_by_default: True
|
||||||
|
- platform: wifi_info
|
||||||
|
ip_address:
|
||||||
|
name: ESP IP Address
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
disabled_by_default: True
|
||||||
|
icon: mdi:ip-network
|
||||||
|
mac_address:
|
||||||
|
name: ESP MAC
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
icon: mdi:ip-network
|
||||||
|
disabled_by_default: True
|
||||||
|
- platform: serial
|
||||||
|
uart_id: LD1125F_UART_BUS
|
||||||
|
name: ${upper_devicename} UART Text
|
||||||
|
id: LD1125F_UART_Text
|
||||||
|
icon: "mdi:format-text"
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
internal: False #If Don't Want to See UART Receive Data, Set To True
|
||||||
|
on_value:
|
||||||
|
lambda: |-
|
||||||
|
std::string uart_text = id(LD1125F_UART_Text).state;
|
||||||
|
|
||||||
|
if (uart_text == "null"){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float distance = -1;
|
||||||
|
std::string uart_state = "";
|
||||||
|
if (uart_text.length() > 3){
|
||||||
|
uart_state = id(LD1125F_UART_Text).state.substr(0,3);
|
||||||
|
if (uart_text.length() >= 9) {
|
||||||
|
if (uart_state == "occ" || uart_state =="mov") {
|
||||||
|
distance = std::stof(uart_text.substr(9));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uart_state == "occ" && distance > 0) {
|
||||||
|
id(LD1125F_Distance).publish_state(distance);
|
||||||
|
if ((time(NULL)-id(LD1125F_Last_Mov_Time))>id(LD1125F_Mov_Time).state) {
|
||||||
|
id(LD1125F_Occupancy).publish_state("Occupancy");
|
||||||
|
if (id(LD1125F_MovOcc_Binary).state == false) {
|
||||||
|
id(LD1125F_MovOcc_Binary).publish_state(true);
|
||||||
|
}
|
||||||
|
if (id(LD1125F_Mov_Binary).state == true) {
|
||||||
|
id(LD1125F_Mov_Binary).publish_state(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (id(LD1125F_MovOcc_Binary).state == false) {
|
||||||
|
id(LD1125F_MovOcc_Binary).publish_state(true);
|
||||||
|
}
|
||||||
|
id(LD1125F_Last_Time) = time(NULL);
|
||||||
|
if (id(LD1125F_Clearence_Status) == true) {
|
||||||
|
id(LD1125F_Clearence_Status) = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (uart_state == "mov" && distance > 0) {
|
||||||
|
id(LD1125F_Distance).publish_state(distance);
|
||||||
|
id(LD1125F_Occupancy).publish_state("Movement");
|
||||||
|
if (id(LD1125F_MovOcc_Binary).state == false) {
|
||||||
|
id(LD1125F_MovOcc_Binary).publish_state(true);
|
||||||
|
}
|
||||||
|
if (id(LD1125F_Mov_Binary).state == false) {
|
||||||
|
id(LD1125F_Mov_Binary).publish_state(true);
|
||||||
|
}
|
||||||
|
id(LD1125F_Last_Mov_Time) = time(NULL);
|
||||||
|
id(LD1125F_Last_Time) = time(NULL);
|
||||||
|
if (id(LD1125F_Clearence_Status) == true) {
|
||||||
|
id(LD1125F_Clearence_Status) = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} Occupancy Status
|
||||||
|
id: LD1125F_Occupancy
|
||||||
|
icon: "mdi:motion-sensor"
|
||||||
|
|
||||||
|
binary_sensor:
|
||||||
|
- platform: status
|
||||||
|
name: Online
|
||||||
|
id: ink_ha_connected
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} Occupancy or Movement
|
||||||
|
id: LD1125F_MovOcc_Binary
|
||||||
|
device_class: occupancy
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} Movement
|
||||||
|
id: LD1125F_Mov_Binary
|
||||||
|
device_class: motion
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: internal_temperature
|
||||||
|
id: sys_esp_temperature
|
||||||
|
name: ESP Temperature
|
||||||
|
unit_of_measurement: °C
|
||||||
|
device_class: TEMPERATURE
|
||||||
|
update_interval: 45s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: uptime
|
||||||
|
name: ESP Uptime
|
||||||
|
id: sys_uptime
|
||||||
|
update_interval: 60s
|
||||||
|
- platform: wifi_signal
|
||||||
|
name: RSSI
|
||||||
|
id: wifi_signal_db
|
||||||
|
update_interval: 60s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: template
|
||||||
|
id: esp_memory
|
||||||
|
icon: mdi:memory
|
||||||
|
name: ESP Free Memory
|
||||||
|
lambda: return heap_caps_get_free_size(MALLOC_CAP_INTERNAL) / 1024;
|
||||||
|
unit_of_measurement: 'kB'
|
||||||
|
state_class: measurement
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
update_interval: 60s
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} Distance
|
||||||
|
id: LD1125F_Distance
|
||||||
|
icon: "mdi:signal-distance-variant"
|
||||||
|
unit_of_measurement: "m"
|
||||||
|
accuracy_decimals: 2
|
||||||
|
# filters: # Use Fliter To Debounce
|
||||||
|
# - sliding_window_moving_average:
|
||||||
|
# window_size: 8
|
||||||
|
# send_every: 2
|
||||||
|
# - heartbeat: 0.2s
|
||||||
|
- platform: bh1750
|
||||||
|
name: "Illuminance"
|
||||||
|
accuracy_decimals: 1
|
||||||
|
id: bh1750_light
|
||||||
|
update_interval: 1s
|
||||||
|
filters:
|
||||||
|
- delta: 0.1
|
||||||
|
|
||||||
|
light:
|
||||||
|
- platform: status_led
|
||||||
|
name: sys_status
|
||||||
|
pin:
|
||||||
|
number: GPIO13
|
||||||
|
ignore_pin_validation_error: true
|
||||||
|
internal: True
|
||||||
|
restore_mode: ALWAYS_OFF
|
||||||
|
- platform: binary
|
||||||
|
name: "Red Info Light"
|
||||||
|
output: board_info_ed
|
||||||
|
entity_category: "config"
|
||||||
|
restore_mode: ALWAYS_OFF
|
||||||
|
|
||||||
|
i2c:
|
||||||
|
sda: GPIO7
|
||||||
|
scl: GPIO11
|
||||||
|
scan: true
|
||||||
|
id: bus_a
|
||||||
|
|
||||||
|
output:
|
||||||
|
- platform: gpio
|
||||||
|
id: board_info_ed
|
||||||
|
pin:
|
||||||
|
number: GPIO12
|
||||||
|
ignore_pin_validation_error: true
|
||||||
|
|
||||||
|
switch:
|
||||||
|
- platform: factory_reset
|
||||||
|
name: Factory Reset
|
||||||
|
disabled_by_default: True
|
||||||
|
icon: mdi:heart-broken
|
||||||
|
|
||||||
|
button:
|
||||||
|
- platform: restart
|
||||||
|
icon: mdi:power-cycle
|
||||||
|
name: "ESP Reboot"
|
||||||
|
entity_category: diagnostic
|
||||||
|
|
||||||
|
uart:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
rx_pin: GPIO5
|
||||||
|
tx_pin: GPIO4
|
||||||
|
baud_rate: 115200
|
||||||
|
data_bits: 8
|
||||||
|
stop_bits: 1
|
||||||
|
parity: NONE
|
||||||
|
|
||||||
|
interval:
|
||||||
|
- interval: 1s #Clearance Scan Time
|
||||||
|
setup_priority: -200
|
||||||
|
then:
|
||||||
|
lambda: |-
|
||||||
|
if ((time(NULL)-id(LD1125F_Last_Time))>id(LD1125F_Clear_Time).state) {
|
||||||
|
if (id(LD1125F_Distance).state != 0){
|
||||||
|
id(LD1125F_Distance).publish_state(0);
|
||||||
|
}
|
||||||
|
if ((id(LD1125F_Clearence_Status) == false) || (id(LD1125F_Occupancy).state != "Clearance")) {
|
||||||
|
id(LD1125F_Occupancy).publish_state("Clearance");
|
||||||
|
id(LD1125F_Clearence_Status) = true;
|
||||||
|
}
|
||||||
|
if (id(LD1125F_MovOcc_Binary).state == true) {
|
||||||
|
id(LD1125F_MovOcc_Binary).publish_state(false);
|
||||||
|
}
|
||||||
|
if (id(LD1125F_Mov_Binary).state == true) {
|
||||||
|
id(LD1125F_Mov_Binary).publish_state(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
number:
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} mth1 #mth1 is 0~2.8m Sensitivity.
|
||||||
|
id: LD1125F_mth1
|
||||||
|
icon: "mdi:cogs"
|
||||||
|
optimistic: true
|
||||||
|
entity_category: config
|
||||||
|
restore_value: true #If you don't want to store the setting at ESP, set it to false.
|
||||||
|
initial_value: "60.0" #Default mth1 Setting
|
||||||
|
min_value: 10.0
|
||||||
|
max_value: 600.0
|
||||||
|
step: 5.0
|
||||||
|
set_action:
|
||||||
|
then:
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string th1st = "mth1=" + str_sprintf("%.0f",x) +"\r\n";
|
||||||
|
return std::vector<uint8_t>(th1st.begin(), th1st.end());
|
||||||
|
- delay: 100ms
|
||||||
|
- uart.write: # save
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: "save\r\n"
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} mth2 #mth2 is 2.8~8m Sensitivity.
|
||||||
|
id: LD1125F_mth2
|
||||||
|
icon: "mdi:cogs"
|
||||||
|
optimistic: true
|
||||||
|
entity_category: config
|
||||||
|
restore_value: true #If you don't want to store the setting at ESP, set it to false.
|
||||||
|
initial_value: "30" #Default mth2 Setting
|
||||||
|
min_value: 5
|
||||||
|
max_value: 300
|
||||||
|
step: 5
|
||||||
|
set_action:
|
||||||
|
then:
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string th2st = "mth2=" + str_sprintf("%.0f",x) +"\r\n";
|
||||||
|
return std::vector<uint8_t>(th2st.begin(), th2st.end());
|
||||||
|
- delay: 100ms
|
||||||
|
- uart.write: # save
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: "save\r\n"
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} mth3 #mth3 is above 8m Sensitivity.
|
||||||
|
id: LD1125F_mth3
|
||||||
|
icon: "mdi:cogs"
|
||||||
|
entity_category: config
|
||||||
|
optimistic: true
|
||||||
|
restore_value: true #If you don't want to store the setting at ESP, set it to false.
|
||||||
|
initial_value: "20" #Default mth3 Setting
|
||||||
|
min_value: 5
|
||||||
|
max_value: 200
|
||||||
|
step: 5
|
||||||
|
set_action:
|
||||||
|
then:
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string th3st = "mth3=" + str_sprintf("%.0f",x) +"\r\n";
|
||||||
|
return std::vector<uint8_t>(th3st.begin(), th3st.end());
|
||||||
|
- delay: 100ms
|
||||||
|
- uart.write: # save
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: "save\r\n"
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} Max Distance #rmax is max detection distance.
|
||||||
|
id: LD1125F_rmax
|
||||||
|
icon: "mdi:cogs"
|
||||||
|
entity_category: config
|
||||||
|
optimistic: true
|
||||||
|
unit_of_measurement: m
|
||||||
|
restore_value: true #If you don't want to store the setting at ESP, set it to false.
|
||||||
|
initial_value: "8" #Default rmax Setting
|
||||||
|
min_value: 0.4
|
||||||
|
max_value: 12
|
||||||
|
step: 0.2
|
||||||
|
set_action:
|
||||||
|
then:
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string rmaxst = "rmax=" + str_sprintf("%.1f",x) +"\r\n";
|
||||||
|
return std::vector<uint8_t>(rmaxst.begin(), rmaxst.end());
|
||||||
|
- delay: 100ms
|
||||||
|
- uart.write: # save
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: "save\r\n"
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} LD1125F Refresh Rate
|
||||||
|
id: LD1125F_utons
|
||||||
|
icon: "mdi:refresh"
|
||||||
|
entity_category: config
|
||||||
|
optimistic: true
|
||||||
|
unit_of_measurement: ms
|
||||||
|
restore_value: true
|
||||||
|
initial_value: "100"
|
||||||
|
min_value: 100
|
||||||
|
max_value: 5000
|
||||||
|
step: 50
|
||||||
|
set_action:
|
||||||
|
then:
|
||||||
|
- uart.write:
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: !lambda |-
|
||||||
|
std::string utonsst = "utons=" + std::to_string(x) + "\r\n";
|
||||||
|
return std::vector<uint8_t>(utonsst.begin(), utonsst.end());
|
||||||
|
- delay: 100ms
|
||||||
|
- uart.write: # save
|
||||||
|
id: LD1125F_UART_BUS
|
||||||
|
data: "save\r\n"
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} Clearence Time
|
||||||
|
id: LD1125F_Clear_Time
|
||||||
|
icon: "mdi:cogs"
|
||||||
|
optimistic: true
|
||||||
|
entity_category: config
|
||||||
|
restore_value: true #If you don't want to store the setting at ESP, set it to false.
|
||||||
|
initial_value: "5" #LD1125F Mov/Occ > Clearence Time Here
|
||||||
|
min_value: 0.5
|
||||||
|
max_value: 20
|
||||||
|
step: 0.5
|
||||||
|
- platform: template
|
||||||
|
name: ${upper_devicename} Movement Time
|
||||||
|
id: LD1125F_Mov_Time
|
||||||
|
icon: "mdi:cogs"
|
||||||
|
optimistic: true
|
||||||
|
entity_category: config
|
||||||
|
restore_value: true #If you don't want to store the setting at ESP, set it to false.
|
||||||
|
initial_value: "1" #LD1125F Mov > Occ Time Here
|
||||||
|
min_value: 0.5
|
||||||
|
max_value: 10
|
||||||
|
step: 0.5
|
||||||
|
|
||||||
6
l12/yaml/README.md
Normal file
6
l12/yaml/README.md
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
sensor main page: https://docs.screek.io/l12
|
||||||
|
|
||||||
|
The ld2412 library is heavily based on @sebcaps’ ld2410 library. Many thanks to him for his outstanding work.
|
||||||
|
We would also like to express our gratitude to all the users who participated in the early testing of the L12 sensor.
|
||||||
|
|
||||||
|
We are excited to have developed a new DIY sensor together.
|
||||||
236
l12/yaml/beta/human-sensor-l12-github.yaml
Normal file
236
l12/yaml/beta/human-sensor-l12-github.yaml
Normal file
|
|
@ -0,0 +1,236 @@
|
||||||
|
esphome:
|
||||||
|
name: screek-human-sensor-l12
|
||||||
|
comment: Screek Human Sensor L12
|
||||||
|
friendly_name: Human Sensor L12
|
||||||
|
name_add_mac_suffix: True
|
||||||
|
platformio_options:
|
||||||
|
board_build.flash_mode: dio
|
||||||
|
project:
|
||||||
|
name: SCREEK.Human Sensor L12
|
||||||
|
version: 25.12.21-B
|
||||||
|
|
||||||
|
logger:
|
||||||
|
# level: VERY_VERBOSE
|
||||||
|
# level: DEBUG
|
||||||
|
|
||||||
|
preferences:
|
||||||
|
flash_write_interval: 5s
|
||||||
|
|
||||||
|
external_components:
|
||||||
|
- source:
|
||||||
|
type: git
|
||||||
|
url: https://github.com/screekworkshop/custom_components_support_for_screek_l12
|
||||||
|
ref: main
|
||||||
|
components: [ld2412]
|
||||||
|
|
||||||
|
esp32:
|
||||||
|
board: lolin_c3_mini
|
||||||
|
framework:
|
||||||
|
type: esp-idf
|
||||||
|
globals:
|
||||||
|
- id: last_illuminance
|
||||||
|
type: float
|
||||||
|
restore_value: no
|
||||||
|
initial_value: "-1"
|
||||||
|
|
||||||
|
improv_serial:
|
||||||
|
|
||||||
|
debug:
|
||||||
|
update_interval: 30s
|
||||||
|
|
||||||
|
# Enable Home Assistant API
|
||||||
|
api:
|
||||||
|
# encryption:
|
||||||
|
# use you own password
|
||||||
|
# key: "your-api-key"
|
||||||
|
|
||||||
|
ota:
|
||||||
|
- platform: esphome
|
||||||
|
password: "your-ota-password"
|
||||||
|
|
||||||
|
safe_mode:
|
||||||
|
disabled: true
|
||||||
|
|
||||||
|
wifi:
|
||||||
|
# output_power: 15dB
|
||||||
|
power_save_mode: LIGHT
|
||||||
|
# power_save_mode: NONE
|
||||||
|
reboot_timeout: 10min
|
||||||
|
ap:
|
||||||
|
ssid: "HUMAN-SENSOR L12"
|
||||||
|
|
||||||
|
captive_portal:
|
||||||
|
|
||||||
|
web_server:
|
||||||
|
port: 80
|
||||||
|
|
||||||
|
text_sensor:
|
||||||
|
- platform: template
|
||||||
|
name: "SCREEK Version"
|
||||||
|
id: screek_version
|
||||||
|
icon: mdi:information-outline
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
update_interval: never
|
||||||
|
- platform: debug
|
||||||
|
reset_reason:
|
||||||
|
name: "ESP Reset Reason"
|
||||||
|
icon: mdi:anchor
|
||||||
|
disabled_by_default: True
|
||||||
|
- platform: wifi_info
|
||||||
|
ip_address:
|
||||||
|
name: ESP IP Address
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
disabled_by_default: True
|
||||||
|
icon: mdi:ip-network
|
||||||
|
mac_address:
|
||||||
|
name: ESP MAC
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
icon: mdi:ip-network
|
||||||
|
disabled_by_default: True
|
||||||
|
- platform: ld2412
|
||||||
|
version:
|
||||||
|
name: LD2412 FM Version
|
||||||
|
id: ld2412_fm_version
|
||||||
|
mac_address:
|
||||||
|
name: LD2412 Mac
|
||||||
|
id: ld2412_mac
|
||||||
|
|
||||||
|
|
||||||
|
binary_sensor:
|
||||||
|
- platform: status
|
||||||
|
name: Online
|
||||||
|
id: ink_ha_connected
|
||||||
|
- platform: ld2412
|
||||||
|
has_target:
|
||||||
|
name: Presence
|
||||||
|
has_moving_target:
|
||||||
|
name: Moving Target
|
||||||
|
has_still_target:
|
||||||
|
name: Still Target
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: internal_temperature
|
||||||
|
name: "ESP Temperature"
|
||||||
|
unit_of_measurement: °C
|
||||||
|
device_class: TEMPERATURE
|
||||||
|
update_interval: 30s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: uptime
|
||||||
|
name: ESP Uptime
|
||||||
|
id: sys_uptime
|
||||||
|
update_interval: 60s
|
||||||
|
- platform: wifi_signal
|
||||||
|
name: RSSI
|
||||||
|
id: wifi_signal_db
|
||||||
|
update_interval: 60s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: template
|
||||||
|
id: esp_memory
|
||||||
|
icon: mdi:memory
|
||||||
|
name: ESP Free Memory
|
||||||
|
lambda: return heap_caps_get_free_size(MALLOC_CAP_INTERNAL) / 1024;
|
||||||
|
unit_of_measurement: 'kB'
|
||||||
|
state_class: measurement
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
update_interval: 60s
|
||||||
|
- platform: ld2412
|
||||||
|
moving_distance:
|
||||||
|
name : Moving Distance
|
||||||
|
id: moving_distance
|
||||||
|
still_distance:
|
||||||
|
name: Still Distance
|
||||||
|
id: still_distance
|
||||||
|
moving_energy:
|
||||||
|
name: Move Energy
|
||||||
|
still_energy:
|
||||||
|
name: Still Energy
|
||||||
|
luminance:
|
||||||
|
name: luminance
|
||||||
|
|
||||||
|
light:
|
||||||
|
- platform: status_led
|
||||||
|
name: sys_status
|
||||||
|
pin:
|
||||||
|
number: GPIO13
|
||||||
|
ignore_pin_validation_error: true
|
||||||
|
internal: True
|
||||||
|
restore_mode: ALWAYS_OFF
|
||||||
|
- platform: binary
|
||||||
|
name: "Red Info Light"
|
||||||
|
output: board_info_ed
|
||||||
|
entity_category: diagnostic
|
||||||
|
restore_mode: ALWAYS_OFF
|
||||||
|
|
||||||
|
time:
|
||||||
|
- platform: sntp
|
||||||
|
id: time_now
|
||||||
|
|
||||||
|
output:
|
||||||
|
- platform: gpio
|
||||||
|
id: board_info_ed
|
||||||
|
pin:
|
||||||
|
number: GPIO12
|
||||||
|
ignore_pin_validation_error: true
|
||||||
|
|
||||||
|
switch:
|
||||||
|
- platform: factory_reset
|
||||||
|
name: "L12 Factory Reset"
|
||||||
|
disabled_by_default: True
|
||||||
|
icon: mdi:heart-broken
|
||||||
|
entity_category: diagnostic
|
||||||
|
|
||||||
|
button:
|
||||||
|
- platform: restart
|
||||||
|
icon: mdi:power-cycle
|
||||||
|
name: "ESP Reboot"
|
||||||
|
entity_category: diagnostic
|
||||||
|
- platform: template
|
||||||
|
name: "LD2412 BLE Enable"
|
||||||
|
# disabled_by_default: True
|
||||||
|
entity_category: "config"
|
||||||
|
icon: mdi:bluetooth
|
||||||
|
on_press:
|
||||||
|
lambda: |-
|
||||||
|
id(ld2412_radar) -> ble_control(true);
|
||||||
|
- platform: template
|
||||||
|
name: "LD2412 BLE Disable"
|
||||||
|
# disabled_by_default: True
|
||||||
|
entity_category: "config"
|
||||||
|
icon: mdi:bluetooth-off
|
||||||
|
on_press:
|
||||||
|
lambda: |-
|
||||||
|
id(ld2412_radar) -> ble_control(false);
|
||||||
|
- platform: template
|
||||||
|
name: "LD2412 Reboot"
|
||||||
|
icon: mdi:radar
|
||||||
|
entity_category: "config"
|
||||||
|
on_press:
|
||||||
|
lambda: |-
|
||||||
|
id(ld2412_radar) -> reboot();
|
||||||
|
- platform: template
|
||||||
|
name: "LD2412 Factory Reset"
|
||||||
|
icon: mdi:restart
|
||||||
|
entity_category: "config"
|
||||||
|
on_press:
|
||||||
|
- lambda: |-
|
||||||
|
id(ld2412_radar) -> factoryReset();
|
||||||
|
|
||||||
|
uart:
|
||||||
|
id: uart_bus
|
||||||
|
tx_pin:
|
||||||
|
number: GPIO11
|
||||||
|
mode:
|
||||||
|
input: true
|
||||||
|
pullup: true
|
||||||
|
rx_pin:
|
||||||
|
number: GPIO7
|
||||||
|
mode:
|
||||||
|
input: true
|
||||||
|
pullup: true
|
||||||
|
baud_rate: 115200
|
||||||
|
parity: NONE
|
||||||
|
stop_bits: 1
|
||||||
|
data_bits: 8
|
||||||
|
|
||||||
|
ld2412:
|
||||||
|
id: ld2412_radar
|
||||||
272
l12/yaml/human-sensor-l12-github.yaml
Normal file
272
l12/yaml/human-sensor-l12-github.yaml
Normal file
|
|
@ -0,0 +1,272 @@
|
||||||
|
esphome:
|
||||||
|
name: screek-human-sensor-l12
|
||||||
|
comment: Screek Human Sensor L12
|
||||||
|
friendly_name: Human Sensor L12
|
||||||
|
name_add_mac_suffix: True
|
||||||
|
platformio_options:
|
||||||
|
board_build.flash_mode: dio
|
||||||
|
project:
|
||||||
|
name: Screek.Human_Presence_Sensor
|
||||||
|
version: L12
|
||||||
|
on_boot:
|
||||||
|
- priority: 100
|
||||||
|
then:
|
||||||
|
lambda: |-
|
||||||
|
id(cpu_speed) = ESP.getCpuFreqMHz();
|
||||||
|
- priority: 300
|
||||||
|
then:
|
||||||
|
lambda: |-
|
||||||
|
id(screek_version).publish_state("BETA_V240712_2");
|
||||||
|
|
||||||
|
logger:
|
||||||
|
# level: VERY_VERBOSE
|
||||||
|
# level: DEBUG
|
||||||
|
|
||||||
|
preferences:
|
||||||
|
flash_write_interval: 5s
|
||||||
|
|
||||||
|
external_components:
|
||||||
|
- source:
|
||||||
|
type: git
|
||||||
|
url: https://github.com/screekworkshop/custom_components_support_for_screek_l12
|
||||||
|
ref: main
|
||||||
|
components: [uart, ld2412]
|
||||||
|
|
||||||
|
esp32:
|
||||||
|
board: lolin_c3_mini
|
||||||
|
framework:
|
||||||
|
type: arduino
|
||||||
|
version: 2.0.9
|
||||||
|
platform_version: 6.3.0
|
||||||
|
|
||||||
|
globals:
|
||||||
|
- id: cpu_speed
|
||||||
|
type: int
|
||||||
|
restore_value: no
|
||||||
|
initial_value: '0'
|
||||||
|
- id: last_update_ld2450
|
||||||
|
type: unsigned long
|
||||||
|
restore_value: no
|
||||||
|
initial_value: '0'
|
||||||
|
- id: init_zone_publish
|
||||||
|
type: bool
|
||||||
|
restore_value: no
|
||||||
|
initial_value: "false"
|
||||||
|
- id: last_illuminance
|
||||||
|
type: float
|
||||||
|
restore_value: no
|
||||||
|
initial_value: "-1"
|
||||||
|
|
||||||
|
improv_serial:
|
||||||
|
|
||||||
|
debug:
|
||||||
|
update_interval: 30s
|
||||||
|
|
||||||
|
# Enable Home Assistant API
|
||||||
|
api:
|
||||||
|
# encryption:
|
||||||
|
# use you own password
|
||||||
|
# key: "your-api-key"
|
||||||
|
|
||||||
|
ota:
|
||||||
|
- platform: esphome
|
||||||
|
password: "your-ota-password"
|
||||||
|
|
||||||
|
safe_mode:
|
||||||
|
disabled: true
|
||||||
|
|
||||||
|
wifi:
|
||||||
|
# output_power: 15dB
|
||||||
|
power_save_mode: LIGHT
|
||||||
|
# power_save_mode: NONE
|
||||||
|
reboot_timeout: 10min
|
||||||
|
ap:
|
||||||
|
ssid: "HUMAN-SENSOR L12"
|
||||||
|
|
||||||
|
captive_portal:
|
||||||
|
|
||||||
|
web_server:
|
||||||
|
port: 80
|
||||||
|
|
||||||
|
text_sensor:
|
||||||
|
- platform: template
|
||||||
|
name: "SCREEK Version"
|
||||||
|
id: screek_version
|
||||||
|
icon: mdi:information-outline
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
update_interval: never
|
||||||
|
- platform: debug
|
||||||
|
reset_reason:
|
||||||
|
name: "ESP Reset Reason"
|
||||||
|
icon: mdi:anchor
|
||||||
|
disabled_by_default: True
|
||||||
|
- platform: wifi_info
|
||||||
|
ip_address:
|
||||||
|
name: ESP IP Address
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
disabled_by_default: True
|
||||||
|
icon: mdi:ip-network
|
||||||
|
mac_address:
|
||||||
|
name: ESP MAC
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
icon: mdi:ip-network
|
||||||
|
disabled_by_default: True
|
||||||
|
- platform: ld2412
|
||||||
|
version:
|
||||||
|
name: LD2412 FM Version
|
||||||
|
id: ld2412_fm_version
|
||||||
|
mac_address:
|
||||||
|
name: LD2412 Mac
|
||||||
|
id: ld2412_mac
|
||||||
|
|
||||||
|
|
||||||
|
binary_sensor:
|
||||||
|
- platform: status
|
||||||
|
name: Online
|
||||||
|
id: ink_ha_connected
|
||||||
|
- platform: ld2412
|
||||||
|
has_target:
|
||||||
|
name: Presence
|
||||||
|
has_moving_target:
|
||||||
|
name: Moving Target
|
||||||
|
has_still_target:
|
||||||
|
name: Still Target
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: template
|
||||||
|
name: "ESP CPU Speed"
|
||||||
|
accuracy_decimals: 0
|
||||||
|
icon: mdi:cpu-32-bit
|
||||||
|
unit_of_measurement: Mhz
|
||||||
|
disabled_by_default: True
|
||||||
|
lambda: |-
|
||||||
|
return (id(cpu_speed));
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
update_interval: 600s
|
||||||
|
- platform: template
|
||||||
|
id: sys_esp_temperature
|
||||||
|
name: ESP Temperature
|
||||||
|
lambda: return temperatureRead();
|
||||||
|
unit_of_measurement: °C
|
||||||
|
device_class: TEMPERATURE
|
||||||
|
update_interval: 45s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: uptime
|
||||||
|
name: ESP Uptime
|
||||||
|
id: sys_uptime
|
||||||
|
update_interval: 60s
|
||||||
|
- platform: wifi_signal
|
||||||
|
name: RSSI
|
||||||
|
id: wifi_signal_db
|
||||||
|
update_interval: 60s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: template
|
||||||
|
id: esp_memory
|
||||||
|
icon: mdi:memory
|
||||||
|
name: ESP Free Memory
|
||||||
|
lambda: return heap_caps_get_free_size(MALLOC_CAP_INTERNAL) / 1024;
|
||||||
|
unit_of_measurement: 'kB'
|
||||||
|
state_class: measurement
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
update_interval: 60s
|
||||||
|
- platform: ld2412
|
||||||
|
moving_distance:
|
||||||
|
name : Moving Distance
|
||||||
|
id: moving_distance
|
||||||
|
still_distance:
|
||||||
|
name: Still Distance
|
||||||
|
id: still_distance
|
||||||
|
moving_energy:
|
||||||
|
name: Move Energy
|
||||||
|
still_energy:
|
||||||
|
name: Still Energy
|
||||||
|
luminance:
|
||||||
|
name: luminance
|
||||||
|
|
||||||
|
light:
|
||||||
|
- platform: status_led
|
||||||
|
name: sys_status
|
||||||
|
pin:
|
||||||
|
number: GPIO13
|
||||||
|
ignore_pin_validation_error: true
|
||||||
|
internal: True
|
||||||
|
restore_mode: ALWAYS_OFF
|
||||||
|
- platform: binary
|
||||||
|
name: "Red Info Light"
|
||||||
|
output: board_info_ed
|
||||||
|
entity_category: diagnostic
|
||||||
|
restore_mode: ALWAYS_OFF
|
||||||
|
|
||||||
|
time:
|
||||||
|
- platform: sntp
|
||||||
|
id: time_now
|
||||||
|
|
||||||
|
output:
|
||||||
|
- platform: gpio
|
||||||
|
id: board_info_ed
|
||||||
|
pin:
|
||||||
|
number: GPIO12
|
||||||
|
ignore_pin_validation_error: true
|
||||||
|
|
||||||
|
switch:
|
||||||
|
- platform: factory_reset
|
||||||
|
name: "L12 Factory Reset"
|
||||||
|
disabled_by_default: True
|
||||||
|
icon: mdi:heart-broken
|
||||||
|
entity_category: diagnostic
|
||||||
|
|
||||||
|
button:
|
||||||
|
- platform: restart
|
||||||
|
icon: mdi:power-cycle
|
||||||
|
name: "ESP Reboot"
|
||||||
|
entity_category: diagnostic
|
||||||
|
- platform: template
|
||||||
|
name: "LD2412 BLE Enable"
|
||||||
|
# disabled_by_default: True
|
||||||
|
entity_category: "config"
|
||||||
|
icon: mdi:bluetooth
|
||||||
|
on_press:
|
||||||
|
lambda: |-
|
||||||
|
id(ld2412_radar) -> ble_control(true);
|
||||||
|
- platform: template
|
||||||
|
name: "LD2412 BLE Disable"
|
||||||
|
# disabled_by_default: True
|
||||||
|
entity_category: "config"
|
||||||
|
icon: mdi:bluetooth-off
|
||||||
|
on_press:
|
||||||
|
lambda: |-
|
||||||
|
id(ld2412_radar) -> ble_control(false);
|
||||||
|
- platform: template
|
||||||
|
name: "LD2412 Reboot"
|
||||||
|
icon: mdi:radar
|
||||||
|
entity_category: "config"
|
||||||
|
on_press:
|
||||||
|
lambda: |-
|
||||||
|
id(ld2412_radar) -> reboot();
|
||||||
|
- platform: template
|
||||||
|
name: "LD2412 Factory Reset"
|
||||||
|
icon: mdi:restart
|
||||||
|
entity_category: "config"
|
||||||
|
on_press:
|
||||||
|
- lambda: |-
|
||||||
|
id(ld2412_radar) -> factoryReset();
|
||||||
|
|
||||||
|
uart:
|
||||||
|
id: uart_bus
|
||||||
|
tx_pin:
|
||||||
|
number: GPIO11
|
||||||
|
mode:
|
||||||
|
input: true
|
||||||
|
pullup: true
|
||||||
|
rx_pin:
|
||||||
|
number: GPIO7
|
||||||
|
mode:
|
||||||
|
input: true
|
||||||
|
pullup: true
|
||||||
|
baud_rate: 115200
|
||||||
|
parity: NONE
|
||||||
|
stop_bits: 1
|
||||||
|
data_bits: 8
|
||||||
|
|
||||||
|
ld2412:
|
||||||
|
id: ld2412_radar
|
||||||
292
l13/yaml/human-sensor-l13-github.yaml
Normal file
292
l13/yaml/human-sensor-l13-github.yaml
Normal file
|
|
@ -0,0 +1,292 @@
|
||||||
|
esphome:
|
||||||
|
name: screek-human-sensor-l13
|
||||||
|
comment: Screek Human Sensor L13
|
||||||
|
friendly_name: Human Sensor L13
|
||||||
|
name_add_mac_suffix: True
|
||||||
|
platformio_options:
|
||||||
|
board_build.flash_mode: dio
|
||||||
|
# board_build.f_cpu: 80000000L
|
||||||
|
project:
|
||||||
|
name: Screek.Human_Presence_Sensor
|
||||||
|
version: L13
|
||||||
|
on_boot:
|
||||||
|
- priority: 1000
|
||||||
|
then:
|
||||||
|
- lambda: |-
|
||||||
|
pinMode(2, OUTPUT);
|
||||||
|
digitalWrite(2, LOW);
|
||||||
|
delay(100);
|
||||||
|
- priority: 100
|
||||||
|
then:
|
||||||
|
lambda: |-
|
||||||
|
id(cpu_speed) = ESP.getCpuFreqMHz();
|
||||||
|
|
||||||
|
logger:
|
||||||
|
# level: VERY_VERBOSE
|
||||||
|
# level: DEBUG
|
||||||
|
|
||||||
|
preferences:
|
||||||
|
flash_write_interval: 5s
|
||||||
|
|
||||||
|
external_components:
|
||||||
|
- source:
|
||||||
|
type: git
|
||||||
|
url: https://github.com/screekworkshop/custom_components_support_for_screek_l12
|
||||||
|
ref: main
|
||||||
|
components: [ld2412]
|
||||||
|
|
||||||
|
esp32:
|
||||||
|
board: lolin_c3_mini
|
||||||
|
framework:
|
||||||
|
type: arduino
|
||||||
|
# version: 2.0.9
|
||||||
|
# platform_version: 6.3.0
|
||||||
|
|
||||||
|
globals:
|
||||||
|
- id: cpu_speed
|
||||||
|
type: int
|
||||||
|
restore_value: no
|
||||||
|
initial_value: '0'
|
||||||
|
- id: last_update_ld2450
|
||||||
|
type: unsigned long
|
||||||
|
restore_value: no
|
||||||
|
initial_value: '0'
|
||||||
|
- id: init_zone_publish
|
||||||
|
type: bool
|
||||||
|
restore_value: no
|
||||||
|
initial_value: "false"
|
||||||
|
- id: last_illuminance
|
||||||
|
type: float
|
||||||
|
restore_value: no
|
||||||
|
initial_value: "-1"
|
||||||
|
|
||||||
|
improv_serial:
|
||||||
|
|
||||||
|
debug:
|
||||||
|
update_interval: 30s
|
||||||
|
|
||||||
|
# Enable Home Assistant API
|
||||||
|
api:
|
||||||
|
# encryption:
|
||||||
|
# use you own password
|
||||||
|
# key: "b1b1F1ArnSZmIvk7WLL9oG19gjPTCmBP1irQlSlSDGY="
|
||||||
|
|
||||||
|
ota:
|
||||||
|
- platform: esphome
|
||||||
|
password: "your-ota-password"
|
||||||
|
|
||||||
|
safe_mode:
|
||||||
|
disabled: true
|
||||||
|
|
||||||
|
wifi:
|
||||||
|
# power_save_mode: LIGHT
|
||||||
|
reboot_timeout: 10min
|
||||||
|
ap:
|
||||||
|
ssid: "HUMAN-SENSOR L13"
|
||||||
|
|
||||||
|
captive_portal:
|
||||||
|
|
||||||
|
web_server:
|
||||||
|
port: 80
|
||||||
|
|
||||||
|
text_sensor:
|
||||||
|
- platform: debug
|
||||||
|
reset_reason:
|
||||||
|
name: "ESP Reset Reason"
|
||||||
|
icon: mdi:anchor
|
||||||
|
disabled_by_default: True
|
||||||
|
- platform: wifi_info
|
||||||
|
ip_address:
|
||||||
|
name: ESP IP Address
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
disabled_by_default: True
|
||||||
|
icon: mdi:ip-network
|
||||||
|
mac_address:
|
||||||
|
name: ESP MAC
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
icon: mdi:ip-network
|
||||||
|
disabled_by_default: True
|
||||||
|
- platform: ld2412
|
||||||
|
version:
|
||||||
|
name: LD2412S FM Version
|
||||||
|
id: ld2412_fm_version
|
||||||
|
mac_address:
|
||||||
|
name: LD2412S Mac
|
||||||
|
id: ld2412_mac
|
||||||
|
|
||||||
|
|
||||||
|
binary_sensor:
|
||||||
|
- platform: status
|
||||||
|
name: Online
|
||||||
|
id: ink_ha_connected
|
||||||
|
- platform: ld2412
|
||||||
|
has_target:
|
||||||
|
name: Presence
|
||||||
|
has_moving_target:
|
||||||
|
name: Moving Target
|
||||||
|
has_still_target:
|
||||||
|
name: Still Target
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: template
|
||||||
|
name: "ESP CPU Speed"
|
||||||
|
accuracy_decimals: 0
|
||||||
|
icon: mdi:cpu-32-bit
|
||||||
|
unit_of_measurement: Mhz
|
||||||
|
disabled_by_default: True
|
||||||
|
lambda: |-
|
||||||
|
return (id(cpu_speed));
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
update_interval: 600s
|
||||||
|
- platform: template
|
||||||
|
id: sys_esp_temperature
|
||||||
|
name: ESP Temperature
|
||||||
|
lambda: return temperatureRead();
|
||||||
|
unit_of_measurement: °C
|
||||||
|
device_class: TEMPERATURE
|
||||||
|
update_interval: 45s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: uptime
|
||||||
|
name: ESP Uptime
|
||||||
|
id: sys_uptime
|
||||||
|
update_interval: 60s
|
||||||
|
- platform: wifi_signal
|
||||||
|
name: RSSI
|
||||||
|
id: wifi_signal_db
|
||||||
|
update_interval: 60s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: template
|
||||||
|
id: esp_memory
|
||||||
|
icon: mdi:memory
|
||||||
|
name: ESP Free Memory
|
||||||
|
lambda: return heap_caps_get_free_size(MALLOC_CAP_INTERNAL) / 1024;
|
||||||
|
unit_of_measurement: 'kB'
|
||||||
|
state_class: measurement
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
update_interval: 60s
|
||||||
|
- platform: ld2412
|
||||||
|
moving_distance:
|
||||||
|
name : Moving Distance
|
||||||
|
id: moving_distance
|
||||||
|
still_distance:
|
||||||
|
name: Still Distance
|
||||||
|
id: still_distance
|
||||||
|
moving_energy:
|
||||||
|
name: Move Energy
|
||||||
|
still_energy:
|
||||||
|
name: Still Energy
|
||||||
|
luminance:
|
||||||
|
name: LD2412S luminance
|
||||||
|
entity_category: diagnostic
|
||||||
|
- platform: bh1750
|
||||||
|
name: "BH1750 Illuminance"
|
||||||
|
address: 0x23
|
||||||
|
update_interval: 1s
|
||||||
|
|
||||||
|
light:
|
||||||
|
- platform: status_led
|
||||||
|
name: sys_status
|
||||||
|
pin:
|
||||||
|
number: GPIO13
|
||||||
|
ignore_pin_validation_error: True
|
||||||
|
internal: True
|
||||||
|
restore_mode: ALWAYS_OFF
|
||||||
|
- platform: binary
|
||||||
|
name: "Red Info Light"
|
||||||
|
output: board_info_ed
|
||||||
|
entity_category: diagnostic
|
||||||
|
restore_mode: ALWAYS_OFF
|
||||||
|
|
||||||
|
time:
|
||||||
|
- platform: sntp
|
||||||
|
id: time_now
|
||||||
|
|
||||||
|
output:
|
||||||
|
- platform: gpio
|
||||||
|
id: board_info_ed
|
||||||
|
pin:
|
||||||
|
number: GPIO12
|
||||||
|
ignore_pin_validation_error: True
|
||||||
|
|
||||||
|
esp32_improv:
|
||||||
|
authorizer: none
|
||||||
|
on_start:
|
||||||
|
then:
|
||||||
|
- logger.log: "Improv awaiting authorization/authorized"
|
||||||
|
on_provisioned:
|
||||||
|
then:
|
||||||
|
- logger.log: "Improv provisioned"
|
||||||
|
on_provisioning:
|
||||||
|
then:
|
||||||
|
- logger.log: "Improv provisioning"
|
||||||
|
on_stop:
|
||||||
|
then:
|
||||||
|
- logger.log: "Improv stopped"
|
||||||
|
|
||||||
|
switch:
|
||||||
|
- platform: factory_reset
|
||||||
|
name: "L13 Factory Reset" # 或许最好把雷达模块也重新初始化
|
||||||
|
disabled_by_default: True
|
||||||
|
icon: mdi:heart-broken
|
||||||
|
entity_category: diagnostic
|
||||||
|
|
||||||
|
button:
|
||||||
|
- platform: restart
|
||||||
|
icon: mdi:power-cycle
|
||||||
|
name: "ESP Reboot"
|
||||||
|
entity_category: diagnostic
|
||||||
|
- platform: template
|
||||||
|
name: "LD2412S BLE Enable"
|
||||||
|
# disabled_by_default: True
|
||||||
|
entity_category: "config"
|
||||||
|
icon: mdi:bluetooth
|
||||||
|
on_press:
|
||||||
|
lambda: |-
|
||||||
|
id(ld2412s_radar) -> ble_control(true);
|
||||||
|
- platform: template
|
||||||
|
name: "LD2412S BLE Disable"
|
||||||
|
# disabled_by_default: True
|
||||||
|
entity_category: "config"
|
||||||
|
icon: mdi:bluetooth-off
|
||||||
|
on_press:
|
||||||
|
lambda: |-
|
||||||
|
id(ld2412s_radar) -> ble_control(false);
|
||||||
|
- platform: template
|
||||||
|
name: "LD2412S Reboot"
|
||||||
|
icon: mdi:radar
|
||||||
|
entity_category: "config"
|
||||||
|
on_press:
|
||||||
|
lambda: |-
|
||||||
|
id(ld2412s_radar) -> reboot();
|
||||||
|
- platform: template
|
||||||
|
name: "LD2412S Factory Reset"
|
||||||
|
icon: mdi:restart
|
||||||
|
entity_category: "config"
|
||||||
|
on_press:
|
||||||
|
- lambda: |-
|
||||||
|
id(ld2412s_radar) -> factoryReset();
|
||||||
|
|
||||||
|
uart:
|
||||||
|
id: uart_bus
|
||||||
|
tx_pin:
|
||||||
|
number: GPIO11
|
||||||
|
mode:
|
||||||
|
input: true
|
||||||
|
pullup: true
|
||||||
|
rx_pin:
|
||||||
|
number: GPIO7
|
||||||
|
mode:
|
||||||
|
input: true
|
||||||
|
pullup: true
|
||||||
|
baud_rate: 115200
|
||||||
|
parity: NONE
|
||||||
|
stop_bits: 1
|
||||||
|
data_bits: 8
|
||||||
|
|
||||||
|
i2c:
|
||||||
|
sda: 10
|
||||||
|
scl: 3
|
||||||
|
scan: True
|
||||||
|
|
||||||
|
ld2412:
|
||||||
|
id: ld2412s_radar
|
||||||
Loading…
Reference in New Issue
Block a user