Last active
July 6, 2023 04:30
-
-
Save rosaldanha/ede8eb221becd02e39b7966c9cabc7ac to your computer and use it in GitHub Desktop.
LD1115H using output pin on esphome
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
substitutions: | |
location: Escritorio | |
devicename: mmwescritorio | |
LD1115H_INPUT_PIN: GPIO17 | |
TXPIN: GPIO1 | |
RXPIN: GPIO3 | |
esphome: | |
name: ${devicename} | |
esp32: | |
board: esp32dev | |
framework: | |
type: arduino | |
# Enable Home Assistant API | |
api: | |
ota: | |
password: !secret ota_password | |
wifi: | |
ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
# Enable logging | |
logger: | |
level: VERY_VERBOSE | |
baud_rate: 0 | |
############################################################################################################################# | |
uart: | |
id: uart_bus | |
tx_pin: ${TXPIN} | |
rx_pin: ${RXPIN} | |
baud_rate: 115200 | |
debug: | |
direction: BOTH | |
dummy_receiver: true | |
after: | |
delimiter: "\n" | |
sequence: | |
- lambda: UARTDebug::log_string(direction, bytes); | |
switch: | |
- platform: safe_mode | |
internal: true | |
name: use_safe_mode | |
number: | |
- platform: template | |
name: ${devicename}_motion_detection_sensitivity | |
id: ${devicename}_motion_detection_sensitivity | |
min_value: 1 | |
max_value: 240 | |
initial_value: 120 | |
optimistic: true | |
step: 1 | |
restore_value: true | |
mode: box | |
set_action: | |
- uart.write: !lambda | |
int cm = (int)x; | |
std::string cms = "th1=" + to_string(cm) +" \n"; | |
return std::vector<unsigned char>(cms.begin(), cms.end()); | |
- delay: 1s | |
- uart.write: "save\n" | |
- platform: template | |
name: ${devicename}_presence_detection_sensitivity | |
id: ${devicename}_presence_detection_sensitivity | |
min_value: 1 | |
max_value: 450 | |
initial_value: 250 | |
optimistic: true | |
step: 1 | |
restore_value: true | |
mode: box | |
set_action: | |
- uart.write: !lambda | |
int cm = (int)x; | |
std::string cms = "th2=" + to_string(cm) +" \n"; | |
return std::vector<unsigned char>(cms.begin(), cms.end()); | |
- delay: 1s | |
- uart.write: "save\n" | |
- platform: template | |
name: ${devicename}_delay_detection_time | |
id: ${devicename}_delay_detection_time | |
min_value: 1 | |
max_value: 60 | |
initial_value: 5 | |
optimistic: true | |
step: 1 | |
restore_value: true | |
mode: box | |
set_action: | |
- uart.write: !lambda | |
int cm = (int)x; | |
std::string cms = "dtime=" + to_string(cm) +" \n"; | |
return std::vector<unsigned char>(cms.begin(), cms.end()); | |
- delay: 1s | |
- uart.write: "save\n" | |
- platform: template | |
name: ${devicename}_gpio_pullup_mov_times | |
id: ${devicename}_gpio_pullup_mov_times | |
min_value: 1 | |
max_value: 60 | |
initial_value: 3 | |
optimistic: true | |
step: 1 | |
restore_value: true | |
mode: box | |
set_action: | |
- uart.write: !lambda | |
int cm = (int)x; | |
std::string cms = "mov_sn=" + to_string(cm) +" \n"; | |
return std::vector<unsigned char>(cms.begin(), cms.end()); | |
- delay: 1s | |
- uart.write: "save\n" | |
- platform: template | |
name: ${devicename}_gpio_pullup_occ_times | |
id: ${devicename}_gpio_pullup_occ_times | |
min_value: 1 | |
max_value: 60 | |
initial_value: 5 | |
optimistic: true | |
step: 1 | |
restore_value: true | |
mode: box | |
set_action: | |
- uart.write: !lambda | |
int cm = (int)x; | |
std::string cms = "occ_sn=" + to_string(cm) +" \n"; | |
return std::vector<unsigned char>(cms.begin(), cms.end()); | |
- delay: 1s | |
- uart.write: "save\n" | |
binary_sensor: | |
- platform: gpio | |
name: occup_${location} | |
device_class: occupancy | |
pin: | |
number: ${LD1115H_INPUT_PIN} | |
mode: | |
input: true | |
pulldown: true | |
button: | |
- platform: restart | |
name: Restart $device_name | |
Yep that is correct, the v0 pin on ld1115h goes high and stays, on presence
detected.
Em ter., 28 de fev. de 2023 02:39, nickelnine ***@***.***>
escreveu:
… ***@***.**** commented on this gist.
------------------------------
Hi, can you confirm please - LD1115H_INPUT_PIN: GPIO17, do you mean V0
from LD1115H to GPIO17 on ESP32?
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/ede8eb221becd02e39b7966c9cabc7ac#gistcomment-4486484>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEMZ7EGZBZYQIRVBS3GE33WZWFQXBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTCNZSG42DAOBSU52HE2LHM5SXFJTDOJSWC5DF>
.
You are receiving this email because you authored the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
vc tem a ligaçao dos fios? do D1 para o sensor
vc tem a ligaçao dos fios? do D1 para o sensor
GPIO17 <= vout
GPIO1 = rx (no d1)
GPIO3 = tx (no d1)
3v (d1) = vin
gnd = gnd
Oi muito obrigadoooo so ta dando erro aqui nao sei porque
${LD1115H_INPUT_PIN}
o que pode ser?
binary_sensor:
- platform: gpio
name: occup_${location}
device_class: occupancy
pin:
number: GPIO17
mode:
input: true
pulldown: true
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, can you confirm please - LD1115H_INPUT_PIN: GPIO17, do you mean V0 from LD1115H to GPIO17 on ESP32?