Introduced @durd 's patch to beta firmware, bumping the original beta firmware to STABLE.
This commit is contained in:
parent
34b12bb3fd
commit
3780f499c9
|
|
@ -23,9 +23,8 @@ esphome:
|
|||
id(cpu_speed) = ESP.getCpuFreqMHz();
|
||||
- priority: 300
|
||||
then:
|
||||
# 写入版本号,未来使用公共变量!(23年7月17日_13时29分_)
|
||||
lambda: |-
|
||||
id(screek_version).publish_state("V24.7.4_beta");
|
||||
id(screek_version).publish_state("Beta_V240708_1");
|
||||
- priority: -200
|
||||
then:
|
||||
- uart.write:
|
||||
|
|
@ -116,6 +115,8 @@ globals:
|
|||
improv_serial:
|
||||
|
||||
logger:
|
||||
logs:
|
||||
bh1750.sensor: INFO
|
||||
|
||||
debug:
|
||||
update_interval: 30s
|
||||
|
|
@ -173,6 +174,13 @@ text_sensor:
|
|||
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;
|
||||
|
|
@ -183,10 +191,10 @@ text_sensor:
|
|||
|
||||
float distance = -1;
|
||||
std::string uart_state = "";
|
||||
if (uart_text.length() > 3){
|
||||
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") {
|
||||
if (uart_state == "occ" || uart_state == "mov") {
|
||||
distance = std::stof(uart_text.substr(9));
|
||||
}
|
||||
}
|
||||
|
|
@ -194,7 +202,7 @@ text_sensor:
|
|||
|
||||
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) {
|
||||
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);
|
||||
|
|
@ -239,10 +247,12 @@ binary_sensor:
|
|||
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
|
||||
|
|
@ -259,7 +269,7 @@ sensor:
|
|||
id: sys_esp_temperature
|
||||
name: ESP Temperature
|
||||
lambda: return temperatureRead();
|
||||
unit_of_measurement: °C
|
||||
unit_of_measurement: "°C"
|
||||
device_class: TEMPERATURE
|
||||
update_interval: 45s
|
||||
entity_category: "diagnostic"
|
||||
|
|
@ -350,7 +360,6 @@ interval:
|
|||
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);
|
||||
}
|
||||
|
|
@ -501,4 +510,3 @@ number:
|
|||
min_value: 0.5
|
||||
max_value: 10
|
||||
step: 0.5
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@ esphome:
|
|||
then:
|
||||
lambda: |-
|
||||
id(cpu_speed) = ESP.getCpuFreqMHz();
|
||||
- priority: 300
|
||||
then:
|
||||
lambda: |-
|
||||
id(screek_version).publish_state("V240708_1");
|
||||
- priority: -200
|
||||
then:
|
||||
- uart.write:
|
||||
|
|
@ -28,21 +32,34 @@ esphome:
|
|||
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
|
||||
|
|
@ -98,8 +115,6 @@ globals:
|
|||
improv_serial:
|
||||
|
||||
logger:
|
||||
logs:
|
||||
bh1750.sensor: INFO
|
||||
|
||||
debug:
|
||||
update_interval: 30s
|
||||
|
|
@ -127,6 +142,13 @@ 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"
|
||||
|
|
@ -150,39 +172,20 @@ text_sensor:
|
|||
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") {
|
||||
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);
|
||||
}
|
||||
|
||||
if (uart_text == "null"){
|
||||
return;
|
||||
}
|
||||
|
||||
float distance = -1;
|
||||
std::string uart_state = "";
|
||||
if (uart_text.length() > 3) {
|
||||
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") {
|
||||
if (uart_state == "occ" || uart_state =="mov") {
|
||||
distance = std::stof(uart_text.substr(9));
|
||||
}
|
||||
}
|
||||
|
|
@ -190,7 +193,7 @@ text_sensor:
|
|||
|
||||
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) {
|
||||
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);
|
||||
|
|
@ -235,12 +238,10 @@ binary_sensor:
|
|||
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
|
||||
|
|
@ -257,7 +258,7 @@ sensor:
|
|||
id: sys_esp_temperature
|
||||
name: ESP Temperature
|
||||
lambda: return temperatureRead();
|
||||
unit_of_measurement: "°C"
|
||||
unit_of_measurement: °C
|
||||
device_class: TEMPERATURE
|
||||
update_interval: 45s
|
||||
entity_category: "diagnostic"
|
||||
|
|
@ -285,13 +286,11 @@ sensor:
|
|||
icon: "mdi:signal-distance-variant"
|
||||
unit_of_measurement: "m"
|
||||
accuracy_decimals: 2
|
||||
update_interval: 0.2s
|
||||
filters: # Use Fliter To Debounce
|
||||
#- heartbeat: 0.2s
|
||||
#- sliding_window_moving_average:
|
||||
# filters: # Use Fliter To Debounce
|
||||
# - sliding_window_moving_average:
|
||||
# window_size: 8
|
||||
# send_every: 2
|
||||
- delta: 0%
|
||||
# - heartbeat: 0.2s
|
||||
- platform: bh1750
|
||||
name: "Illuminance"
|
||||
accuracy_decimals: 1
|
||||
|
|
@ -349,7 +348,10 @@ interval:
|
|||
setup_priority: -200
|
||||
then:
|
||||
lambda: |-
|
||||
if ((time(NULL)-id(LD1125F_Last_Time)) >= id(LD1125F_Clear_Time).state) {
|
||||
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;
|
||||
|
|
@ -370,7 +372,7 @@ number:
|
|||
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 #Default mth1 Setting
|
||||
initial_value: "60.0" #Default mth1 Setting
|
||||
min_value: 10.0
|
||||
max_value: 600.0
|
||||
step: 5.0
|
||||
|
|
@ -381,6 +383,10 @@ number:
|
|||
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
|
||||
|
|
@ -388,7 +394,7 @@ number:
|
|||
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
|
||||
initial_value: "30" #Default mth2 Setting
|
||||
min_value: 5
|
||||
max_value: 300
|
||||
step: 5
|
||||
|
|
@ -399,6 +405,10 @@ number:
|
|||
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
|
||||
|
|
@ -406,7 +416,7 @@ number:
|
|||
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
|
||||
initial_value: "20" #Default mth3 Setting
|
||||
min_value: 5
|
||||
max_value: 200
|
||||
step: 5
|
||||
|
|
@ -417,6 +427,10 @@ number:
|
|||
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
|
||||
|
|
@ -425,7 +439,7 @@ number:
|
|||
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
|
||||
initial_value: "8" #Default rmax Setting
|
||||
min_value: 0.4
|
||||
max_value: 12
|
||||
step: 0.2
|
||||
|
|
@ -436,6 +450,33 @@ number:
|
|||
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
|
||||
|
|
@ -443,7 +484,7 @@ number:
|
|||
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
|
||||
initial_value: "5" #LD1125F Mov/Occ > Clearence Time Here
|
||||
min_value: 0.5
|
||||
max_value: 20
|
||||
step: 0.5
|
||||
|
|
@ -454,7 +495,8 @@ number:
|
|||
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
|
||||
initial_value: "1" #LD1125F Mov > Occ Time Here
|
||||
min_value: 0.5
|
||||
max_value: 10
|
||||
step: 0.5
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user