Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lesson27- KC868-A8 integrate home assistant by ESPHome demo and http command
#1


ESPHome configure for KC868-A8:

function list:
1. 8 relay output
2. 8 switch input trigger relay output by on_press action
3. monitor 2 channel analog input for DC
4. TEMP-1 port: 2 channel DS18B20 temperature sensor use by 1 ports, actually, you can connect multi DS18B20 by one wire.
5. TEMP-4 port: WS2812B LED strip for 1 meter (30 LEDs)
6. network by Ethernet cable

   
-----------------------------------------------------------------------------------------------------

esphome:
  name: kc868-a8
  platform: ESP32
  board: esp32dev

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "bfb55afbf347b27a4bda0a1d36ee994f"

web_server:
  port: 80


# 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

  # Optional manual IP
  manual_ip:
    static_ip: 192.168.1.199
    gateway: 192.168.1.1
    subnet: 255.255.255.0


# Example configuration entry
pcf8574:
  - id: 'pcf8574_hub_output'
    address: 0x24
   
  - id: 'pcf8574_hub_input'
    address: 0x22


# Individual outputs
switch:
  - platform: gpio
    name: "switch1"
    id: switch1
    pin:
      pcf8574: pcf8574_hub_output
      # Use pin number 0
      number: 0
      # One of INPUT or OUTPUT
      mode: OUTPUT
      inverted: true
 
  - platform: gpio
    name: "switch2"
    id: switch2
    pin:
      pcf8574: pcf8574_hub_output
      # Use pin number 0
      number: 1
      # One of INPUT or OUTPUT
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "switch3"
    id: switch3
    pin:
      pcf8574: pcf8574_hub_output
      # Use pin number 0
      number: 2
      # One of INPUT or OUTPUT
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "switch4"
    id: switch4
    pin:
      pcf8574: pcf8574_hub_output
      # Use pin number 0
      number: 3
      # One of INPUT or OUTPUT
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "switch5"
    id: switch5
    pin:
      pcf8574: pcf8574_hub_output
      # Use pin number 0
      number: 4
      # One of INPUT or OUTPUT
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "switch6"
    id: switch6
    pin:
      pcf8574: pcf8574_hub_output
      # Use pin number 0
      number: 5
      # One of INPUT or OUTPUT
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "switch7"
    id: switch7
    pin:
      pcf8574: pcf8574_hub_output
      # Use pin number 0
      number: 6
      # One of INPUT or OUTPUT
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "switch8"
    id: switch8
    pin:
      pcf8574: pcf8574_hub_output
      # Use pin number 0
      number: 7
      # One of INPUT or OUTPUT
      mode: OUTPUT
      inverted: true
     
binary_sensor:     
  - platform: gpio
    name: "input1"
    pin:
      pcf8574: pcf8574_hub_input
      # Use pin number 0
      number: 0
      # One of INPUT or OUTPUT
      mode: INPUT
      inverted: false
    on_press:
      then:
        - switch.toggle: switch1
       
  - platform: gpio
    name: "input2"
    pin:
      pcf8574: pcf8574_hub_input
      # Use pin number 0
      number: 1
      # One of INPUT or OUTPUT
      mode: INPUT
      inverted: false
    on_press:
      then:
        - switch.toggle: switch2
       
  - platform: gpio
    name: "input3"
    pin:
      pcf8574: pcf8574_hub_input
      # Use pin number 0
      number: 2
      # One of INPUT or OUTPUT
      mode: INPUT
      inverted: false
    on_press:
      then:
        - switch.toggle: switch3
       
  - platform: gpio
    name: "input4"
    pin:
      pcf8574: pcf8574_hub_input
      # Use pin number 0
      number: 3
      # One of INPUT or OUTPUT
      mode: INPUT
      inverted: false
    on_press:
      then:
        - switch.toggle: switch4
       
  - platform: gpio
    name: "input5"
    pin:
      pcf8574: pcf8574_hub_input
      # Use pin number 0
      number: 4
      # One of INPUT or OUTPUT
      mode: INPUT
      inverted: false
    on_press:
      then:
        - switch.toggle: switch5
       
  - platform: gpio
    name: "input6"
    pin:
      pcf8574: pcf8574_hub_input
      # Use pin number 0
      number: 5
      # One of INPUT or OUTPUT
      mode: INPUT
      inverted: false
    on_press:
      then:
        - switch.toggle: switch6
       
  - platform: gpio
    name: "input7"
    pin:
      pcf8574: pcf8574_hub_input
      # Use pin number 0
      number: 6
      # One of INPUT or OUTPUT
      mode: INPUT
      inverted: false
    on_press:
      then:
        - switch.toggle: switch7
       
  - platform: gpio
    name: "input8"
    pin:
      pcf8574: pcf8574_hub_input
      # Use pin number 0
      number: 7
      # One of INPUT or OUTPUT
      mode: INPUT
      inverted: false
    on_press:
      then:
        - switch.toggle: switch8
       
       
# Example configuration entry
dallas:
  - pin: GPIO14
    update_interval: 5s
sensor:
  - platform: dallas
    address: 0xE701202C5ADED628
    name: "Temperature_1"
    id: Temperature_1
   
  - platform: dallas
    address: 0xBE012115DCBEBC28
    name: "Temperature_2"
    id: Temperature_2
   
  - platform: adc
    pin: GPIO34
    name: "Analog-IN1"
    update_interval: 5s
    attenuation: 11db

  - platform: adc
    pin: GPIO35
    name: "Analog-IN2"
    update_interval: 5s
    attenuation: 11db
   

light:
  - platform: fastled_clockless
    chipset: WS2812B
    pin: GPIO33    # Pin Define connected with LED strip
    num_leds: 150  #LEDs number
    rgb_order: GRB
    name: "light_strip"
    effects:
      - addressable_rainbow:        ##defined 7 effects styles
      - addressable_color_wipe:
      - addressable_scan:
      - addressable_twinkle:
      - addressable_random_twinkle:
      - addressable_fireworks:
      - addressable_flicker:

-------------------------------------------------------------------------------
KC868-A8/A4 http command list for third party software integration:

read relay state:
http://192.168.1.199/switch/switch1

control relay:
http://192.168.1.199/switch/switch1/turn_on
http://192.168.1.199/switch/switch1/turn_off
http://192.168.1.199/switch/switch1/toggle

read DI state:
http://192.168.1.199/binary_sensor/input1

read temperature:
http://192.168.1.199/sensor/temperature_1

read analog input:
http://192.168.1.199/sensor/analog-in1

read LED strip:
http://192.168.1.199/light/light_strip

control LED strip:
http://192.168.1.199/light/light_strip/turn_on
http://192.168.1.199/light/light_strip/turn_off
http://192.168.1.199/light/light_strip/turn_toggle

debug send command for TEST example: curl -X POST http://192.168.1.199/switch/switch1/toggle
Reply
#2
OLA, PODERIA ME PASSAR O ESQUEMA DE LIGAÇÃO DA FITA DE LED?
Reply
#3
VCC,DATA,GND, only 3 wires.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)