garage-door-controller adds "Car parked", "Car exiting" and "Car entering" sensors. Package for LD1125H motion sensor uses ${device_name} from source yaml file.

This commit is contained in:
John Dillenburg
2024-12-23 16:20:29 -06:00
parent 96bc8ff9e0
commit abfc6939dd
3 changed files with 47 additions and 26 deletions

View File

@@ -36,6 +36,9 @@ globals:
- id: effect_counter
type: int
initial_value: '0'
- id: safe_zone
type: bool
initial_value: 'false'
# Garage door button on GPIO16
switch:
@@ -106,6 +109,23 @@ binary_sensor:
pin: GPIO23
id: closed_sensor
internal: True
- platform: template
id: parked_sensor
name: "Car parked"
- platform: template
id: car_exiting
name: "Car exiting"
condition:
sensor.in_range:
id: vehicle_average_speed
above: 1.0
- platform: template
id: car_entering
name: "Car entering"
condition:
sensor.in_range:
id: vehicle_average_speed
below: -1.0
#******************** Sensor *********************
sensor:
@@ -198,8 +218,8 @@ sensor:
return rate;
filters:
- sliding_window_moving_average:
window_size: 20 # average 10 seconds worth of speed
send_every: 1 # check average speed every 1/2 second
window_size: 10 # average 10 x 0.5 seconds = 5 seconds worth of speed
send_every: 1 # send average speed every 1/2 second
on_value:
then:
- if:
@@ -223,6 +243,9 @@ sensor:
- light.turn_on:
id: led_strip
effect: "Distance Effect"
- binary_sensor.template.publish:
id: parked_sensor
state: false
#******************** Cover *********************
cover:
@@ -282,6 +305,7 @@ light:
// solid red in safe zone
if (distance < max_safe) {
it.all() = Color(255,0,0);
id(safe_zone) = true;
return;
}
@@ -331,3 +355,10 @@ script:
id: led_strip
transition_length:
seconds: 5
- if:
condition:
- lambda: 'return id(safe_zone);'
then:
- binary_sensor.template.publish:
id: parked_sensor
state: true

View File

@@ -16,13 +16,3 @@ bluetooth_proxy:
esp32_ble_tracker:
# MQTT config - required for this component to work:
# mqtt:
# broker: 10.0.0.215
# username: esp32_presence
# password: findme
# discovery_prefix: "homeassistant"
# port: 1883
# client_id: "${area}"
# keepalive:
# minutes: 10

View File

@@ -96,7 +96,7 @@ interval:
number:
- platform: template
name: ${upper_devicename} LD1125H mth1 mov #mth1 mov is 0~2.8m motion detection threshold.
name: ${device_name} LD1125H mth1 mov #mth1 mov is 0~2.8m motion detection threshold.
id: LD1125H_mth1_mov
icon: "mdi:cogs"
optimistic: true
@@ -113,7 +113,7 @@ number:
std::string th1st = "mth1_mov=" + str_sprintf("%.0f",x) +"\r\n";
return std::vector<uint8_t>(th1st.begin(), th1st.end());
- platform: template
name: ${upper_devicename} LD1125H mth2 mov #mth2 mov is 2.8~8m motion detection threshold.
name: ${device_name} LD1125H mth2 mov #mth2 mov is 2.8~8m motion detection threshold.
id: LD1125H_mth2_mov
icon: "mdi:cogs"
optimistic: true
@@ -130,7 +130,7 @@ number:
std::string th2st = "mth2_mov=" + str_sprintf("%.0f",x) +"\r\n";
return std::vector<uint8_t>(th2st.begin(), th2st.end());
- platform: template
name: ${upper_devicename} LD1125H mth3 mov #mth3 mov is above 8m motion detection threshold.
name: ${device_name} LD1125H mth3 mov #mth3 mov is above 8m motion detection threshold.
id: LD1125H_mth3_mov
icon: "mdi:cogs"
optimistic: true
@@ -147,7 +147,7 @@ number:
std::string th3st = "mth3_mov=" + str_sprintf("%.0f",x) +"\r\n";
return std::vector<uint8_t>(th3st.begin(), th3st.end());
- platform: template
name: ${upper_devicename} LD1125H mth1 occ #mth1 occ is 0~2.8m detection threshold.
name: ${device_name} LD1125H mth1 occ #mth1 occ is 0~2.8m detection threshold.
id: LD1125H_mth1_occ
icon: "mdi:cogs"
optimistic: true
@@ -164,7 +164,7 @@ number:
std::string th1st = "mth1_occ=" + str_sprintf("%.0f",x) +"\r\n";
return std::vector<uint8_t>(th1st.begin(), th1st.end());
- platform: template
name: ${upper_devicename} LD1125H mth2 occ #mth2 occ is 2.8~8m detection threshold.
name: ${device_name} LD1125H mth2 occ #mth2 occ is 2.8~8m detection threshold.
id: LD1125H_mth2_occ
icon: "mdi:cogs"
optimistic: true
@@ -181,7 +181,7 @@ number:
std::string th2st = "mth2_occ=" + str_sprintf("%.0f",x) +"\r\n";
return std::vector<uint8_t>(th2st.begin(), th2st.end());
- platform: template
name: ${upper_devicename} LD1125H mth3 occ #mth3 occ is above 8m detection threshold.
name: ${device_name} LD1125H mth3 occ #mth3 occ is above 8m detection threshold.
id: LD1125H_mth3_occ
icon: "mdi:cogs"
optimistic: true
@@ -198,7 +198,7 @@ number:
std::string th3st = "mth3_occ=" + str_sprintf("%.0f",x) +"\r\n";
return std::vector<uint8_t>(th3st.begin(), th3st.end());
- platform: template
name: ${upper_devicename} LD1125H rmax #rmax is max detection distance.
name: ${device_name} LD1125H rmax #rmax is max detection distance.
id: LD1125H_rmax
icon: "mdi:cogs"
optimistic: true
@@ -215,7 +215,7 @@ number:
std::string rmaxst = "rmax=" + str_sprintf("%.1f",x) +"\r\n";
return std::vector<uint8_t>(rmaxst.begin(), rmaxst.end());
- platform: template
name: ${upper_devicename} LD1125H Clearence Time
name: ${device_name} LD1125H Clearence Time
id: LD1125H_Clear_Time
icon: "mdi:cogs"
optimistic: true
@@ -225,7 +225,7 @@ number:
max_value: 60
step: 0.5
- platform: template
name: ${upper_devicename} LD1125H Movement Time
name: ${device_name} LD1125H Movement Time
id: LD1125H_Mov_Time
icon: "mdi:cogs"
optimistic: true
@@ -236,7 +236,7 @@ number:
step: 0.5
sensor:
- platform: template
name: ${upper_devicename} LD1125H Distance
name: ${device_name} LD1125H Distance
id: LD1125H_Distance
icon: "mdi:signal-distance-variant"
unit_of_measurement: "m"
@@ -249,7 +249,7 @@ sensor:
text_sensor:
- platform: serial
uart_id: LD1125H_UART_BUS
name: ${upper_devicename} LD1125H UART Text
name: ${device_name} LD1125H UART Text
id: LD1125H_UART_Text
icon: "mdi:format-text"
internal: True #If Don't Want to See UART Receive Data, Set To True
@@ -290,15 +290,15 @@ text_sensor:
}
}
- platform: template
name: ${upper_devicename} LD1125H Occupancy Status
name: ${device_name} LD1125H Occupancy Status
id: LD1125H_Occupancy
icon: "mdi:motion-sensor"
binary_sensor:
- platform: template
name: ${upper_devicename} LD1125H Occupancy or Movement
name: ${device_name} LD1125H Occupancy or Movement
id: LD1125H_MovOcc_Binary
device_class: occupancy
- platform: template
name: ${upper_devicename} LD1125H Movement
name: ${device_name} LD1125H Movement
id: LD1125H_Mov_Binary
device_class: motion