I can see something that it’s not correct. This code will constantly and periodically will send the secret code. Is there a way to stop from doing this?
The following picture is showing the secret code that it’s being sending continuously.
name: keypad
platform: ESP32
board: esp32dev
esp32_ble_tracker:
scan_parameters:
interval: 1100ms
window: 1100ms
active: true
bluetooth_proxy:
active: true
wifi:
ssid: "XXXXXXXX"
password: "XXXXXXX"
manual_ip:
static_ip: 192.168.3.69
gateway: 192.168.3.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Keypad Fallback"
password: "XXXXXXXX"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: "liakjim"
sensor:
- platform: wifi_signal
name: keypad_node WiFi Signal
update_interval: 15s
filters:
- sliding_window_moving_average:
window_size: 15
send_every: 15
send_first_at: 15
- platform: uptime
id: sensor_uptime
globals:
- id: global_livingroom
type: int
restore_value: no
initial_value: '0'
- id: current_page_num
type: int
restore_value: no
initial_value: '1'
font:
- file: "fonts/arial.ttf"
id: my_font
size: 20
i2c:
sda: GPIO23
scl: GPIO22
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
lambda: |-
if (id(current_page_num) == 1) {
it.printf(10, 20, id(my_font), "%s", id(alarmo).state.c_str());
it.print(10, 40, id(my_font), "Enter code");
}
if (id(current_page_num) == 2) {
it.printf(10, 20, id(my_font), "%s", id(alarmo).state.c_str());
it.print(1, 40, id(my_font), "Correct code");
}
if (id(current_page_num) == 3) {
it.printf(10, 20, id(my_font), "%s", id(alarmo).state.c_str());
it.print(10, 40, id(my_font), "Wrong code");
}
if (id(current_page_num) == 4) {
it.printf(10, 20, id(my_font), "%s", id(alarmo).state.c_str());
it.printf(10, 40, id(my_font), "%s", id(keypadp).state.c_str());
}
if (id(current_page_num) == 5) {
it.printf(10, 20, id(my_font), "%s", id(alarmo).state.c_str());
it.print(30, 40, id(my_font), "Bye");
}
matrix_keypad:
id: mykeypad
rows:
- pin: 21
- pin: 19
- pin: 18
- pin: 5
columns:
- pin: 17
- pin: 16
- pin: 4
keys: "123456789*0#"
has_diodes: false
key_collector:
- id: pincode_reader
source_id: mykeypad
min_length: 4
max_length: 4
end_keys: "#"
end_key_required: true
back_keys: "*"
clear_keys: "C"
allowed_keys: "0123456789"
timeout: 5s
on_progress:
- logger.log:
format: "input progress: '%s', started by '%c'"
args: [ 'x.c_str()', "(start == 0 ? '~' : start)" ]
- text_sensor.template.publish:
id: keypadp
state: !lambda "return x.c_str();"
- globals.set:
id: current_page_num
value: '4'
on_timeout:
- logger.log:
format: "input timeout: '%s', started by '%c'"
args: [ 'x.c_str()', "(start == 0 ? '~' : start)" ]
on_result:
then:
- logger.log:
format: "input result: '%s', started by '%c', ended by '%c''x.c_str()'"
args: [ 'x.c_str()', "(start == 0 ? '~' : start)", "(end == 0 ? '~' : end)" ]
- text_sensor.template.publish:
id: keypad
state: !lambda "return x.c_str();"
- if:
condition:
lambda: 'return id(keypad).state == "XXXX";'
then:
- delay: 1s
- globals.set:
id: current_page_num
value: '2'
- delay: 10s
- globals.set:
id: current_page_num
value: '5'
- delay: 10s
- globals.set:
id: current_page_num
value: '1'
else:
- delay: 1s
- globals.set:
id: current_page_num
value: '3'
- delay: 3s
- globals.set:
id: current_page_num
value: '1'
binary_sensor:
- platform: status
name: keypad_node Status
- platform: template
name: "Living VPIR Sensor"
device_class: motion
id: vpir_livingroom
- platform: gpio
pin: 26
name: "Living room PIR Sensor"
device_class: motion
internal: false
on_multi_click:
- timing:
- ON for 0.1s to 6s
then:
- lambda: |-
id(global_livingroom) += 1;
if (id(global_livingroom) >= 2) {
id(vpir_livingroom).publish_state(true);
}
- timing:
- OFF for at least 10s
then:
- lambda: |-
id(global_livingroom) = 0;
id(vpir_livingroom).publish_state(false);
switch:
- platform: restart
name: "Restart keypad_node"
id: restart_switch
text_sensor:
# Expose WiFi information as sensors.
- platform: wifi_info
ip_address:
name: keypad_node IP
- platform: template
name: "Keypad code"
id: keypadp
- platform: template
name: "Keypad code"
id: keypad
- platform: homeassistant
name: "Ntina's alarmo state"
entity_id: alarm_control_panel.alarmo
id: alarmo
internal: true