Esphome invalid config KC-868 A8 - Lory - 12-09-2024
In KC-868 A8 in EspHome I have problems setting up the switch component.
I want that when I press digital Input#1 then relay #1 Toggles.
PCF8574 I/O Expander uses I2C Bus to set IDs, probably that is why the YAML validator don't recognizes the ID of light1? I don't know.
I know I can link the inputs and the relays in HomeAssistant, but I want the logic to be coded in the board so It still works if Internet brokes.
I also know that KCS firmware allows that requirement, but I am looking for an EspHome solution.
Thank you
EspHome Config:
Code: esphome:
name: esphome-web-026fd8
platform: ESP32
board: esp32dev
i2c:
sda: 4
scl: 5
scan: true
id: bus_a
logger:
api:
ota:
- platform: esphome
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 0
pcf8574:
- id: 'out' # for output channel 1-8
address: 0x24
- id: 'in' # for input channel 1-8
address: 0x22
switch:
- platform: gpio
name: "light1"
pin:
pcf8574: out
number: 0
mode: OUTPUT
inverted: true
binary_sensor:
- platform: gpio
name: "input1"
pin:
pcf8574: in
number: 0
mode: INPUT
inverted: true
on_press:
then:
- switch.toggle: light1
Yaml Validator Output:
RE: Esphome invalid config KC-868 A8 - admin - 12-09-2024
you should add "id" option, here is sample code for KC868-A8S, but the INPUT trigger OUTPUT as same way.
Code: esphome:
name: a8s
platform: ESP32
board: esp32dev
remote_receiver:
pin: 16
dump:
- rc_switch
tolerance: 50%
filter: 250us
idle: 2ms
buffer_size: 2kb
# Example configuration entry for ESP32
i2c:
sda: 4
scl: 5
scan: true
id: bus_a
# Example configuration entry
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 0
# Example configuration entry
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
# Individual outputs
switch:
- platform: gpio
name: "light1"
id: light1
pin:
pcf8574: pcf8574_hub_out_1
number: 0
mode: OUTPUT
inverted: true
- platform: gpio
name: "light2"
id: light2
pin:
pcf8574: pcf8574_hub_out_1
number: 1
mode: OUTPUT
inverted: true
- platform: gpio
name: "light3"
id: light3
pin:
pcf8574: pcf8574_hub_out_1
number: 2
mode: OUTPUT
inverted: true
- platform: gpio
name: "light4"
id: light4
pin:
pcf8574: pcf8574_hub_out_1
number: 3
mode: OUTPUT
inverted: true
- platform: gpio
name: "curtain1-up"
id: relay5
interlock: [relay6]
pin:
pcf8574: pcf8574_hub_out_1
number: 4
mode: OUTPUT
inverted: true
- platform: gpio
name: "curtain1-down"
id: relay6
interlock: [relay5]
pin:
pcf8574: pcf8574_hub_out_1
number: 5
mode: OUTPUT
inverted: true
- platform: gpio
name: "curtain2-up"
id: relay7
interlock: [relay8]
pin:
pcf8574: pcf8574_hub_out_1
number: 6
mode: OUTPUT
inverted: true
- platform: gpio
name: "curtain2-down"
id: relay8
interlock: [relay7]
pin:
pcf8574: pcf8574_hub_out_1
number: 7
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
- platform: gpio
name: "input2"
on_press:
then:
- switch.toggle: light2
pin:
pcf8574: pcf8574_hub_in_1
number: 1
mode: INPUT
inverted: true
- platform: gpio
name: "input3"
on_press:
then:
- switch.toggle: light3
pin:
pcf8574: pcf8574_hub_in_1
number: 2
mode: INPUT
inverted: true
- platform: gpio
name: "input4"
on_press:
then:
- switch.toggle: light4
pin:
pcf8574: pcf8574_hub_in_1
number: 3
mode: INPUT
inverted: true
- platform: gpio
name: "input5"
on_press:
then:
- switch.toggle: relay5
pin:
pcf8574: pcf8574_hub_in_1
number: 4
mode: INPUT
inverted: true
- platform: gpio
name: "input6"
on_press:
then:
- switch.toggle: relay6
pin:
pcf8574: pcf8574_hub_in_1
number: 5
mode: INPUT
inverted: true
- platform: gpio
name: "input7"
on_press:
then:
- switch.toggle: relay7
pin:
pcf8574: pcf8574_hub_in_1
number: 6
mode: INPUT
inverted: true
- platform: gpio
name: "input8"
on_press:
then:
- switch.toggle: relay8
pin:
pcf8574: pcf8574_hub_in_1
number: 7
mode: INPUT
inverted: true
- platform: remote_receiver
name: "remoter1"
rc_switch_raw:
code: '001111010111001010111000'
protocol: 1
on_press:
then:
- switch.toggle: light1
filters:
- delayed_off: 200ms
- platform: remote_receiver
name: "remoter2"
rc_switch_raw:
code: '001111010111001010111100'
protocol: 1
on_press:
then:
- switch.toggle: light2
filters:
- delayed_off: 200ms
- platform: remote_receiver
name: "remoter3"
rc_switch_raw:
code: '001111010111001010110100'
protocol: 1
on_press:
then:
- switch.toggle: light3
filters:
- delayed_off: 200ms
- platform: remote_receiver
name: "remoter4"
rc_switch_raw:
code: '001111010111001010111001'
protocol: 1
on_press:
then:
- switch.toggle: light4
filters:
- delayed_off: 200ms
- platform: remote_receiver
name: "remoter5"
rc_switch_raw:
code: '001111010111001010110010'
protocol: 1
on_press:
then:
- switch.toggle: relay5
filters:
- delayed_off: 200ms
- platform: remote_receiver
name: "remoter6"
rc_switch_raw:
code: '001111010111001010110101'
protocol: 1
on_press:
then:
- switch.toggle: relay6
filters:
- delayed_off: 200ms
- platform: remote_receiver
name: "remoter7"
rc_switch_raw:
code: '001111010111001010110001'
protocol: 1
on_press:
then:
- switch.toggle: relay7
filters:
- delayed_off: 200ms
- platform: remote_receiver
name: "remoter8"
rc_switch_raw:
code: '001111010111001010110011'
protocol: 1
on_press:
then:
- switch.toggle: relay8
filters:
- delayed_off: 200ms
- platform: gpio
name: "PIR1"
pin: 14
device_class: motion
on_release:
- script.execute: motion_timer
script:
- id: motion_timer
mode: restart
then:
- delay: 10s
- switch.turn_off: light1
- switch.turn_off: light2
- switch.turn_off: light3
- switch.turn_off: light4
# Enable logging
logger:
# Enable Home Assistant API
api:
RE: Esphome invalid config KC-868 A8 - Lory - 12-09-2024
(12-09-2024, 10:20 PM)admin Wrote: you should add "id" option, here is sample code for KC868-A8S, but the INPUT trigger OUTPUT as same way.
Code: esphome:
name: a8s
platform: ESP32
board: esp32dev
remote_receiver:
pin: 16
dump:
- rc_switch
tolerance: 50%
filter: 250us
idle: 2ms
buffer_size: 2kb
# Example configuration entry for ESP32
i2c:
sda: 4
scl: 5
scan: true
id: bus_a
# Example configuration entry
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 0
# Example configuration entry
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
# Individual outputs
switch:
- platform: gpio
name: "light1"
id: light1
pin:
pcf8574: pcf8574_hub_out_1
number: 0
mode: OUTPUT
inverted: true
- platform: gpio
name: "light2"
id: light2
pin:
pcf8574: pcf8574_hub_out_1
number: 1
mode: OUTPUT
inverted: true
- platform: gpio
name: "light3"
id: light3
pin:
pcf8574: pcf8574_hub_out_1
number: 2
mode: OUTPUT
inverted: true
- platform: gpio
name: "light4"
id: light4
pin:
pcf8574: pcf8574_hub_out_1
number: 3
mode: OUTPUT
inverted: true
- platform: gpio
name: "curtain1-up"
id: relay5
interlock: [relay6]
pin:
pcf8574: pcf8574_hub_out_1
number: 4
mode: OUTPUT
inverted: true
- platform: gpio
name: "curtain1-down"
id: relay6
interlock: [relay5]
pin:
pcf8574: pcf8574_hub_out_1
number: 5
mode: OUTPUT
inverted: true
- platform: gpio
name: "curtain2-up"
id: relay7
interlock: [relay8]
pin:
pcf8574: pcf8574_hub_out_1
number: 6
mode: OUTPUT
inverted: true
- platform: gpio
name: "curtain2-down"
id: relay8
interlock: [relay7]
pin:
pcf8574: pcf8574_hub_out_1
number: 7
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
- platform: gpio
name: "input2"
on_press:
then:
- switch.toggle: light2
pin:
pcf8574: pcf8574_hub_in_1
number: 1
mode: INPUT
inverted: true
- platform: gpio
name: "input3"
on_press:
then:
- switch.toggle: light3
pin:
pcf8574: pcf8574_hub_in_1
number: 2
mode: INPUT
inverted: true
- platform: gpio
name: "input4"
on_press:
then:
- switch.toggle: light4
pin:
pcf8574: pcf8574_hub_in_1
number: 3
mode: INPUT
inverted: true
- platform: gpio
name: "input5"
on_press:
then:
- switch.toggle: relay5
pin:
pcf8574: pcf8574_hub_in_1
number: 4
mode: INPUT
inverted: true
- platform: gpio
name: "input6"
on_press:
then:
- switch.toggle: relay6
pin:
pcf8574: pcf8574_hub_in_1
number: 5
mode: INPUT
inverted: true
- platform: gpio
name: "input7"
on_press:
then:
- switch.toggle: relay7
pin:
pcf8574: pcf8574_hub_in_1
number: 6
mode: INPUT
inverted: true
- platform: gpio
name: "input8"
on_press:
then:
- switch.toggle: relay8
pin:
pcf8574: pcf8574_hub_in_1
number: 7
mode: INPUT
inverted: true
- platform: remote_receiver
name: "remoter1"
rc_switch_raw:
code: '001111010111001010111000'
protocol: 1
on_press:
then:
- switch.toggle: light1
filters:
- delayed_off: 200ms
- platform: remote_receiver
name: "remoter2"
rc_switch_raw:
code: '001111010111001010111100'
protocol: 1
on_press:
then:
- switch.toggle: light2
filters:
- delayed_off: 200ms
- platform: remote_receiver
name: "remoter3"
rc_switch_raw:
code: '001111010111001010110100'
protocol: 1
on_press:
then:
- switch.toggle: light3
filters:
- delayed_off: 200ms
- platform: remote_receiver
name: "remoter4"
rc_switch_raw:
code: '001111010111001010111001'
protocol: 1
on_press:
then:
- switch.toggle: light4
filters:
- delayed_off: 200ms
- platform: remote_receiver
name: "remoter5"
rc_switch_raw:
code: '001111010111001010110010'
protocol: 1
on_press:
then:
- switch.toggle: relay5
filters:
- delayed_off: 200ms
- platform: remote_receiver
name: "remoter6"
rc_switch_raw:
code: '001111010111001010110101'
protocol: 1
on_press:
then:
- switch.toggle: relay6
filters:
- delayed_off: 200ms
- platform: remote_receiver
name: "remoter7"
rc_switch_raw:
code: '001111010111001010110001'
protocol: 1
on_press:
then:
- switch.toggle: relay7
filters:
- delayed_off: 200ms
- platform: remote_receiver
name: "remoter8"
rc_switch_raw:
code: '001111010111001010110011'
protocol: 1
on_press:
then:
- switch.toggle: relay8
filters:
- delayed_off: 200ms
- platform: gpio
name: "PIR1"
pin: 14
device_class: motion
on_release:
- script.execute: motion_timer
script:
- id: motion_timer
mode: restart
then:
- delay: 10s
- switch.turn_off: light1
- switch.turn_off: light2
- switch.turn_off: light3
- switch.turn_off: light4
# Enable logging
logger:
# Enable Home Assistant API
api:
Thank you,
I just discovered it and came here to publish the answer, in case someone finds it usefull this worked for me:
Code: switch:
- platform: gpio
name: "relay1"
id: "relay1"
pin:
pcf8574: out
number: 0
mode: OUTPUT
inverted: true
binary_sensor:
- platform: gpio
name: "input1"
id: "input1"
pin:
pcf8574: in
number: 0
mode: INPUT
inverted: true
on_click:
min_length: 50ms
max_length: 350ms
then:
- lambda: |-
id(relay1).toggle();
RE: Esphome invalid config KC-868 A8 - admin - 12-09-2024
ok, good.
RE: Esphome invalid config KC-868 A8 - MariusM - 12-10-2024
Can I configure 868 server via mqtt to toggle specific output ?
Example:
switch output 3 - toggle
Switch output 2 - on/of
I have at the moment configuration with on/of but I would like to toggle some output switches.
RE: Esphome invalid config KC-868 A8 - admin - 12-10-2024
sure, it's ok.
RE: Esphome invalid config KC-868 A8 - MariusM - 12-12-2024
Can you help with a hint of how to do that?
RE: Esphome invalid config KC-868 A8 - admin - 12-13-2024
1. config KC868-Server's digital input ports work as BINARY SENSOR in home assistant by MQTT.
2. create AUTOMATION in home assistant set the ACTION for ON/OFF/TOGGLE.
RE: Esphome invalid config KC-868 A8 - Lory - 02-16-2025
I have a bug in the KC-868 A8.
Bug description:
- The board works fine for approximately 20 minutes, then It reboots.
Running EspHome Configuration:
Code: esphome:
name: kc868-a8
platform: ESP32
board: esp32dev
logger:
api:
ota:
- platform: esphome
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 0
i2c:
sda: 4
scl: 5
scan: true
id: bus_a
pcf8574:
- id: 'out'
address: 0x24
- id: 'in'
address: 0x22
switch:
- platform: gpio
name: "relay1"
id: "relay1"
pin:
pcf8574: out
number: 0
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay2"
id: "relay2"
pin:
pcf8574: out
number: 1
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay3"
id: "relay3"
pin:
pcf8574: out
number: 2
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay4"
id: "relay4"
pin:
pcf8574: out
number: 3
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay5"
id: "relay5"
pin:
pcf8574: out
number: 4
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay6"
id: "relay6"
pin:
pcf8574: out
number: 5
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay7"
id: "relay7"
pin:
pcf8574: out
number: 6
mode: OUTPUT
inverted: true
- platform: gpio
name: "relay8"
id: "relay8"
pin:
pcf8574: out
number: 7
mode: OUTPUT
inverted: true
binary_sensor:
- platform: gpio
name: "input1"
id: "input1"
pin:
pcf8574: in
number: 0
mode: INPUT
inverted: true
on_click:
min_length: 30ms
max_length: 500ms
then:
- switch.toggle: relay1
- platform: gpio
name: "input2"
id: "input2"
pin:
pcf8574: in
number: 1
mode: INPUT
inverted: true
on_click:
min_length: 30ms
max_length: 500ms
then:
- switch.toggle: relay2
- platform: gpio
name: "input3"
id: "input3"
pin:
pcf8574: in
number: 2
mode: INPUT
inverted: true
on_click:
min_length: 30ms
max_length: 500ms
then:
- switch.toggle: relay3
- platform: gpio
name: "input4"
id: "input4"
pin:
pcf8574: in
number: 3
mode: INPUT
inverted: true
on_click:
min_length: 30ms
max_length: 500ms
then:
- switch.toggle: relay4
- platform: gpio
name: "input5"
id: "input5"
pin:
pcf8574: in
number: 4
mode: INPUT
inverted: true
on_click:
min_length: 30ms
max_length: 500ms
then:
- switch.toggle: relay5
- platform: gpio
name: "input6"
id: "input6"
pin:
pcf8574: in
number: 5
mode: INPUT
inverted: true
on_click:
min_length: 30ms
max_length: 500ms
then:
- switch.toggle: relay6
- platform: gpio
name: "input7"
id: "input7"
pin:
pcf8574: in
number: 6
mode: INPUT
inverted: true
on_click:
min_length: 30ms
max_length: 500ms
then:
- switch.toggle: relay7
- platform: gpio
name: "input8"
id: "input8"
pin:
pcf8574: in
number: 7
mode: INPUT
inverted: true
on_click:
min_length: 30ms
max_length: 500ms
then:
- switch.toggle: relay8
- platform: gpio
name: "a8-v2-s3"
pin:
number: 32
inverted: true
- platform: gpio
name: "a8-v2-s4"
pin:
number: 33
inverted: true
web_server:
version: 2
port: 80
Outcome:
- I have 16 lights in my apartment that are controlled with 2 KC-868 A8 boards. After approximately 20 minutes both boards reboot and all lights switch off, then I have to press the switches on again to have light.
Steps I tried:
- Review the EspHome config file. I don't see anything strange, Probably I am using a non recommended gpio that makes the trouble?
- Power supply review, I changed the power supply and connected to different sources but the problem persists. Is strange that both boards reboot at the same exact moment...
I appreciate some expert advice. Thanks
RE: Esphome invalid config KC-868 A8 - admin - 02-17-2025
i suggest you download our KCS v2 firmware for a testing. just to check whether the software problem or hardware problem.
|