Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
KC868-A32 configure for ESPhome
#20
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:

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
Reply


Messages In This Thread
KC868-A32 configure for ESPhome - by admin - 03-23-2022, 12:36 PM
RE: KC868-A32 configure for ESPhome - by nwells - 03-03-2023, 12:51 AM
RE: KC868-A32 configure for ESPhome - by admin - 03-03-2023, 02:36 AM
RE: KC868-A32 configure for ESPhome - by nwells - 03-03-2023, 04:30 AM
RE: KC868-A32 configure for ESPhome - by nwells - 03-03-2023, 06:10 AM
RE: KC868-A32 configure for ESPhome - by admin - 03-03-2023, 09:02 AM
RE: KC868-A32 configure for ESPhome - by nwells - 03-03-2023, 09:12 AM
RE: KC868-A32 configure for ESPhome - by admin - 03-03-2023, 09:53 AM
RE: KC868-A32 configure for ESPhome - by nwells - 03-03-2023, 10:00 AM
RE: KC868-A32 configure for ESPhome - by admin - 03-03-2023, 10:34 AM
RE: KC868-A32 configure for ESPhome - by nwells - 03-04-2023, 12:06 AM
RE: KC868-A32 configure for ESPhome - by admin - 03-04-2023, 12:48 AM
RE: KC868-A32 configure for ESPhome - by nwells - 03-04-2023, 01:18 AM
RE: KC868-A32 configure for ESPhome - by admin - 03-04-2023, 01:32 AM
RE: KC868-A32 configure for ESPhome - by admin - 12-24-2023, 11:32 AM
RE: KC868-A32 configure for ESPhome - by REVELAS - 12-27-2023, 07:22 PM
RE: KC868-A32 configure for ESPhome - by gigios - 09-04-2025, 08:30 AM
RE: KC868-A32 configure for ESPhome - by admin - 09-04-2025, 12:23 PM
RE: KC868-A32 configure for ESPhome - by gigios - 09-04-2025, 12:52 PM
RE: KC868-A32 configure for ESPhome - by gigios - 09-04-2025, 12:52 PM
RE: KC868-A32 configure for ESPhome - by gigios - 09-04-2025, 12:57 PM
RE: KC868-A32 configure for ESPhome - by admin - 09-04-2025, 11:10 PM
RE: KC868-A32 configure for ESPhome - by tasman - 09-09-2025, 04:16 PM
RE: KC868-A32 configure for ESPhome - by admin - 09-10-2025, 12:48 AM
RE: KC868-A32 configure for ESPhome - by tasman - 09-10-2025, 06:24 AM
RE: KC868-A32 configure for ESPhome - by admin - 09-10-2025, 06:37 AM
RE: KC868-A32 configure for ESPhome - by tasman - 09-10-2025, 07:08 AM
RE: KC868-A32 configure for ESPhome - by tasman - 09-10-2025, 11:49 AM
RE: KC868-A32 configure for ESPhome - by admin - 09-10-2025, 11:47 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)