esphome: name: kc868-a16-1 platform: ESP32 board: esp32dev #################################### logger: #################################### api: password: !secret api_password #################################### ota: password: !secret ota_password #################################### 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.26 gateway: 192.168.1.1 subnet: 255.255.255.0 #################################### esp32_ble_tracker: #################################### time: - platform: homeassistant id: homeassistant_time #################################### i2c: sda: 4 scl: 5 scan: true id: bus_a pcf8574: - id: 'pcf8574_hub_out_1' # for output channel 1-8 address: 0x24 - id: 'pcf8574_hub_out_2' # for output channel 9-16 address: 0x25 - id: 'pcf8574_hub_in_1' # for input channel 1-8 address: 0x21 - id: 'pcf8574_hub_in_2' # for input channel 9-16 address: 0x22 #################################### binary_sensor: #......................... Input 1 - platform: gpio pin: pcf8574: pcf8574_hub_in_1 number: 0 mode: INPUT inverted: true filters: - delayed_on: 50ms - delayed_off: 50ms name: Input 1 id: input_1 # icon: mdi:ceiling-light # on_press: # then: # - switch.toggle: relay_1 #......................... Input 2 - platform: gpio pin: pcf8574: pcf8574_hub_in_1 number: 1 mode: INPUT inverted: true filters: - delayed_on: 50ms - delayed_off: 50ms name: Input 2 id: input_2 # icon: mdi:ceiling-light # on_press: # then: # - switch.toggle: relay_2 #......................... Input 3 - platform: gpio pin: pcf8574: pcf8574_hub_in_1 number: 2 mode: INPUT inverted: true filters: - delayed_on: 50ms - delayed_off: 50ms name: Input 3 id: input_3 # icon: mdi:ceiling-light # on_press: # then: # - switch.toggle: relay_3 #......................... Input 4 - platform: gpio pin: pcf8574: pcf8574_hub_in_1 number: 3 mode: INPUT inverted: true filters: - delayed_on: 50ms - delayed_off: 50ms name: Input 4 id: input_4 # icon: mdi:ceiling-light # on_press: # then: # - switch.toggle: relay_4 #......................... Input 5 - platform: gpio pin: pcf8574: pcf8574_hub_in_1 number: 4 mode: INPUT inverted: true filters: - delayed_on: 50ms - delayed_off: 50ms name: Input 5 id: input_5 # icon: mdi:ceiling-light # on_press: # then: # - switch.toggle: relay_5 #......................... Input 6 - platform: gpio pin: pcf8574: pcf8574_hub_in_1 number: 5 mode: INPUT inverted: true filters: - delayed_on: 50ms - delayed_off: 50ms name: Input 6 id: input_6 # icon: mdi:ceiling-light # on_press: # then: # - switch.toggle: relay_6 #......................... Input 7 - platform: gpio pin: pcf8574: pcf8574_hub_in_1 number: 6 mode: INPUT inverted: true filters: - delayed_on: 50ms - delayed_off: 50ms name: Input 7 id: input_7 # icon: mdi:ceiling-light # on_press: # then: # - switch.toggle: relay_7 #......................... Input 8 - platform: gpio pin: pcf8574: pcf8574_hub_in_1 number: 7 mode: INPUT inverted: true filters: - delayed_on: 50ms - delayed_off: 50ms name: Input 8 id: input_8 # icon: mdi:ceiling-light # on_press: # then: # - switch.toggle: relay_8 #......................... Input 9 - platform: gpio pin: pcf8574: pcf8574_hub_in_2 number: 0 mode: INPUT inverted: true filters: - delayed_on: 50ms - delayed_off: 50ms name: Input 9 id: input_9 # icon: mdi:ceiling-light # on_press: # then: # - switch.toggle: relay_9 #......................... Input 10 - platform: gpio pin: pcf8574: pcf8574_hub_in_2 number: 1 mode: INPUT inverted: true filters: - delayed_on: 50ms - delayed_off: 50ms name: Input 10 id: input_10 # icon: mdi:ceiling-light # on_press: # then: # - switch.toggle: relay_10 #......................... Input 11 - platform: gpio pin: pcf8574: pcf8574_hub_in_2 number: 2 mode: INPUT inverted: true filters: - delayed_on: 50ms - delayed_off: 50ms name: Input 11 id: input_11 # icon: mdi:ceiling-light # on_press: # then: # - switch.toggle: relay_11 #......................... Input 12 - platform: gpio pin: pcf8574: pcf8574_hub_in_2 number: 3 mode: INPUT inverted: true filters: - delayed_on: 50ms - delayed_off: 50ms name: Input 12 id: input_12 # icon: mdi:ceiling-light # on_press: # then: # - switch.toggle: relay_12 #......................... Input 13 - platform: gpio pin: pcf8574: pcf8574_hub_in_2 number: 4 mode: INPUT inverted: true filters: - delayed_on: 50ms - delayed_off: 50ms name: Input 13 id: input_13 # icon: mdi:ceiling-light # on_press: # then: # - switch.toggle: relay_13 #......................... Input 14 - platform: gpio pin: pcf8574: pcf8574_hub_in_2 number: 5 mode: INPUT inverted: true filters: - delayed_on: 50ms - delayed_off: 50ms name: Input 14 id: input_14 # icon: mdi:ceiling-light # on_press: # then: # - switch.toggle: relay_14 #......................... Input 15 - platform: gpio pin: pcf8574: pcf8574_hub_in_2 number: 6 mode: INPUT inverted: true filters: - delayed_on: 50ms - delayed_off: 50ms name: Input 15 id: input_15 # icon: mdi:ceiling-light # on_press: # then: # - switch.toggle: relay_15 #......................... Input 16 - platform: gpio pin: pcf8574: pcf8574_hub_in_2 number: 7 mode: INPUT inverted: true filters: - delayed_on: 50ms - delayed_off: 50ms name: Input 16 id: input_16 # icon: mdi:ceiling-light # on_press: # then: # - switch.toggle: relay_16 #################################### switch: #......................... Relay 1 - platform: gpio name: "output1" id: relay_1 # icon: mdi:ceiling-light restore_mode: ALWAYS_OFF pin: pcf8574: pcf8574_hub_out_1 number: 0 mode: OUTPUT inverted: true #......................... Relay 2 - platform: gpio name: "output2" id: relay_2 # icon: mdi:ceiling-light restore_mode: ALWAYS_OFF pin: pcf8574: pcf8574_hub_out_1 number: 1 mode: OUTPUT inverted: true #......................... Relay 3 - platform: gpio name: "output3" id: relay_3 # icon: mdi:ceiling-light restore_mode: ALWAYS_OFF pin: pcf8574: pcf8574_hub_out_1 number: 2 mode: OUTPUT inverted: true #......................... Relay 4 - platform: gpio name: "output4" id: relay_4 # icon: mdi:ceiling-light restore_mode: ALWAYS_OFF pin: pcf8574: pcf8574_hub_out_1 number: 3 mode: OUTPUT inverted: true #......................... Relay 5 - platform: gpio name: "output5" id: relay_5 # icon: mdi:ceiling-light restore_mode: ALWAYS_OFF pin: pcf8574: pcf8574_hub_out_1 number: 4 mode: OUTPUT inverted: true #......................... Relay 6 - platform: gpio name: "output6" id: relay_6 # icon: mdi:ceiling-light restore_mode: ALWAYS_OFF pin: pcf8574: pcf8574_hub_out_1 number: 5 mode: OUTPUT inverted: true #......................... Relay 7 - platform: gpio name: "output7" id: relay_7 # icon: mdi:ceiling-light restore_mode: ALWAYS_OFF pin: pcf8574: pcf8574_hub_out_1 number: 6 mode: OUTPUT inverted: true #......................... Relay 8 - platform: gpio name: "output8" id: relay_8 # icon: mdi:ceiling-light restore_mode: ALWAYS_OFF pin: pcf8574: pcf8574_hub_out_1 number: 7 mode: OUTPUT inverted: true #......................... Relay 9 - platform: gpio name: "output9" id: relay_9 # icon: mdi:ceiling-light restore_mode: ALWAYS_OFF pin: pcf8574: pcf8574_hub_out_2 number: 0 mode: OUTPUT inverted: true #......................... Relay 10 - platform: gpio name: "output10" id: relay_10 # icon: mdi:ceiling-light restore_mode: ALWAYS_OFF pin: pcf8574: pcf8574_hub_out_2 number: 1 mode: OUTPUT inverted: true #......................... Relay 11 - platform: gpio name: "output11" id: relay_11 # icon: mdi:ceiling-light restore_mode: ALWAYS_OFF pin: pcf8574: pcf8574_hub_out_2 number: 2 mode: OUTPUT inverted: true #......................... Relay 12 - platform: gpio name: "output12" id: relay_12 # icon: mdi:ceiling-light restore_mode: ALWAYS_OFF pin: pcf8574: pcf8574_hub_out_2 number: 3 mode: OUTPUT inverted: true #......................... Relay 13 - platform: gpio name: "output13" id: relay_13 # icon: mdi:ceiling-light restore_mode: ALWAYS_OFF pin: pcf8574: pcf8574_hub_out_2 number: 4 mode: OUTPUT inverted: true #......................... Relay 14 - platform: gpio name: "output14" id: relay_14 # icon: mdi:ceiling-light restore_mode: ALWAYS_OFF pin: pcf8574: pcf8574_hub_out_2 number: 5 mode: OUTPUT inverted: true #......................... Relay 15 - platform: gpio name: "output15" id: relay_15 # icon: mdi:ceiling-light restore_mode: ALWAYS_OFF pin: pcf8574: pcf8574_hub_out_2 number: 6 mode: OUTPUT inverted: true #......................... Relay 16 - platform: gpio name: "output16" id: relay_16 # icon: mdi:ceiling-light restore_mode: ALWAYS_OFF pin: pcf8574: pcf8574_hub_out_2 number: 7 mode: OUTPUT inverted: true #################################### cover: #################################### light: #################################### button: #################################### sensor: # Online - platform: uptime name: Uptime kc868-a16-1 id: uptime_sensor update_interval: 60s on_raw_value: then: - text_sensor.template.publish: id: uptime_human state: !lambda |- int seconds = round(id(uptime_sensor).raw_state); int days = seconds / (24 * 3600); seconds = seconds % (24 * 3600); int hours = seconds / 3600; seconds = seconds % 3600; int minutes = seconds / 60; seconds = seconds % 60; return ( (days ? to_string(days) + "d " : "") + (hours ? to_string(hours) + "h " : "") + (minutes ? to_string(minutes) + "m " : "") + (to_string(seconds) + "s") ).c_str(); #################################### text_sensor: - platform: template name: Uptime kc868-a16-1 # Human Readable id: uptime_human icon: mdi:clock-start #################################### remote_receiver: pin: 2 dump: - rc_switch tolerance: 50% filter: 250us idle: 4ms buffer_size: 2kb remote_transmitter: # pin: GPIO15 pin: 15 # RF uses a 100% carrier signal carrier_duty_percent: 100% ####################################