Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
KC868-AP
#26
(05-08-2023, 12:49 AM)admin Wrote: this is config file for digital input1 with button control KC868-AP output1:
click for ON/OFF LED, hold on for change brightness.




esphome:
  name: ap

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "hx8eSqbwjWs9/2bK0qK55QfTIOpI4gCfzLOeaOXZMaU="

# Example configuration entry
ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0

 

# Example configuration entry for ESP32
i2c:
  sda: 4
  scl: 16
  scan: true
  id: bus_a

pcf8574:
  - id: 'pcf8574_hub_in_1'  # for input channel 1-8    maybe 0x22  /  0x3A
    address: 0x22

  - id: 'pcf8574_hub_in_2'  # for input channel 9-16
    address: 0x21

binary_sensor:
  - platform: gpio
    name: "ap-input1"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 0
      mode: INPUT
      inverted: true
    id: light_1_touch
    on_click:
      then:
        - if:
            condition:
              light.is_off: light_1
            then:
              light.turn_on:
                id: light_1
                brightness: 1.0
            else:
              light.turn_off: light_1
    on_press:
      then:
      - if:
          condition:
            light.is_off: light_1
          then:
          - delay: 0.5s
          - while:
              condition:
                binary_sensor.is_on: light_1_touch
              then:
                - light.dim_relative:
                    id: light_1
                    relative_brightness: 5%
                    transition_length: 0.1s
                - delay: 0.1s
          else:
          - delay: 0.5s
          - while:
              condition:
                and:
                  - binary_sensor.is_on: light_1_touch
                  - light.is_on: light_1
              then:
                - light.dim_relative:
                    id: light_1
                    relative_brightness: -5%
                    transition_length: 0.1s
                - delay: 0.1s



  - platform: gpio
    name: "ap-input2"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 1
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "ap-input3"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 2
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "ap-input4"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 3
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "ap-input5"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 4
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "ap-input6"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 5
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "ap-input7"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 6
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "ap-input8"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 7
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "ap-input9"
    pin:
      pcf8574: pcf8574_hub_in_2
      number: 0
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "ap-input10"
    pin:
      pcf8574: pcf8574_hub_in_2
      number: 1
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "ap-input11"
    pin:
      pcf8574: pcf8574_hub_in_2
      number: 2
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "ap-input12"
    pin:
      pcf8574: pcf8574_hub_in_2
      number: 3
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "ap-input13"
    pin:
      pcf8574: pcf8574_hub_in_2
      number: 4
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "ap-input14"
    pin:
      pcf8574: pcf8574_hub_in_2
      number: 5
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "ap-input15"
    pin:
      pcf8574: pcf8574_hub_in_2
      number: 6
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "ap-input16"
    pin:
      pcf8574: pcf8574_hub_in_2
      number: 7
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "ap-input17"
    pin:
      number: 34
      inverted: true

  - platform: gpio
    name: "ap-input18"
    pin:
      number: 35
      inverted: true

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

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM8"
    channel: 8

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM9"
    channel: 9

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM10"
    channel: 10

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM11"
    channel: 11

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM12"
    channel: 12

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM13"
    channel: 13

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM14"
    channel: 14

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM15"
    channel: 15


light:
  - platform: monochromatic
    name: "Color-LED-1"
    id: light_1
    output: PWM0
  - platform: monochromatic
    name: "Color-LED-2"
    output: PWM1
  - platform: monochromatic
    name: "Color-LED-3"
    output: PWM2
  - platform: monochromatic
    name: "Color-LED-4"
    output: PWM3
  - platform: monochromatic
    name: "Color-LED-5"
    output: PWM4
  - platform: monochromatic
    name: "Color-LED-6"
    output: PWM5
  - platform: monochromatic
    name: "Color-LED-7"
    output: PWM6
  - platform: monochromatic
    name: "Color-LED-8"
    output: PWM7
  - platform: monochromatic
    name: "Color-LED-9"
    output: PWM8
  - platform: monochromatic
    name: "Color-LED-10"
    output: PWM9
  - platform: monochromatic
    name: "Color-LED-11"
    output: PWM10
  - platform: monochromatic
    name: "Color-LED-12"
    output: PWM11
  - platform: monochromatic
    name: "Color-LED-13"
    output: PWM12
  - platform: monochromatic
    name: "Color-LED-14"
    output: PWM13
  - platform: monochromatic
    name: "Color-LED-15"
    output: PWM14
  - platform: monochromatic
    name: "Color-LED-16"
    output: PWM15

  - platform: rgbw
    name: "ap-rgbw"
    red: PWM1
    green: PWM2
    blue: PWM3
    white: PWM4


switch:
  - platform: gpio
    name: "ap-light1"
    pin: 13
    inverted: false

  - platform: gpio
    name: "ap-light2"
    pin: 2
    inverted: false

Maybe you can make it save the lighting settings when I turn off the light, because now it lights up at 100% even though it was at 50%?
Reply


Messages In This Thread
KC868-AP - by eligijus - 03-05-2023, 07:23 PM
RE: KC868-AP - by admin - 03-06-2023, 12:07 AM
RE: KC868-AP - by eligijus - 03-06-2023, 04:12 PM
RE: KC868-AP - by admin - 03-06-2023, 10:44 PM
RE: KC868-AP - by eligijus - 04-17-2023, 03:27 PM
RE: KC868-AP - by admin - 04-18-2023, 06:29 AM
RE: KC868-AP - by eligijus - 04-18-2023, 01:19 PM
RE: KC868-AP - by admin - 04-18-2023, 10:51 PM
RE: KC868-AP - by eligijus - 04-24-2023, 03:58 PM
RE: KC868-AP - by admin - 04-25-2023, 12:40 AM
RE: KC868-AP - by eligijus - 04-27-2023, 06:10 AM
RE: KC868-AP - by admin - 04-27-2023, 08:32 AM
RE: KC868-AP - by eligijus - 04-28-2023, 06:19 AM
RE: KC868-AP - by admin - 04-29-2023, 02:41 AM
RE: KC868-AP - by eligijus - 04-30-2023, 03:33 PM
RE: KC868-AP - by admin - 05-01-2023, 12:36 AM
RE: KC868-AP - by eligijus - 05-01-2023, 08:17 PM
RE: KC868-AP - by admin - 05-01-2023, 11:44 PM
RE: KC868-AP - by eligijus - 05-06-2023, 06:52 PM
RE: KC868-AP - by admin - 05-07-2023, 04:21 AM
RE: KC868-AP - by admin - 05-07-2023, 04:33 AM
RE: KC868-AP - by eligijus - 05-07-2023, 05:50 AM
RE: KC868-AIO - by OloffSmyth - 05-07-2023, 09:04 AM
RE: KC868-AP - by admin - 05-07-2023, 09:53 AM
RE: KC868-AP - by OloffSmyth - 06-25-2023, 09:10 AM
RE: KC868-AP - by admin - 05-08-2023, 12:49 AM
RE: KC868-AP - by eligijus - 05-08-2023, 05:53 PM
RE: KC868-AP - by admin - 05-09-2023, 12:51 AM
RE: KC868-AP - by eligijus - 05-10-2023, 10:51 AM
RE: KC868-AP - by admin - 05-10-2023, 10:58 AM
RE: KC868-AP - by eligijus - 05-10-2023, 11:11 AM
RE: KC868-AP - by admin - 05-10-2023, 12:04 PM
RE: KC868-AP - by eligijus - 05-10-2023, 12:19 PM
RE: KC868-AP - by admin - 05-10-2023, 12:24 PM
RE: KC868-AP - by admin - 06-25-2023, 11:07 AM

Forum Jump:


Users browsing this thread:
1 Guest(s)