09-04-2025, 12:52 PM
Ok, this is my current code with very small changes and update to use ESPHome 2025.8.3!
I have split the code in two post because I receive the error for the message too long:
I have split the code in two post because I receive the error for the message too long:
Code:
esphome:
name: kc868-a32
friendly_name: KC868-A32
esp32:
board: esp32dev
framework:
type: esp-idf
version: recommended
# Enable logging
logger:
# level: VERBOSE
# Enable Home Assistant API
api:
ota:
- platform: esphome
password: "ota_password"
safe_mode:
reboot_timeout: 10min # Longer Timeout
num_attempts: 3 # Multiple attempts
# ________________________________________________________________________________
# Network Configuration
# --- WiFi
#wifi:
# ssid: !secret wifi_ssid
# password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
# ap:
# ssid: "Kc868-A32 Fallback Hotspot"
# password: "ap_password"
#captive_portal:
# --- Ethernet
# Ethernet configuration entry (It's possible to use only WIFI or only Ethernet, not both)
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk:
pin: GPIO17
mode: CLK_OUT
phy_addr: 0
manual_ip: # Recommended for router compatibility
static_ip: 192.168.1.183
gateway: 192.168.1.254
subnet: 255.255.255.0
dns1: 8.8.8.8 # Primary DNS
dns2: 8.8.4.4 # Secondary DNS
# ________________________________________________________________________________
# Alternative debug and OTA web server
web_server:
port: 80
version: 2
include_internal: true
# ________________________________________________________________________________
# Syncronize the time with the Home Assistant
time:
- platform: homeassistant
id: homeassistant_time
timezone: Europe/Rome
# ________________________________________________________________________________
# Example configuration entry
i2c:
- id: bus_a
sda: 15
scl: 13
scan: true
frequency: 100kHz # Lower frequency for stability
- id: bus_b
sda: 4
scl: 5
scan: true
frequency: 100kHz # Lower frequency for stability
# ________________________________________________________________________________
# Example configuration entry
pcf8574:
- id: 'pcf8574_hub_out_1' # for output channel 1-8
i2c_id: bus_a
address: 0x24
- id: 'pcf8574_hub_out_2' # for output channel 9-16
i2c_id: bus_a
address: 0x25
- id: 'pcf8574_hub_out_3' # for output channel 17-24
i2c_id: bus_a
address: 0x21
- id: 'pcf8574_hub_out_4' # for output channel 25-32
i2c_id: bus_a
address: 0x22
- id: 'pcf8574_hub_in_1' # for input channel 1-8
i2c_id: bus_b
address: 0x24
- id: 'pcf8574_hub_in_2' # for input channel 9-16
i2c_id: bus_b
address: 0x25
- id: 'pcf8574_hub_in_3' # for input channel 17-24
i2c_id: bus_b
address: 0x21
- id: 'pcf8574_hub_in_4' # for input channel 25-32
i2c_id: bus_b
address: 0x22
# ________________________________________________________________________________
# Individual outputs
switch:
- platform: gpio
name: "relay1"
pin:
pcf8574: pcf8574_hub_out_1
number: 0
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay2"
pin:
pcf8574: pcf8574_hub_out_1
number: 1
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay3"
pin:
pcf8574: pcf8574_hub_out_1
number: 2
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay4"
pin:
pcf8574: pcf8574_hub_out_1
number: 3
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay5"
pin:
pcf8574: pcf8574_hub_out_1
number: 4
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay6"
pin:
pcf8574: pcf8574_hub_out_1
number: 5
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay7"
pin:
pcf8574: pcf8574_hub_out_1
number: 6
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay8"
pin:
pcf8574: pcf8574_hub_out_1
number: 7
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay9"
pin:
pcf8574: pcf8574_hub_out_2
number: 0
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay10"
pin:
pcf8574: pcf8574_hub_out_2
number: 1
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay11"
pin:
pcf8574: pcf8574_hub_out_2
number: 2
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay12"
pin:
pcf8574: pcf8574_hub_out_2
number: 3
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay13"
pin:
pcf8574: pcf8574_hub_out_2
number: 4
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay14"
pin:
pcf8574: pcf8574_hub_out_2
number: 5
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay15"
pin:
pcf8574: pcf8574_hub_out_2
number: 6
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay16"
pin:
pcf8574: pcf8574_hub_out_2
number: 7
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay17"
pin:
pcf8574: pcf8574_hub_out_3
number: 0
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay18"
pin:
pcf8574: pcf8574_hub_out_3
number: 1
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay19"
pin:
pcf8574: pcf8574_hub_out_3
number: 2
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay20"
pin:
pcf8574: pcf8574_hub_out_3
number: 3
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay21"
pin:
pcf8574: pcf8574_hub_out_3
number: 4
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay22"
pin:
pcf8574: pcf8574_hub_out_3
number: 5
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay23"
pin:
pcf8574: pcf8574_hub_out_3
number: 6
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay24"
pin:
pcf8574: pcf8574_hub_out_3
number: 7
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay25"
pin:
pcf8574: pcf8574_hub_out_4
number: 0
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay26"
pin:
pcf8574: pcf8574_hub_out_4
number: 1
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay27"
pin:
pcf8574: pcf8574_hub_out_4
number: 2
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay28"
pin:
pcf8574: pcf8574_hub_out_4
number: 3
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay29"
pin:
pcf8574: pcf8574_hub_out_4
number: 4
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay30"
pin:
pcf8574: pcf8574_hub_out_4
number: 5
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay31"
pin:
pcf8574: pcf8574_hub_out_4
number: 6
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay32"
pin:
pcf8574: pcf8574_hub_out_4
number: 7
mode: OUTPUT
inverted: true
# Continued in the next post
