Update czytnik-brama.yaml

This commit is contained in:
2026-02-20 05:01:31 +01:00
parent dacfa8fe11
commit 15400e6ae9

View File

@@ -1,36 +1,39 @@
esphome:
name: terminal-brama
# Punkt 1: Obniżenie taktowania procesora dla oszczędności energii i niższej temperatury
platformio_options:
board_build.f_cpu: 80000000L # Oszczędność energii i niższa temperatura
board_build.f_cpu: 80000000L
esp32:
esp32:
board: esp32dev
framework:
type: arduino
wifi:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
power_save_mode: LIGHT
power_save_mode: LIGHT # Punkt 3: Energooszczędny tryb WiFi
fast_connect: true
api:
api:
reboot_timeout: 0s
encryption:
key: !secret api_encryption_key
ota:
ota:
- platform: esphome
password: !secret ota_password
logger:
logger:
level: INFO
globals:
globals:
- id: g_imie
type: std::string
restore_value: no
- id: g_nazwisko
type: std::string
restore_value: no
- id: status_karty
type: std::string
initial_value: '"Przyłóż kartę"'
@@ -38,7 +41,7 @@ esphome:
type: bool
initial_value: 'false'
font:
font:
- file: "gfonts://Roboto"
id: font_mala
size: 11
@@ -48,27 +51,27 @@ esphome:
size: 18
glyphs: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyząćęłńóśźżĄĆĘŁŃÓŚŹŻ!?:-., "
i2c:
i2c:
sda: GPIO21
scl: GPIO22
spi:
spi:
id: bus_spi
clk_pin: GPIO18
mosi_pin: GPIO23
miso_pin: GPIO19
rc522_spi:
rc522_spi:
spi_id: bus_spi
cs_pin: GPIO5
reset_pin: GPIO4
update_interval: 500ms
on_tag:
then:
- display.page.show: strona_glowna
- display.page.show: strona_glowna # Wybudź ekran przy skanowaniu
- homeassistant.tag_scanned: !lambda 'return x;'
switch:
switch:
- platform: gpio
pin: GPIO13
id: przekaznik_bramy
@@ -78,7 +81,7 @@ esphome:
- delay: 3s
- switch.turn_off: przekaznik_bramy
script:
script:
- id: timer_ekranu
mode: restart
then:
@@ -86,10 +89,10 @@ esphome:
- globals.set: { id: pokazuj_pracownika, value: 'false' }
- lambda: 'id(status_karty) = "Przyłóż kartę";'
- component.update: moj_ekran
- delay: 60s
- delay: 60s # Punkt 2: Czekaj minutę i wygaś ekran
- display.page.show: strona_pusta
display:
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
@@ -105,11 +108,11 @@ esphome:
it.print(64, 28, id(font_duza), TextAlign::TOP_CENTER, id(g_imie).c_str());
it.print(64, 48, id(font_duza), TextAlign::TOP_CENTER, id(g_nazwisko).c_str());
}
- id: strona_pusta
- id: strona_pusta # Punkt 2: Pusta strona dla oszczędności OLED
lambda: |-
;
light:
light:
- platform: binary
name: "Terminal LED Zielona"
output: out_zielona
@@ -119,7 +122,7 @@ esphome:
output: out_czerwona
id: led_czerwona
output:
output:
- platform: gpio
pin: GPIO12
id: out_zielona
@@ -127,7 +130,7 @@ esphome:
pin: GPIO14
id: out_czerwona
text_sensor:
text_sensor:
- platform: homeassistant
id: pracownik_text
entity_id: input_text.ostatni_pracownik_przy_bramie
@@ -136,7 +139,9 @@ esphome:
- lambda: |-
std::string s = x;
if (s.empty() || s == "Przyłóż kartę") return;
id(moj_ekran)->show_page(id(strona_glowna));
id(moj_ekran)->show_page(id(strona_glowna)); // Wybudź ekran przy nowej wiadomości
if (s == "Brak Uprawnień") {
id(pokazuj_pracownika) = false;
id(status_karty) = "Brak Uprawnień";
@@ -154,4 +159,3 @@ esphome:
}
id(timer_ekranu)->execute();
- component.update: moj_ekran