Smart Home Automation Forum

Full Version: Configure KC868-A8 in ESPHome
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hello,

I'm trying to configure one of the relays on the board as a momentary relay, but I can't get the configuration right.

according to ESPHome the code should be

toggle:
  -platform: gpio
    pin: 25
    id:relay
    name: "Gate Remote"
    icon: "mdi:gate"
    on_turn_on:
    - delay: 500ms
    - switch.turn_off: relay

I have tried to adapt it to my configuration for relay 1 of the KC868-A8 board.

switch:
  - platform: gpio
    name: "a8-garaje_rele_1"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 0
      mode: OUTPUT
      inverted: true
      on_turn_on:
        - delay: 500ms
        - switch.turn_off: relay

but I can't get rid of the error "on_turn_on" is an invalid option for Pin

Could you help me configure it?

Thanks in advance
here is sample config for KC868-A8 input1 trigger output1:

esphome:
name: a8
platform: ESP32
board: esp32dev

i2c:
sda: 4
scl: 5
scan: true
id: bus_a

ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 0

pcf8574:
- id: 'pcf8574_hub_out_1' # for output channel 1-8
address: 0x24

- id: 'pcf8574_hub_in_1' # for input channel 1-8
address: 0x22

switch:
- platform: gpio
name: "light1"
id: light1
pin:
pcf8574: pcf8574_hub_out_1
number: 0
mode: OUTPUT
inverted: true


binary_sensor:
- platform: gpio
name: "input1"
on_press:
then:
- switch.toggle: light1
pin:
pcf8574: pcf8574_hub_in_1
number: 0
mode: INPUT
inverted: true
Pages: 1 2 3