296 lines
6.9 KiB
YAML
Executable File
296 lines
6.9 KiB
YAML
Executable File
# This is a custom firmware for Human Presence Sensor 1U
|
|
# https://screek.io/1u
|
|
|
|
# Common bootstrap
|
|
api:
|
|
port: 6053
|
|
reboot_timeout: "15min"
|
|
password: !secret api_password
|
|
ota:
|
|
password: !secret ota_password
|
|
reboot_timeout: "5min"
|
|
|
|
wifi:
|
|
ssid: !seret wifi_ssod
|
|
password: !secret wifi_password
|
|
|
|
ap:
|
|
# Not configuring the ssid means that the hostname is used
|
|
#ssid:
|
|
password: !secret ap_password
|
|
|
|
# Almost all nodes will have the same domain, but it should still be configurable
|
|
# the esph.py script automatically inserts a substitution for it
|
|
domain: ${domain}
|
|
|
|
# ESP32 S2 Mini specific, the default power saving mode causes it disconnect somewhat frequntly
|
|
# the default for esp32 is 'light'
|
|
power_save_mode: none
|
|
output_power: 15dB
|
|
|
|
# from packages/common/network.yaml
|
|
web_server:
|
|
port: 80
|
|
version: 2
|
|
include_internal: true
|
|
js_url: "https://www.sudo.is/esphome/webserver-v2.min.js"
|
|
mdns:
|
|
disabled: true
|
|
|
|
# This enables the captive portal that is confifured under wifi.ap
|
|
captive_portal:
|
|
|
|
packages:
|
|
sensors_esphome: !include ../packages/sensors/esphome.yaml
|
|
sensors_wifi: !include ../packages/sensors/wifi.yaml
|
|
|
|
# from packages/sensors/wifi.yaml
|
|
sensor:
|
|
- platform: wifi_signal
|
|
internal: true
|
|
name: "${hostname} WiFi signal strength"
|
|
id: "${lower_underscored_node_name}_wifi_signal_strength"
|
|
update_interval: 60s
|
|
entity_category: "diagnostic"
|
|
unit_of_measurement: "dBm"
|
|
filters:
|
|
- throttle: 900s
|
|
# Report the WiFi signal strength in %
|
|
- platform: copy
|
|
source_id: ${lower_underscored_node_name}_wifi_signal_strength
|
|
name: "${hostname} WiFi signal"
|
|
unit_of_measurement: "%"
|
|
device_class: power_factor
|
|
entity_category: "diagnostic"
|
|
filters:
|
|
- lambda: !lambda |-
|
|
return min(max(2 * (x + 100.0), 0.0), 100.0);
|
|
text_sensor:
|
|
- platform: wifi_info
|
|
ip_address:
|
|
name: "${hostname} Wifi IP"
|
|
entity_category: "diagnostic"
|
|
ssid:
|
|
name: "${hostname} Wifi SSID"
|
|
entity_category: "diagnostic"
|
|
mac_address:
|
|
name: "${hostname} WiFi MAC"
|
|
entity_category: "diagnostic"
|
|
dns_address:
|
|
name: "${hostname} Wifi DNS"
|
|
entity_category: "diagnostic"
|
|
|
|
|
|
esphome:
|
|
name: esphome-screek-1u
|
|
comment: Screek Human Presence Sensor 1U
|
|
friendly_name: Screek Human Presence Sensor 1U
|
|
name_add_mac_suffix: true
|
|
platformio_options:
|
|
board_build.flash_mode: dio
|
|
board_build.f_cpu: 80000000L
|
|
upload_speed: 115200
|
|
on_boot:
|
|
priority: 900
|
|
then:
|
|
lambda: |-
|
|
id(cpu_speed) = ESP.getCpuFreqMHz() ;
|
|
project:
|
|
name: Screek.Human_Presence_Sensor
|
|
version: 1U
|
|
min_version: 2023.6.1
|
|
# from packages/common/esphome.yaml
|
|
build_path: "${build_path}"
|
|
|
|
globals:
|
|
- id: cpu_speed
|
|
type: int
|
|
restore_value: no
|
|
initial_value: '0'
|
|
|
|
external_components:
|
|
# - source: github://screek-workshop/custom_components_support_for_screek_1u
|
|
- source:
|
|
type: git
|
|
url: https://github.com/screek-workshop/custom_components_support_for_screek_1u
|
|
ref: master
|
|
# components: [ ld2410, uart ]
|
|
|
|
esp32:
|
|
board: lolin_s2_mini
|
|
#variant: ESP32S2
|
|
framework:
|
|
type: arduino
|
|
version: 2.0.9
|
|
platform_version: 6.3.2
|
|
|
|
logger:
|
|
hardware_uart: uart0
|
|
|
|
wifi:
|
|
# power_save_mode: NONE
|
|
output_power: 15dB
|
|
power_save_mode: LIGHT
|
|
|
|
# from packages/common/network.yaml
|
|
ssid: !secret wifi_ssid
|
|
password: !secret wifi_password
|
|
|
|
ap:
|
|
# Not configuring the ssid means that the hostname is used
|
|
#ssid:
|
|
password: !secret ap_password
|
|
|
|
# Almost all nodes will have the same domain, but it should still be configurable
|
|
# the esph.py script automatically inserts a substitution for it
|
|
domain: ${domain}
|
|
|
|
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
|
|
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
|
|
name: ESP Temperature
|
|
lambda: return temperatureRead();
|
|
unit_of_measurement: °C
|
|
device_class: TEMPERATURE
|
|
update_interval: 5s
|
|
entity_category: "diagnostic"
|
|
|
|
- platform: uptime
|
|
name: Uptime
|
|
id: sys_uptime
|
|
update_interval: 10s
|
|
|
|
- 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
|
|
|
|
light:
|
|
- platform: status_led
|
|
name: sys_status
|
|
pin: GPIO15
|
|
internal: True
|
|
restore_mode: ALWAYS_OFF
|
|
|
|
time:
|
|
- platform: sntp
|
|
id: time_sntp
|
|
|
|
uart:
|
|
id: uart_ld2410
|
|
tx_pin: GPIO18
|
|
rx_pin: GPIO33
|
|
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"
|
|
# disabled_by_default: True
|
|
entity_category: "config"
|
|
icon: mdi:bluetooth
|
|
on_press:
|
|
lambda: |-
|
|
id(ld2410_radar) -> ble_control(true);
|
|
|
|
- platform: template
|
|
name: "Disable LD2410 BLE"
|
|
# disabled_by_default: True
|
|
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
|