Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Relays on ESPHome not working
#1
Sad 
Hey everyone!! 
I just configure my brand new KC868-A16 REV 1.6 on EspHome with this code:

Code:
esphome:
  name: calefaccion-central
  friendly_name: Calefaccion Central

esp32:
  board: esp32dev
  framework:
    type: esp-idf

# Enable logging
logger:
  level: VERY_VERBOSE

# Enable Home Assistant API
api:
  encryption:
    key: "WXXXXXXXXXXXXXXXXXXXXXnEgY="

ota:
  - platform: esphome
    password: "ca97bdfXXXXXXXXXXXXXXXXdab073"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Calefaccion-Central"
    password: "69NT2lnfj2Kd"

captive_portal:

i2c:
  sda: GPIO4
  scl:
    number: GPIO5
    ignore_strapping_warning: true

pcf8574:

  - id: outputs_1_8
    address: 0x24
    pcf8575: false

switch:

  - platform: gpio
    name: "sw_caldera"
    id: sw_caldera #1
    pin:
      pcf8574: outputs_1_8
      number: 0
      mode: OUTPUT
      inverted: true


I erase all the unecesary code.

The board seams to work ok, but I cant get the realys to work.
Here is the log from ESPHome:

Code:
INFO ESPHome 2025.2.0
INFO Reading configuration /config/esphome/calefaccion-central.yaml...
INFO Starting log output from 192.168.1.133 using esphome API
INFO Successfully connected to calefaccion-central @ 192.168.1.133 in 0.221s
INFO Successful handshake with calefaccion-central @ 192.168.1.133 in 0.145s
[19:21:35][I][app:100]: ESPHome version 2025.2.0 compiled on Mar 12 2025, 19:11:06
[19:21:35][C][wifi:600]: WiFi:
[19:21:35][C][wifi:428]:   Local MAC: 20:#########:50
[19:21:35][C][wifi:433]:   SSID: [redacted]
[19:21:35][C][wifi:436]:   IP Address: 192.168.1.133
[19:21:35][C][wifi:439]:   BSSID: [redacted]
[19:21:35][C][wifi:441]:   Hostname: 'calefaccion-central'
[19:21:35][C][wifi:443]:   Signal strength: -62 dB ▂▄▆█
[19:21:35][V][wifi:445]:   Priority: 0.0
[19:21:35][C][wifi:447]:   Channel: 1
[19:21:35][C][wifi:448]:   Subnet: 255.255.255.0
[19:21:35][C][wifi:449]:   Gateway: 192.168.1.1
[19:21:35][C][wifi:450]:   DNS1: 200.28.4.130
[19:21:35][C][wifi:451]:   DNS2: 200.28.4.129
[19:21:35][C][logger:177]: Logger:
[19:21:35][C][logger:178]:   Max Level: VERY_VERBOSE
[19:21:35][C][logger:179]:   Initial Level: VERY_VERBOSE
[19:21:35][C][logger:181]:   Log Baud Rate: 115200
[19:21:35][C][logger:182]:   Hardware UART: UART0
[19:21:35][C][i2c.idf:079]: I2C Bus:
[19:21:35][C][i2c.idf:080]:   SDA Pin: GPIO4
[19:21:35][C][i2c.idf:081]:   SCL Pin: GPIO5
[19:21:35][C][i2c.idf:082]:   Frequency: 50000 Hz
[19:21:36][C][i2c.idf:088]:   Recovery: bus successfully recovered
[19:21:36][I][i2c.idf:098]: Results from i2c bus scan:
[19:21:36][I][i2c.idf:104]: Found i2c device at address 0x21
[19:21:36][I][i2c.idf:104]: Found i2c device at address 0x22
[19:21:36][I][i2c.idf:104]: Found i2c device at address 0x24
[19:21:36][I][i2c.idf:104]: Found i2c device at address 0x25
[19:21:36][C][pcf8574:021]: PCF8574:
[19:21:36][C][pcf8574:022]:   Address: 0x24
[19:21:36][C][pcf8574:023]:   Is PCF8575: NO
[19:21:36][C][switch.gpio:068]: GPIO Switch 'sw_caldera'
[19:21:36][C][switch.gpio:090]:   Restore Mode: always OFF
[19:21:36][C][switch.gpio:031]:   Pin: 0 via PCF8574
[19:21:36][C][switch.gpio:068]: GPIO Switch 'sw_bano_pieza'
[19:21:36][C][switch.gpio:090]:   Restore Mode: always OFF
[19:21:36][C][switch.gpio:031]:   Pin: 1 via PCF8574
[19:21:36][C][template.switch:068]: Template Switch 'Template Switch'
[19:21:36][C][template.switch:090]:   Restore Mode: always OFF
[19:21:36][C][template.switch:057]:   Optimistic: YES
[19:21:36][C][restart.button:017]: Restart Button 'Restart'
[19:21:36][C][restart.button:017]:   Icon: 'mdi:restart'
[19:21:36][C][captive_portal:089]: Captive Portal:
[19:21:36][C][mdns:116]: mDNS:
[19:21:36][C][mdns:117]:   Hostname: calefaccion-central
[19:21:36][V][mdns:118]:   Services:
[19:21:36][V][mdns:120]:   - _esphomelib, _tcp, 6053
[19:21:36][V][mdns:122]:     TXT: friendly_name = Calefaccion Central
[19:21:36][V][mdns:122]:     TXT: version = 2025.2.0
[19:21:36][V][mdns:122]:     TXT: mac = 20####50
[19:21:36][V][mdns:122]:     TXT: platform = ESP32
[19:21:36][V][mdns:122]:     TXT: board = esp32dev
[19:21:36][V][mdns:122]:     TXT: network = wifi
[19:21:36][V][mdns:122]:     TXT: api_encryption = Noise_NNpsk0_25519_ChaChaPoly_SHA256
[19:21:36][C][esphome.ota:073]: Over-The-Air updates:
[19:21:36][C][esphome.ota:074]:   Address: calefaccion-central.local:3232
[19:21:36][C][esphome.ota:075]:   Version: 2
[19:21:36][C][esphome.ota:078]:   Password configured
[19:21:36][C][safe_mode:018]: Safe Mode:
[19:21:36][C][safe_mode:019]:   Boot considered successful after 60 seconds
[19:21:36][C][safe_mode:021]:   Invoke after 10 boot attempts
[19:21:36][C][safe_mode:022]:   Remain in safe mode for 300 seconds
[19:21:36][C][api:140]: API Server:
[19:21:36][C][api:141]:   Address: calefaccion-central.local:6053
[19:21:36][C][api:143]:   Using noise encryption: YES
[19:21:42][VV][api.service:785]: on_switch_command_request: SwitchCommandRequest {
  key: 4158039208
  state: YES
}
[19:21:42][D][switch:012]: 'sw_caldera' Turning ON.
[19:21:42][VV][i2c.idf:201]: 0x24 TX FE
[19:21:42][D][switch:055]: 'sw_caldera': Sending state ON
[19:21:42][VV][api.service:156]: send_switch_state_response: SwitchStateResponse {
  key: 4158039208
  state: YES
}
[19:21:50][VV][api.service:785]: on_switch_command_request: SwitchCommandRequest {
  key: 4158039208
  state: NO
}
[19:21:50][D][switch:016]: 'sw_caldera' Turning OFF.
[19:21:50][VV][i2c.idf:201]: 0x24 TX FF
[19:21:50][D][switch:055]: 'sw_caldera': Sending state OFF
[19:21:50][VV][api.service:156]: send_switch_state_response: SwitchStateResponse {
  key: 4158039208
  state: NO
}


any help will be trully appriciate!!
Reply
#2
take a photo of your board, how you wire.
Reply
#3
(03-12-2025, 10:46 PM)admin Wrote: take a photo of your board, how you wire.
there is no wiring. just tring it out but it does not respond the swtch on the board although on the log you can see its on and off
[Image: Whats-App-Image-2025-03-12-at-20-42-48.jpg]
Reply
#4
let me correct my request. Im trying to turn on the digital outputs. Later on I will add the relays.
Reply
#5
look the photo of RED wires, need connect DC terminals with power supply.
   
Reply
#6
Thnks!!!
it works!
Reply
#7
Hey, so i just recieve the relay and I try to use them thid no luck.

This is the Relay:
https://www.aliexpress.com/item/40000321...pt=glo2esp

The 12 V DC coil.

The wiring you can see it on the bellow pictures.

[Image: Inked-Whats-App-Image-2025-03-17-at-17-16-49-LI.jpg]

[Image: Inked-Whats-App-Image-2025-03-17-at-17-16-49-1-LI.jpg]

The problem is that I have a 12 V on the terminals on the board but if I connect it to the relay, three thing happen:

 - The voltage drop to aprox 2 V
 - The lead turns on
 - The relay do not act.

What I'm doing wrong??


Thanks!!!
Reply
#8
your relay A1 point should connect to GND, NOT 12V.
KC868-A16 output 12V level, when turn on OUTPUT.
Reply
#9
(03-18-2025, 12:28 AM)admin Wrote: your relay A1 point should connect to GND, NOT 12V.
KC868-A16 output 12V level, when turn on OUTPUT.

Thanks!!
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)