substitutions: name: kuba-hub friendly_name: 'Kuba Hub' project_version: '1.0' esphome: name: '${name}' friendly_name: '${friendly_name}' name_add_mac_suffix: true project: name: peakcontrol.kuba-hub version: '${project_version}' on_boot: - priority: 1001 then: - lambda: |- gpio_reset_pin((gpio_num_t)5); gpio_reset_pin((gpio_num_t)14); gpio_reset_pin((gpio_num_t)15); esp32: board: esp32-poe framework: type: esp-idf ethernet: type: LAN8720 mdc_pin: GPIO23 mdio_pin: GPIO18 clk_mode: GPIO17_OUT phy_addr: 0 power_pin: GPIO12 dashboard_import: package_import_url: github://gitea.domowyasystent.com/PeakControl/ESP32-Hub/kuba-hub.yaml@main import_full_config: true logger: api: reboot_timeout: 0s encryption: key: "" # TODO: wygeneruj nowy klucz: esphome generate-api-key ota: - platform: esphome password: "" # TODO: ustaw hasło OTA - platform: web_server web_server: port: 80 local: true #wifi: # ssid: !secret wifi_ssid # password: !secret wifi_password # # ap: # ssid: '${friendly_name} Fallback' # password: "" #captive_portal: time: - platform: homeassistant timezone: Europe/Warsaw id: homeassistant_time button: - platform: restart name: '${friendly_name} Restart' packages: main_hub_packages: url: https://gitea.domowyasystent.com/jkocon/ESP32-Hub ref: main files: [ # ── Zawsze aktywne ──────────────────────────────────────────────────── 'packages/main_hub/i2c.yaml', 'packages/main_hub/status_led.yaml', 'packages/main_hub/scripts.yaml', # ── PCA9685 PWM ─────────────────────────────────────────────────────── 'packages/main_hub/pca9685/0x40.yaml', # A0=0 A1=0 A2=0 A3=0 A4=0 A5=0 'packages/main_hub/pca9685/0x41.yaml', # A0=1 A1=0 A2=0 A3=0 A4=0 A5=0 # ── MCP23017 OUTPUTS ────────────────────────────────────────────────── 'packages/main_hub/mcp23017/outputs/0x21.yaml', # A2=0 A1=0 A0=1 'packages/main_hub/mcp23017/outputs/0x23.yaml', # A2=0 A1=1 A0=1 'packages/main_hub/mcp23017/outputs/0x25.yaml', # A2=1 A1=0 A0=1 # ── MCP23017 INPUTS ─────────────────────────────────────────────────── 'packages/main_hub/mcp23017/inputs/0x20.yaml', # A2=0 A1=0 A0=0 'packages/main_hub/mcp23017/inputs/0x22.yaml', # A2=0 A1=1 A0=0 'packages/main_hub/mcp23017/inputs/0x24.yaml', # A2=1 A1=0 A0=0 ] light: # ── Nazwane oświetlenie LED PWM (PCA9685) ──────────────────────────────── # Przypisz właściwe kanały wg okablowania (pca_0xADDR_chN) - platform: monochromatic name: "Serwer LED" id: serwer_led output: pca_0x40_ch0 # TODO: zmień na właściwy kanał - platform: monochromatic name: "Jadalnia LED" id: jadalnia_led output: pca_0x40_ch1 # TODO: zmień na właściwy kanał - platform: monochromatic name: "Sypialnia LED" id: sypialnia_led output: pca_0x40_ch2 # TODO: zmień na właściwy kanał - platform: monochromatic name: "Pokój dla Gości LED" id: pokoj_dla_gosci_led output: pca_0x40_ch3 # TODO: zmień na właściwy kanał - platform: monochromatic name: "SPA Ledy" id: spa_ledy output: pca_0x40_ch4 # TODO: zmień na właściwy kanał - platform: monochromatic name: "Biała Łazienka Wanna LED" id: biala_lazienka_wanna_led output: pca_0x40_ch5 # TODO: zmień na właściwy kanał - platform: monochromatic name: "Kuchnia Łezka LED" id: kuchnia_lezka_led output: pca_0x40_ch6 # TODO: zmień na właściwy kanał binary_sensor: ################## # mcp23xxx_0x20 # ################## # Wejście 1 — single: halogeny wejście, triple: wyłącz lampy, long: wyłącz wentylatory - platform: gpio name: "Wejście 1" id: hub1_in0 pin: mcp23xxx: mcp23xxx_0x20 number: 0 mode: INPUT inverted: True on_multi_click: - timing: - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x21_out15 - timing: - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at least 350ms then: - script.execute: off_all_lights - timing: - ON for at least 350ms then: - script.execute: off_all_fans # Wejście 3 — brak automatyzacji - platform: gpio name: "Wejście 3" id: hub1_in1 pin: mcp23xxx: mcp23xxx_0x20 number: 1 mode: INPUT inverted: True # Wejście 2 — single: hub1_out14, triple: WLED korytarz kinkiety - platform: gpio name: "Wejście 2" id: hub1_in2 pin: mcp23xxx: mcp23xxx_0x20 number: 2 mode: INPUT inverted: True on_multi_click: - timing: - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x21_out14 - timing: - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at least 350ms then: - script.execute: wled_korytarz_kinkiety_toggle # Sypialnia 3 — single: turn_on out12+out1, double: toggle out12+out1 - platform: gpio name: "Sypialnia 3" id: hub1_in3 pin: mcp23xxx: mcp23xxx_0x20 number: 3 mode: INPUT inverted: True on_multi_click: - timing: - ON for at most 350ms - OFF for at least 350ms then: - light.turn_on: mcp_0x23_out12 - light.turn_on: mcp_0x23_out1 - timing: - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x23_out12 - light.toggle: mcp_0x23_out1 # Sypialnia 1 — single: sypialnia LED - platform: gpio name: "Sypialnia 1" id: hub1_in4 pin: mcp23xxx: mcp23xxx_0x20 number: 4 mode: INPUT inverted: True on_click: then: - light.toggle: sypialnia_led # Sypialnia 2 — single: out7 - platform: gpio name: "Sypialnia 2" id: hub1_in5 pin: mcp23xxx: mcp23xxx_0x20 number: 5 mode: INPUT inverted: True on_click: then: - light.toggle: mcp_0x23_out7 # Sypialnia Łóżko Prawa Strona — single: out1, double: out12+out1, long: wyłącz wszystkie - platform: gpio name: "Sypialnia Łóżko Prawa" id: hub1_in6 pin: mcp23xxx: mcp23xxx_0x20 number: 6 mode: INPUT inverted: True on_multi_click: - timing: - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x23_out1 - timing: - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x23_out12 - light.toggle: mcp_0x23_out1 - timing: - ON for at least 350ms then: - script.execute: off_all_lights - script.execute: off_all_fans # Sypialnia Łóżko Lewa Strona — single: out12, double: out12+out1, long: wyłącz wszystkie - platform: gpio name: "Sypialnia Łóżko Lewa" id: hub1_in7 pin: mcp23xxx: mcp23xxx_0x20 number: 7 mode: INPUT inverted: True on_multi_click: - timing: - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x23_out12 - timing: - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x23_out12 - light.toggle: mcp_0x23_out1 - timing: - ON for at least 350ms then: - script.execute: off_all_lights - script.execute: off_all_fans # Niebieski Pokój Lewy — single: out10, double: out7 - platform: gpio name: "Niebieski Pokój Lewy" id: hub1_in8 pin: mcp23xxx: mcp23xxx_0x20 number: 8 mode: INPUT inverted: True on_multi_click: - timing: - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x23_out10 - timing: - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x21_out7 # Niebieski Pokój Prawy — single: pokój dla gości LED - platform: gpio name: "Niebieski Pokój Prawy" id: hub1_in9 pin: mcp23xxx: mcp23xxx_0x20 number: 9 mode: INPUT inverted: True on_click: then: - light.toggle: pokoj_dla_gosci_led # Nie podpięte - platform: gpio name: "hub1_in10" id: hub1_in10 pin: mcp23xxx: mcp23xxx_0x20 number: 10 mode: INPUT inverted: True - platform: gpio name: "hub1_in11" id: hub1_in11 pin: mcp23xxx: mcp23xxx_0x20 number: 11 mode: INPUT inverted: True - platform: gpio name: "hub1_in12" id: hub1_in12 pin: mcp23xxx: mcp23xxx_0x20 number: 12 mode: INPUT inverted: True - platform: gpio name: "hub1_in13" id: hub1_in13 pin: mcp23xxx: mcp23xxx_0x20 number: 13 mode: INPUT inverted: True - platform: gpio name: "hub1_in14" id: hub1_in14 pin: mcp23xxx: mcp23xxx_0x20 number: 14 mode: INPUT inverted: True - platform: gpio name: "hub1_in15" id: hub1_in15 pin: mcp23xxx: mcp23xxx_0x20 number: 15 mode: INPUT inverted: True ################## # mcp23xxx_0x22 # ################## # Korytarz 2 — single: out15 - platform: gpio name: "Korytarz 2" id: hub2_in0 pin: mcp23xxx: mcp23xxx_0x22 number: 0 mode: INPUT inverted: True on_click: then: - light.toggle: mcp_0x21_out15 # Korytarz 3 — single: WLED korytarz kinkiety, long: wyłącz wszystkie - platform: gpio name: "Korytarz 3" id: hub2_in1 pin: mcp23xxx: mcp23xxx_0x22 number: 1 mode: INPUT inverted: True on_multi_click: - timing: - ON for at most 350ms - OFF for at least 350ms then: - script.execute: wled_korytarz_kinkiety_toggle - timing: - ON for at least 350ms then: - script.execute: off_all_lights - script.execute: off_all_fans # Korytarz 1 — single: out14, long: wyłącz wszystkie - platform: gpio name: "Korytarz 1" id: hub2_in2 pin: mcp23xxx: mcp23xxx_0x22 number: 2 mode: INPUT inverted: True on_multi_click: - timing: - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x21_out14 - timing: - ON for at least 350ms then: - script.execute: off_all_lights - script.execute: off_all_fans # Mały Korytarz — brak automatyzacji - platform: gpio name: "Mały Korytarz" id: hub2_in3 pin: mcp23xxx: mcp23xxx_0x22 number: 3 mode: INPUT inverted: True # Garderoba Mała — single: out14, double: wentylator - platform: gpio name: "Garderoba Mała" id: hub2_in4 pin: mcp23xxx: mcp23xxx_0x22 number: 4 mode: INPUT inverted: True on_multi_click: - timing: - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x23_out14 - timing: - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x25_out2 # Kuchnia 3_1 — single: out8 - platform: gpio name: "Kuchnia 3_1" id: hub2_in5 pin: mcp23xxx: mcp23xxx_0x22 number: 5 mode: INPUT inverted: True on_click: then: - light.toggle: mcp_0x21_out8 # Kuchnia 3_2 — single: jadalnia LED - platform: gpio name: "Kuchnia 3_2" id: hub2_in6 pin: mcp23xxx: mcp23xxx_0x22 number: 6 mode: INPUT inverted: True on_click: then: - light.toggle: jadalnia_led # Kuchnia 2_1 — single: out3, triple: wyłącz lampy, long: wyłącz wentylatory - platform: gpio name: "Kuchnia 2_1" id: hub2_in7 pin: mcp23xxx: mcp23xxx_0x22 number: 7 mode: INPUT inverted: True on_multi_click: - timing: - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x21_out3 - timing: - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at least 350ms then: - script.execute: off_all_lights - timing: - ON for at least 350ms then: - script.execute: off_all_fans # Kuchnia 2_2 — single: kuchnia łezka LED - platform: gpio name: "Kuchnia 2_2" id: hub2_in8 pin: mcp23xxx: mcp23xxx_0x22 number: 8 mode: INPUT inverted: True on_click: then: - light.toggle: kuchnia_lezka_led # Kuchnia 1_1 — single: out11, double: WLED salon wentylator - platform: gpio name: "Kuchnia 1_1" id: hub2_in9 pin: mcp23xxx: mcp23xxx_0x22 number: 9 mode: INPUT inverted: True on_multi_click: - timing: - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x23_out11 - timing: - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at least 350ms then: - script.execute: wled_salon_wentylator_toggle # Kuchnia 1_2 — single: WLED komin+salon kinkiety, double/long: WLED komin on - platform: gpio name: "Kuchnia 1_2" id: hub2_in10 pin: mcp23xxx: mcp23xxx_0x22 number: 10 mode: INPUT inverted: True on_multi_click: - timing: - ON for at most 350ms - OFF for at least 350ms then: - script.execute: wled_komin_toggle - script.execute: wled_salon_kinkiety_toggle - timing: - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at least 350ms then: - script.execute: wled_komin_on - timing: - ON for at least 350ms then: - script.execute: wled_komin_on # Schody 3 — single: WLED schody all - platform: gpio name: "Schody 3" id: hub2_in11 pin: mcp23xxx: mcp23xxx_0x22 number: 11 mode: INPUT inverted: True on_click: then: - script.execute: wled_schody_all_toggle # Schody 1 — single: out11 - platform: gpio name: "Schody 1" id: hub2_in12 pin: mcp23xxx: mcp23xxx_0x22 number: 12 mode: INPUT inverted: True on_click: then: - light.toggle: mcp_0x23_out11 # Schody 2 — single: WLED salon kinkiety, double: off, long: WLED komin - platform: gpio name: "Schody 2" id: hub2_in13 pin: mcp23xxx: mcp23xxx_0x22 number: 13 mode: INPUT inverted: True on_multi_click: - timing: - ON for at most 350ms - OFF for at least 350ms then: - script.execute: wled_salon_kinkiety_toggle - timing: - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at least 350ms then: - script.execute: wled_salon_kinkiety_off - timing: - ON for at least 350ms then: - script.execute: wled_komin_toggle # Nie podpięte - platform: gpio name: "hub2_in14" id: hub2_in14 pin: mcp23xxx: mcp23xxx_0x22 number: 14 mode: INPUT inverted: True - platform: gpio name: "hub2_in15" id: hub2_in15 pin: mcp23xxx: mcp23xxx_0x22 number: 15 mode: INPUT inverted: True ################## # mcp23xxx_0x24 # ################## # Garderoba Duża Lewy — single: out7 - platform: gpio name: "Garderoba Duża Lewy" id: hub3_in0 pin: mcp23xxx: mcp23xxx_0x24 number: 0 mode: INPUT inverted: True on_click: then: - light.toggle: mcp_0x21_out7 # Garderoba Duża Prawy — single: out7 - platform: gpio name: "Garderoba Duża Prawy" id: hub3_in1 pin: mcp23xxx: mcp23xxx_0x24 number: 1 mode: INPUT inverted: True on_click: then: - light.toggle: mcp_0x21_out7 # SPA Lewy — single: out13, triple: wentylator - platform: gpio name: "SPA Lewy" id: hub3_in2 pin: mcp23xxx: mcp23xxx_0x24 number: 2 mode: INPUT inverted: True on_multi_click: - timing: - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x23_out13 - timing: - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x21_out4 # SPA Prawy — single: out4+out10, triple: SPA Ledy - platform: gpio name: "SPA Prawy" id: hub3_in3 pin: mcp23xxx: mcp23xxx_0x24 number: 3 mode: INPUT inverted: True on_multi_click: - timing: - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x21_out4 - light.toggle: mcp_0x21_out10 - timing: - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: spa_ledy # Biała Łazienka Ściana — single: out0, double: wanna LED, long: wentylator - platform: gpio name: "Biała Łazienka Ściana" id: hub3_in4 pin: mcp23xxx: mcp23xxx_0x24 number: 4 mode: INPUT inverted: True on_multi_click: - timing: - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x23_out0 - timing: - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: biala_lazienka_wanna_led - timing: - ON for at least 350ms then: - light.toggle: mcp_0x23_out8 # Małe WC Lustro Prawy — single: out2 + WLED wc + wentylator - platform: gpio name: "Małe WC Lustro Prawy" id: hub3_in5 pin: mcp23xxx: mcp23xxx_0x24 number: 5 mode: INPUT inverted: True on_click: then: - light.toggle: mcp_0x23_out2 - light.toggle: mcp_0x23_out5 - script.execute: wled_wc_led_toggle # Małe WC Lustro Lewy — single: out9 - platform: gpio name: "Małe WC Lustro Lewy" id: hub3_in6 pin: mcp23xxx: mcp23xxx_0x24 number: 6 mode: INPUT inverted: True on_click: then: - light.toggle: mcp_0x21_out9 # Biała Łazienka Skos — single: out4 - platform: gpio name: "Biała Łazienka Skos" id: hub3_in7 pin: mcp23xxx: mcp23xxx_0x24 number: 7 mode: INPUT inverted: True on_click: then: - light.toggle: mcp_0x23_out4 # SPA Lustro Lewy — single: out5 - platform: gpio name: "SPA Lustro Lewy" id: hub3_in8 pin: mcp23xxx: mcp23xxx_0x24 number: 8 mode: INPUT inverted: True on_click: then: - light.toggle: mcp_0x21_out5 # SPA Lustro Prawy — single: out1 - platform: gpio name: "SPA Lustro Prawy" id: hub3_in9 pin: mcp23xxx: mcp23xxx_0x24 number: 9 mode: INPUT inverted: True on_click: then: - light.toggle: mcp_0x21_out1 # Biuro Skos — single: out2, double: serwer LED wyłącz - platform: gpio name: "Biuro Skos" id: hub3_in10 pin: mcp23xxx: mcp23xxx_0x24 number: 10 mode: INPUT inverted: True on_multi_click: - timing: - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x21_out2 - timing: - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at least 350ms then: - light.turn_off: serwer_led # Serwer Prawy — single: serwer LED, double: out2, triple: wentylator - platform: gpio name: "Serwer Prawy" id: hub3_in11 pin: mcp23xxx: mcp23xxx_0x24 number: 11 mode: INPUT inverted: True on_multi_click: - timing: - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: serwer_led - timing: - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x21_out2 - timing: - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x25_out2 # Serwer Lewy — single: out14, triple: wyłącz lampy, long: wyłącz wentylatory - platform: gpio name: "Serwer Lewy" id: hub3_in12 pin: mcp23xxx: mcp23xxx_0x24 number: 12 mode: INPUT inverted: True on_multi_click: - timing: - ON for at most 350ms - OFF for at least 350ms then: - light.toggle: mcp_0x21_out14 - timing: - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at most 350ms - ON for at most 350ms - OFF for at least 350ms then: - script.execute: off_all_lights - timing: - ON for at least 350ms then: - script.execute: off_all_fans # Nie podpięte - platform: gpio name: "hub3_in13" id: hub3_in13 pin: mcp23xxx: mcp23xxx_0x24 number: 13 mode: INPUT inverted: True - platform: gpio name: "hub3_in14" id: hub3_in14 pin: mcp23xxx: mcp23xxx_0x24 number: 14 mode: INPUT inverted: True - platform: gpio name: "hub3_in15" id: hub3_in15 pin: mcp23xxx: mcp23xxx_0x24 number: 15 mode: INPUT inverted: True esp32_ble_tracker: sensor: - platform: uptime type: seconds name: Uptime Sensor - platform: atc_mithermometer mac_address: "A4:C1:38:C5:11:58" temperature: name: "Biuro Temperatura" humidity: name: "Biuro Nawilzenie" battery_level: name: "Biuro Bateria" - platform: atc_mithermometer mac_address: "A4:C1:38:5C:4F:38" temperature: name: "Serwer Temperatura" humidity: name: "Serwer Nawilzenie" battery_level: name: "Serwer Bateria" - platform: atc_mithermometer mac_address: "A4:C1:38:67:6B:94" temperature: name: "Kuchnia Temperatura" humidity: name: "Kuchnia Nawilzenie" battery_level: name: "Kuchnia Bateria" - platform: atc_mithermometer mac_address: "A4:C1:38:C9:FE:CA" temperature: name: "WC Temperatura" humidity: name: "WC Nawilzenie" battery_level: name: "WC Bateria" - platform: atc_mithermometer mac_address: "A4:C1:38:63:6D:DB" temperature: name: "Lazienka Temperatura" humidity: name: "Lazienka Nawilzenie" battery_level: name: "Lazienka Bateria"