Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- esphome:
- name: "stairspresence"
- friendly_name: "stairspresence"
- platformio_options:
- board_build.f_flash: 40000000L
- board_build.flash_mode: dio
- board_build.flash_size: 4MB
- esp32:
- board: esp32-c3-devkitm-1
- framework:
- type: arduino
- # Enable logging
- #logger:
- # Enable Home Assistant API
- api:
- encryption:
- key: ""
- ota:
- - platform: esphome
- password: ""
- wifi:
- ssid: !secret wifi_ssid
- password: !secret wifi_password
- # Enable fallback hotspot (captive portal) in case wifi connection fails
- ap:
- ssid: "${name} Hotspot"
- password: !secret hotspot_password
- captive_portal:
- #improv_serial:
- web_server:
- port: 80
- esp32_ble_tracker:
- scan_parameters:
- active: true
- bluetooth_proxy:
- active: true
- ld2410:
- id: ld2410_radar
- # throttle: 1500ms
- uart:
- tx_pin: GPIO04
- rx_pin: GPIO05
- baud_rate: 256000
- parity: NONE
- stop_bits: 1
- i2c:
- #- id: bus_b
- # sda: GPIO06 #brown
- # scl: GPIO07 #red
- # scan: true
- - id: bus_a
- sda: GPIO18
- scl: GPIO19
- scan: true
- number:
- - platform: ld2410
- timeout:
- name: Radar Timeout
- max_move_distance_gate:
- name: Max Move Distance
- max_still_distance_gate:
- name: Max Still Distance
- g0:
- move_threshold:
- name: g0 move threshold
- still_threshold:
- name: g0 still threshold
- g1:
- move_threshold:
- name: g1 move threshold
- still_threshold:
- name: g1 still threshold
- g2:
- move_threshold:
- name: g2 move threshold
- still_threshold:
- name: g2 still threshold
- g3:
- move_threshold:
- name: g3 move threshold
- still_threshold:
- name: g3 still threshold
- g4:
- move_threshold:
- name: g4 move threshold
- still_threshold:
- name: g4 still threshold
- g5:
- move_threshold:
- name: g5 move threshold
- still_threshold:
- name: g5 still threshold
- g6:
- move_threshold:
- name: g6 move threshold
- still_threshold:
- name: g6 still threshold
- g7:
- move_threshold:
- name: g7 move threshold
- still_threshold:
- name: g7 still threshold
- g8:
- move_threshold:
- name: g8 move threshold
- still_threshold:
- name: g8 still threshold
- # Setting start of zone 1 occupancy
- - platform: template
- name: "Zone 1 Start"
- id: radar_z1_start
- device_class: distance
- min_value: 0
- max_value: 800
- step: 1
- mode: box
- update_interval: never
- optimistic: true
- restore_value: true
- initial_value: 0
- icon: "mdi:arrow-collapse-right"
- entity_category: CONFIG
- unit_of_measurement: "cm"
- # Setting ending of zone 1 occupancy
- - platform: template
- name: "End Zone 1"
- id: radar_z1_end
- device_class: distance
- min_value: 0
- max_value: 800
- step: 1
- mode: box
- update_interval: never
- optimistic: true
- restore_value: true
- initial_value: 50
- icon: "mdi:arrow-collapse-right"
- entity_category: CONFIG
- unit_of_measurement: "cm"
- # Setting ending of zone 2 occupancy
- - platform: template
- name: "End Zone 2"
- id: radar_z2_end
- device_class: distance
- min_value: 0
- max_value: 800
- step: 1
- mode: box
- update_interval: never
- optimistic: true
- restore_value: true
- initial_value: 150
- icon: "mdi:arrow-collapse-right"
- entity_category: CONFIG
- unit_of_measurement: "cm"
- # Setting ending of zone 3 occupancy
- - platform: template
- name: "End Zone 3"
- id: radar_z3_end
- device_class: distance
- min_value: 0
- max_value: 800
- step: 1
- mode: box
- update_interval: never
- optimistic: true
- restore_value: true
- initial_value: 250
- icon: "mdi:arrow-collapse-right"
- entity_category: CONFIG
- unit_of_measurement: "cm"
- binary_sensor:
- - platform: ld2410
- has_target:
- name: Presence
- id: radar_has_target
- # lambda: |-
- # if (id(radar_has_target).state){
- # id(blink_light)->execute(500);
- # } else {
- # id(blink_light)->execute(100);
- # }
- has_moving_target:
- name: Moving Target
- has_still_target:
- name: Still Target
- out_pin_presence_status:
- name: out pin presence status
- ## Set Up Radar Zones Based On Distance
- - platform: template
- name: "Zone 1 Occupancy"
- id: radar_zone_1_occupancy
- device_class: occupancy
- icon: mdi:motion-sensor
- lambda: |-
- if ((id(radar_has_target).state) && ((id(radar_detection_distance).state < id(radar_z1_end).state) && (id(radar_detection_distance).state > id(radar_z1_start).state))){
- return true;
- } else {
- return false;
- }
- - platform: template
- name: "Zone 2 Occupancy"
- id: radar_zone_2_occupancy
- device_class: occupancy
- icon: mdi:motion-sensor
- lambda: |-
- if ((id(radar_has_target).state) && ((id(radar_z1_end).state < id(radar_detection_distance).state) && (id(radar_detection_distance).state < id(radar_z2_end).state))) {
- return true;
- } else {
- return false;
- }
- - platform: template
- name: "Zone 3 Occupancy"
- id: radar_zone_3_occupancy
- device_class: occupancy
- icon: mdi:motion-sensor
- lambda: |-
- if ((id(radar_has_target).state) && ((id(radar_z2_end).state < id(radar_detection_distance).state) && (id(radar_detection_distance).state < id(radar_z3_end).state))) {
- return true;
- } else {
- return false;
- }
- sensor:
- - platform: internal_temperature
- name: "ESP Temperature"
- id: sys_esp_temperature
- - platform: uptime
- name: Uptime
- id: sys_uptime
- update_interval: 60s
- - platform: ltr390
- uv_index:
- name: "UV Index"
- light:
- name: "Light"
- filters:
- - multiply: 1.2
- i2c_id: bus_a
- address: 0x53
- - 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
- id: radar_detection_distance
- g0:
- move_energy:
- name: g0 move energy
- still_energy:
- name: g0 still energy
- g1:
- move_energy:
- name: g1 move energy
- still_energy:
- name: g1 still energy
- g2:
- move_energy:
- name: g2 move energy
- still_energy:
- name: g2 still energy
- g3:
- move_energy:
- name: g3 move energy
- still_energy:
- name: g3 still energy
- g4:
- move_energy:
- name: g4 move energy
- still_energy:
- name: g4 still energy
- g5:
- move_energy:
- name: g5 move energy
- still_energy:
- name: g5 still energy
- g6:
- move_energy:
- name: g6 move energy
- still_energy:
- name: g6 still energy
- g7:
- move_energy:
- name: g7 move energy
- still_energy:
- name: g7 still energy
- g8:
- move_energy:
- name: g8 move energy
- still_energy:
- name: g8 still energy
- switch:
- - platform: ld2410
- engineering_mode:
- name: "engineering mode"
- bluetooth:
- name: "control bluetooth"
- select:
- - platform: ld2410
- distance_resolution:
- name: "distance resolution"
- button:
- - platform: ld2410
- restart:
- name: "restart"
- query_params:
- name: query params
- text_sensor:
- - platform: wifi_info
- ip_address:
- name: "ESP IP Address"
- ssid:
- name: "ESP Connected SSID"
- light:
- - platform: esp32_rmt_led_strip
- id: rgb_light
- name: "RGB Light"
- pin: GPIO8
- rmt_channel: 0
- default_transition_length: 0s
- chipset: WS2812
- num_leds: 3
- rgb_order: grb
- effects:
- - addressable_fireworks:
- name: Fireworks Effect With Custom Values
- update_interval: 32ms
- spark_probability: 10%
- use_random_color: false
- fade_out_rate: 120
- script:
- - id: blink_light
- parameters:
- delay_ms: int
- then:
- - light.turn_on: rgb_light
- # The param delay_ms is accessible using a lambda
- - delay: !lambda return delay_ms;
- - light.turn_off: rgb_light
Add Comment
Please, Sign In to add comment