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