esphome: name: kc868-a4s friendly_name: KC868-A4S esp32: board: esp32dev framework: type: arduino # Enable logging logger: # Enable Home Assistant API api: encryption: key: "sSPPo1tuCc/fx9lKQ1JTyQfpN9avHeX1lVYs6EvvCOc=" ota: password: "fca20dd8de14d7fec8546ee2e94c18f8" web_server: port: 80 # Example configuration entry for ESP32 i2c: sda: 4 scl: 16 scan: true id: bus_a # Example configuration entry ethernet: type: LAN8720 mdc_pin: GPIO23 mdio_pin: GPIO18 clk_mode: GPIO17_OUT phy_addr: 0 # Optional manual IP manual_ip: static_ip: 192.168.1.201 gateway: 192.168.1.1 subnet: 255.255.255.0 # Example configuration entry pcf8574: - id: 'pcf8574_hub_out_1' # for output channel 1-4 for DI9--DI12 address: 0x24 - id: 'pcf8574_hub_in_1' # for input channel 1-8 address: 0x22 # Individual outputs switch: - platform: gpio name: "a4s-light1" id: light1 pin: pcf8574: pcf8574_hub_out_1 number: 0 mode: OUTPUT inverted: true #inverted: false #on_turn_on: #- delay: 10000ms #- switch.turn_off: light1 - platform: gpio name: "a4s-light2" id: light2 pin: pcf8574: pcf8574_hub_out_1 number: 1 mode: OUTPUT inverted: true #inverted: false - platform: gpio name: "a4s-light3" id: light3 pin: pcf8574: pcf8574_hub_out_1 number: 2 mode: OUTPUT inverted: true #inverted: false - platform: gpio name: "a4s-light4" id: light4 pin: pcf8574: pcf8574_hub_out_1 number: 3 mode: OUTPUT inverted: true #inverted: false binary_sensor: - platform: gpio name: "a4s-input1" id: a4s_input1 pin: pcf8574: pcf8574_hub_in_1 number: 0 mode: INPUT inverted: true on_click: then: - if: condition: light.is_off: dimmer_1 then: light.turn_on: id: dimmer_1 brightness: 1.0 else: light.turn_off: dimmer_1 on_press: then: - if: condition: light.is_off: dimmer_1 then: - delay: 0.5s - while: condition: binary_sensor.is_on: a4s_input1 then: - light.dim_relative: id: dimmer_1 relative_brightness: 5% transition_length: 0.1s - delay: 0.1s else: - delay: 0.5s - while: condition: and: - binary_sensor.is_on: a4s_input1 - light.is_on: dimmer_1 then: - light.dim_relative: id: dimmer_1 relative_brightness: -5% transition_length: 0.1s - delay: 0.1s - platform: gpio name: "a4s-input2" id: a4s_input2 pin: pcf8574: pcf8574_hub_in_1 number: 1 mode: INPUT inverted: true - platform: gpio name: "a4s-input3" id: a4s_input3 pin: pcf8574: pcf8574_hub_in_1 number: 2 mode: INPUT inverted: true - platform: gpio name: "a4s-input4" id: a4s_input4 pin: pcf8574: pcf8574_hub_in_1 number: 3 mode: INPUT inverted: true - platform: gpio name: "a4s-input5" id: a4s_input5 pin: pcf8574: pcf8574_hub_in_1 number: 4 mode: INPUT inverted: true - platform: gpio name: "a4s-input6" id: a4s_input6 pin: pcf8574: pcf8574_hub_in_1 number: 5 mode: INPUT inverted: true - platform: gpio name: "a4s-input7" id: a4s_input7 pin: pcf8574: pcf8574_hub_in_1 number: 6 mode: INPUT inverted: true - platform: gpio name: "a4s-input8" id: a4s_input8 pin: pcf8574: pcf8574_hub_in_1 number: 7 mode: INPUT inverted: true - platform: gpio name: "a4s-input9" id: a4s_input9 pin: pcf8574: pcf8574_hub_out_1 number: 4 mode: INPUT inverted: true on_press: then: - switch.toggle: light1 #- switch.turn_on: light1 #on_release: #then: #- switch.turn_off: light1 - platform: gpio name: "a4s-input10" id: a4s_input10 pin: pcf8574: pcf8574_hub_out_1 number: 5 mode: INPUT inverted: true on_press: then: - switch.toggle: light2 #- switch.turn_on: light2 #on_release: #then: #- switch.turn_off: light2 - platform: gpio name: "a4s-input11" id: a4s_input11 pin: pcf8574: pcf8574_hub_out_1 number: 6 mode: INPUT inverted: true on_press: then: - switch.toggle: light3 #- switch.turn_on: light4 #on_release: #then: #- switch.turn_off: light4 - platform: gpio name: "a4s-input12" id: a4s_input12 pin: pcf8574: pcf8574_hub_out_1 number: 7 mode: INPUT inverted: true on_press: then: - switch.toggle: light4 #- switch.turn_on: light4 #on_release: #then: #- switch.turn_off: light4 pca9685: id: 'pca9685_hub' frequency: 500 output: - platform: pca9685 pca9685_id: 'pca9685_hub' id: "PWM0" channel: 0 - platform: pca9685 pca9685_id: 'pca9685_hub' id: "PWM1" channel: 1 - platform: pca9685 pca9685_id: 'pca9685_hub' id: "PWM2" channel: 2 - platform: pca9685 pca9685_id: 'pca9685_hub' id: "PWM3" channel: 3 - platform: pca9685 pca9685_id: 'pca9685_hub' id: "PWM4" channel: 4 - platform: pca9685 pca9685_id: 'pca9685_hub' id: "PWM5" channel: 5 - platform: pca9685 pca9685_id: 'pca9685_hub' id: "PWM6" channel: 6 - platform: pca9685 pca9685_id: 'pca9685_hub' id: "PWM7" channel: 7 light: - platform: monochromatic name: "a4s-Color-LED-1" output: PWM0 id: dimmer_1 - platform: monochromatic name: "a4s-Color-LED-2" id: dimmer_2 output: PWM1 - platform: monochromatic name: "a4s-Color-LED-3" id: dimmer_3 output: PWM2 - platform: monochromatic name: "a4s-Color-LED-4" id: dimmer_4 output: PWM3 - platform: monochromatic name: "a4s-Color-LED-5" id: dimmer_5 output: PWM4 - platform: monochromatic name: "a4s-Color-LED-6" id: dimmer_6 output: PWM5 - platform: monochromatic name: "a4s-Color-LED-7" id: dimmer_7 output: PWM6 - platform: monochromatic name: "a4s-Color-LED-8" id: dimmer_8 output: PWM7