<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[Smart Home Automation Forum - F24]]></title>
		<link>https://www.kincony.com/forum/</link>
		<description><![CDATA[Smart Home Automation Forum - https://www.kincony.com/forum]]></description>
		<pubDate>Wed, 20 May 2026 16:37:13 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[F24 Smart Controller Wiring Examples]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=9269</link>
			<pubDate>Sun, 19 Apr 2026 15:50:44 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=9269</guid>
			<description><![CDATA[<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=9651" target="_blank" title="">F24_wiring.jpg</a> (Size: 216.7 KB / Downloads: 59)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=9651" target="_blank" title="">F24_wiring.jpg</a> (Size: 216.7 KB / Downloads: 59)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[F24 Smart Controller ESP32 system block diagram]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=9268</link>
			<pubDate>Sun, 19 Apr 2026 15:50:12 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=9268</guid>
			<description><![CDATA[<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=9650" target="_blank" title="">KinCony-F24-smart-controller-diagram.png</a> (Size: 1.01 MB / Downloads: 54)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=9650" target="_blank" title="">KinCony-F24-smart-controller-diagram.png</a> (Size: 1.01 MB / Downloads: 54)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Can the usb-c port be used to power another device?]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8792</link>
			<pubDate>Sat, 06 Dec 2025 17:28:42 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=9945">bernieke</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=8792</guid>
			<description><![CDATA[I was thinking of powering a small switch which draws 0.6A at 5V from the usb-c port on a F24, is this possible?]]></description>
			<content:encoded><![CDATA[I was thinking of powering a small switch which draws 0.6A at 5V from the usb-c port on a F24, is this possible?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Recommended way to integrate into home assistant]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8772</link>
			<pubDate>Wed, 26 Nov 2025 16:25:30 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=9945">bernieke</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=8772</guid>
			<description><![CDATA[Hi,<br />
<br />
Can you tell which is the recommended way to integrate with home assistant OS running on a raspberry pi 5? I'm looking for the most reliable method with a latency of less than 200ms to activate a relay.<br />
* kcs firmware with mqtt over wifi<br />
* esphome firmware with esphome over wifi<br />
* usb (is this supported on home assistant OS?)<br />
* bluetooth (is this supported as a client, and is it supported on home assistant OS?)<br />
* ...?<br />
<br />
Thank you,<br />
Bernard]]></description>
			<content:encoded><![CDATA[Hi,<br />
<br />
Can you tell which is the recommended way to integrate with home assistant OS running on a raspberry pi 5? I'm looking for the most reliable method with a latency of less than 200ms to activate a relay.<br />
* kcs firmware with mqtt over wifi<br />
* esphome firmware with esphome over wifi<br />
* usb (is this supported on home assistant OS?)<br />
* bluetooth (is this supported as a client, and is it supported on home assistant OS?)<br />
* ...?<br />
<br />
Thank you,<br />
Bernard]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[adding HAv2 into Discoverable MQTT for homeassistant]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8729</link>
			<pubDate>Fri, 07 Nov 2025 18:12:17 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=9459">swisstmack25</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=8729</guid>
			<description><![CDATA[I would like to use the discoverable entity for homeassistant , is it possible that the 485 interface HAv2 can also be adopted this way into home assistant?]]></description>
			<content:encoded><![CDATA[I would like to use the discoverable entity for homeassistant , is it possible that the 485 interface HAv2 can also be adopted this way into home assistant?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[F24 work with HAv2 with tuya app ESPHome yaml]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8651</link>
			<pubDate>Tue, 14 Oct 2025 08:19:37 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=8651</guid>
			<description><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>esphome:<br />
  name: f24<br />
  friendly_name: f24<br />
  platformio_options:<br />
    board_build.extra_flags:<br />
      # WIFI_CONTROL_SELF_MODE = 0<br />
      # WIFI_CONTROL_SELF_MODE = 1<br />
      - "-DWIFI_CONTROL_SELF_MODE=1"<br />
esp32:<br />
  board: esp32-s3-devkitc-1<br />
  framework:<br />
    type: arduino<br />
    <br />
<br />
external_components:<br />
  - source:<br />
      type: git<br />
      url: https://github.com/hzkincony/esphome-tuya-wifi-mcu<br />
      ref: v1.3.0<br />
<br />
  - source:<br />
      type: git<br />
      url: https://github.com/hzkincony/esphome-kc868-ha<br />
      ref: v3.0.2<br />
<br />
# Enable logging<br />
<br />
  # hardware_uart: USB_SERIAL_JTAG<br />
# Enable Home Assistant API<br />
api:<br />
  encryption:<br />
    key: "WeVOuL5oNhjXcfzXtTirlOwvtWvCD5yqIxd3oV4es1k="<br />
<br />
ethernet:<br />
  type: W5500<br />
  clk_pin: GPIO42<br />
  mosi_pin: GPIO43<br />
  miso_pin: GPIO44<br />
  cs_pin: GPIO41<br />
  interrupt_pin: GPIO2<br />
  reset_pin: GPIO1<br />
<br />
i2c:<br />
   - id: bus_a<br />
     sda: 8<br />
     scl: 18<br />
     scan: true<br />
     frequency: 400kHz<br />
<br />
pcf8574:<br />
  - id: 'pcf8574_hub_out_1'  # for output channel 9-24<br />
    i2c_id: bus_a<br />
    address: 0x25<br />
    pcf8575: true<br />
<br />
  - id: 'pcf8574_hub_in_1'  # for digital input channel 1-16<br />
    i2c_id: bus_a<br />
    address: 0x24<br />
    pcf8575: true<br />
<br />
  - id: 'pcf8574_hub_out_in_2'  # for output channel 1-8  + (input 17-24)<br />
    i2c_id: bus_a<br />
    address: 0x26<br />
    pcf8575: true<br />
<br />
uart:<br />
  - id: myuart1<br />
    tx_pin: 16<br />
    rx_pin: 17<br />
    baud_rate: 9600<br />
    debug:<br />
      direction: BOTH<br />
      dummy_receiver: false<br />
<br />
  - id: tuya_mcu_uart<br />
    tx_pin: GPIO39<br />
    rx_pin: GPIO38<br />
    baud_rate: 9600<br />
<br />
tuya_wifi_mcu:<br />
  # tuya mcu product id<br />
  product_id: cchos3g1j2ucfbyd<br />
  uart_id: tuya_mcu_uart<br />
  wifi_reset_pin: 28<br />
  wifi_led_pin: 16<br />
<br />
kc868_ha:<br />
  uart_id: myuart1<br />
<br />
switch:<br />
<br />
  - platform: gpio<br />
    name: "f24-output01"<br />
    id: "f24_output01"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 12<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output1-tuya<br />
    dp_id: 1<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output01"<br />
<br />
  - platform: gpio<br />
    name: "f24-output02"<br />
    id: "f24_output02"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 13<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output2-tuya<br />
    dp_id: 2<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output02"<br />
<br />
  - platform: gpio<br />
    name: "f24-output03"<br />
    id: "f24_output03"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 14<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output3-tuya<br />
    dp_id: 3<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output03"<br />
<br />
  - platform: gpio<br />
    name: "f24-output04"<br />
    id: "f24_output04"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 15<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output4-tuya<br />
    dp_id: 4<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output04"<br />
<br />
  - platform: gpio<br />
    name: "f24-output05"<br />
    id: "f24_output05"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 8<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output5-tuya<br />
    dp_id: 5<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output05"<br />
<br />
  - platform: gpio<br />
    name: "f24-output06"<br />
    id: "f24_output06"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 9<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output6-tuya<br />
    dp_id: 6<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output06"<br />
<br />
  - platform: gpio<br />
    name: "f24-output07"<br />
    id: "f24_output07"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 10<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output7-tuya<br />
    dp_id: 101<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output07"<br />
<br />
  - platform: gpio<br />
    name: "f24-output08"<br />
    id: "f24_output08"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 11<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output8-tuya<br />
    dp_id: 102<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output08"<br />
<br />
  - platform: gpio<br />
    name: "f24-output09"<br />
    id: "f24_output09"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 0<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output9-tuya<br />
    dp_id: 103<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output09"<br />
<br />
  - platform: gpio<br />
    name: "f24-output10"<br />
    id: "f24_output10"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 1<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output10-tuya<br />
    dp_id: 104<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output10"<br />
<br />
  - platform: gpio<br />
    name: "f24-output11"<br />
    id: "f24_output11"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 2<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output11-tuya<br />
    dp_id: 105<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output11"<br />
<br />
  - platform: gpio<br />
    name: "f24-output12"<br />
    id: "f24_output12"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 3<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output12-tuya<br />
    dp_id: 106<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output12"<br />
<br />
  - platform: gpio<br />
    name: "f24-output13"<br />
    id: "f24_output13"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 4<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output13-tuya<br />
    dp_id: 107<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output13"<br />
<br />
  - platform: gpio<br />
    name: "f24-output14"<br />
    id: "f24_output14"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 5<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output14-tuya<br />
    dp_id: 108<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output14"<br />
<br />
  - platform: gpio<br />
    name: "f24-output15"<br />
    id: "f24_output15"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 6<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output15-tuya<br />
    dp_id: 109<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output15"<br />
<br />
  - platform: gpio<br />
    name: "f24-output16"<br />
    id: "f24_output16"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 7<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output16-tuya<br />
    dp_id: 110<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output16"<br />
<br />
  - platform: gpio<br />
    name: "f24-output17"<br />
    id: "f24_output17"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 8<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output17-tuya<br />
    dp_id: 126<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output17"<br />
<br />
  - platform: gpio<br />
    name: "f24-output18"<br />
    id: "f24_output18"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 9<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output18-tuya<br />
    dp_id: 129<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output18"<br />
<br />
  - platform: gpio<br />
    name: "f24-output19"<br />
    id: "f24_output19"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 10<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output19-tuya<br />
    dp_id: 130<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output19"<br />
<br />
  - platform: gpio<br />
    name: "f24-output20"<br />
    id: "f24_output20"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 11<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output20-tuya<br />
    dp_id: 131<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output20"<br />
<br />
  - platform: gpio<br />
    name: "f24-output21"<br />
    id: "f24_output21"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 12<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output21-tuya<br />
    dp_id: 132<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output21"<br />
<br />
  - platform: gpio<br />
    name: "f24-output22"<br />
    id: "f24_output22"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 13<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output22-tuya<br />
    dp_id: 133<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output22"<br />
<br />
  - platform: gpio<br />
    name: "f24-output23"<br />
    id: "f24_output23"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 14<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output23-tuya<br />
    dp_id: 134<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output23"<br />
<br />
  - platform: gpio<br />
    name: "f24-output24"<br />
    id: "f24_output24"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 15<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output24-tuya<br />
    dp_id: 135<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output24"<br />
<br />
  # The switch is used to control the D1~D6 level output on the KC868 HA board<br />
  # bind_output is required. Corresponds to the BindOutput parameter in HA485_Ctrl software<br />
  # Other parameters refer to: https://esphome.io/components/switch/index.html<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 1<br />
    name: "switch 1"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 2<br />
    name: "switch 2"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 3<br />
    name: "switch 3"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 4<br />
    name: "switch 4"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 5<br />
    name: "switch 5"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 6<br />
    name: "switch 6"<br />
<br />
<br />
<br />
binary_sensor:<br />
  - platform: gpio<br />
    name: "f24-input01"<br />
    id: "f24_input01"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 0<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input1-tuya<br />
    dp_id: 111<br />
    bind_binary_sensor_id: f24_input01<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input02"<br />
    id: "f24_input02"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 1<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input2-tuya<br />
    dp_id: 112<br />
    bind_binary_sensor_id: f24_input02<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input03"<br />
    id: "f24_input03"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 2<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input3-tuya<br />
    dp_id: 113<br />
    bind_binary_sensor_id: f24_input03<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input04"<br />
    id: "f24_input04"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 3<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input4-tuya<br />
    dp_id: 114<br />
    bind_binary_sensor_id: f24_input04<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input05"<br />
    id: "f24_input05"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 4<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input5-tuya<br />
    dp_id: 115<br />
    bind_binary_sensor_id: f24_input05<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input06"<br />
    id: "f24_input06"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 5<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input6-tuya<br />
    dp_id: 116<br />
    bind_binary_sensor_id: f24_input06<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input07"<br />
    id: "f24_input07"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 6<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input7-tuya<br />
    dp_id: 117<br />
    bind_binary_sensor_id: f24_input07<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input08"<br />
    id: "f24_input08"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 7<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input8-tuya<br />
    dp_id: 118<br />
    bind_binary_sensor_id: f24_input08<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input09"<br />
    id: "f24_input09"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 8<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input9-tuya<br />
    dp_id: 119<br />
    bind_binary_sensor_id: f24_input09<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input10"<br />
    id: "f24_input10"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 9<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input10-tuya<br />
    dp_id: 120<br />
    bind_binary_sensor_id: f24_input10<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input11"<br />
    id: "f24_input11"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 10<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input11-tuya<br />
    dp_id: 121<br />
    bind_binary_sensor_id: f24_input11<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input12"<br />
    id: "f24_input12"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 11<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input12-tuya<br />
    dp_id: 122<br />
    bind_binary_sensor_id: f24_input12<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input13"<br />
    id: "f24_input13"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 12<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input13-tuya<br />
    dp_id: 123<br />
    bind_binary_sensor_id: f24_input13<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input14"<br />
    id: "f24_input14"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 13<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input14-tuya<br />
    dp_id: 124<br />
    bind_binary_sensor_id: f24_input14<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input15"<br />
    id: "f24_input15"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 14<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input15-tuya<br />
    dp_id: 125<br />
    bind_binary_sensor_id: f24_input15<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input16"<br />
    id: "f24_input16"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 15<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input17"<br />
    id: "f24_input17"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 0<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input18"<br />
    id: "f24_input18"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 1<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input19"<br />
    id: "f24_input19"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 2<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input20"<br />
    id: "f24_input20"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 3<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input21"<br />
    id: "f24_input21"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 4<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input22"<br />
    id: "f24_input22"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 5<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input23"<br />
    id: "f24_input23"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 6<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input24"<br />
    id: "f24_input24"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 7<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
##pull-up resistance on PCB<br />
  - platform: gpio<br />
    name: "f24-W1-io48"<br />
    pin: <br />
      number: 48<br />
      inverted: true<br />
<br />
  - platform: gpio<br />
    name: "f24-W1-io47"<br />
    pin: <br />
      number: 47<br />
      inverted: true<br />
<br />
  - platform: gpio<br />
    name: "f24-W1-io21"<br />
    pin: <br />
      number: 21<br />
      inverted: true<br />
<br />
  - platform: gpio<br />
    name: "f24-W1-io15"<br />
    pin: <br />
      number: 15<br />
      inverted: true<br />
## without resistance on PCB<br />
  - platform: gpio<br />
    name: "f24-W1-io13"<br />
    pin: <br />
      number: 13<br />
      inverted: false<br />
<br />
  - platform: gpio<br />
    name: "f24-W1-io14"<br />
    pin: <br />
      number: 14<br />
      inverted:  false<br />
<br />
  - platform: gpio<br />
    name: "f24-433M"<br />
    pin: <br />
      number: 40<br />
      inverted:  false<br />
<br />
  # The binary_sensor corresponds to the state changes generated by K1~K6 on the KC868 HA board<br />
  # bind_output is required. Corresponds to the BindOutput parameter in HA485_Ctrl software<br />
  # Other parameters refer to: https://esphome.io/components/binary_sensor/index.html<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1 # Default value is 1, corresponds to the Target Relay Controller Addr parameter in HA485_Ctrl software<br />
    switch_adapter_addr: 10 # Default value is 10, corresponds to the Switch Adapter Addr parameter in HA485_Ctrl software<br />
    bind_output: 1 # Corresponds to the BindOutput parameter in HA485_Ctrl software<br />
    name: "binary_sensor 1"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 2<br />
    name: "binary_sensor 2"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 3<br />
    name: "binary_sensor 3"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 4<br />
    name: "binary_sensor 4"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 5<br />
    name: "binary_sensor 5"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 6<br />
    name: "binary_sensor 6"<br />
<br />
sensor:<br />
  - platform: adc<br />
    pin: 5<br />
    name: "f24 A1 Voltage"<br />
    update_interval: 5s<br />
    attenuation: 11db<br />
    filters:<br />
      - lambda:<br />
          if (x &gt;= 3.11) {<br />
            return x * 1.60256;<br />
          } else if (x &lt;= 0.15) {<br />
            return 0;<br />
          } else {<br />
            return x * 1.51;<br />
          }<br />
  - platform: adc<br />
    pin: 7<br />
    name: "f24 A2 Voltage"<br />
    update_interval: 5s<br />
    attenuation: 11db<br />
    filters:<br />
      # - multiply: 1.51515<br />
      - lambda:<br />
          if (x &gt;= 3.11) {<br />
            return x * 1.60256;<br />
          } else if (x &lt;= 0.15) {<br />
            return 0;<br />
          } else {<br />
            return x * 1.51;<br />
          }<br />
  - platform: adc<br />
    pin: 6<br />
    name: "f24 A3 Current"<br />
    update_interval: 5s<br />
    unit_of_measurement: mA<br />
    attenuation: 11db<br />
    filters:<br />
      - multiply: 6.66666666<br />
  - platform: adc<br />
    pin: 4<br />
    name: "f24 A4 Current"<br />
    update_interval: 5s<br />
    unit_of_measurement: mA<br />
    attenuation: 11db<br />
    filters:<br />
      - multiply: 6.66666666<br />
<br />
web_server:<br />
  port: 80<br />
<br />
font:<br />
  - file: "gfonts://Roboto"<br />
    id: roboto<br />
    size: 20<br />
<br />
display:<br />
  - platform: ssd1306_i2c<br />
    i2c_id: bus_a<br />
    model: "SSD1306 128x64"<br />
    address: 0x3C<br />
    lambda: |-<br />
      it.printf(0, 0, id(roboto), "KinCony F24");</code></div></div>esphome yaml download:<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/txt.png" title="Text Document" border="0" alt=".txt" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=8479" target="_blank" title="">HAv2-F24-Tuya.txt</a> (Size: 20.91 KB / Downloads: 200)
<!-- end: postbit_attachments_attachment --><br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=8480" target="_blank" title="">F24-HAv2-PCB.jpg</a> (Size: 265.61 KB / Downloads: 276)
<!-- end: postbit_attachments_attachment --><br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=8481" target="_blank" title="">HAv2-PC-setting.png</a> (Size: 99.73 KB / Downloads: 240)
<!-- end: postbit_attachments_attachment --><br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=8482" target="_blank" title="">home-assistant.png</a> (Size: 165.75 KB / Downloads: 288)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>esphome:<br />
  name: f24<br />
  friendly_name: f24<br />
  platformio_options:<br />
    board_build.extra_flags:<br />
      # WIFI_CONTROL_SELF_MODE = 0<br />
      # WIFI_CONTROL_SELF_MODE = 1<br />
      - "-DWIFI_CONTROL_SELF_MODE=1"<br />
esp32:<br />
  board: esp32-s3-devkitc-1<br />
  framework:<br />
    type: arduino<br />
    <br />
<br />
external_components:<br />
  - source:<br />
      type: git<br />
      url: https://github.com/hzkincony/esphome-tuya-wifi-mcu<br />
      ref: v1.3.0<br />
<br />
  - source:<br />
      type: git<br />
      url: https://github.com/hzkincony/esphome-kc868-ha<br />
      ref: v3.0.2<br />
<br />
# Enable logging<br />
<br />
  # hardware_uart: USB_SERIAL_JTAG<br />
# Enable Home Assistant API<br />
api:<br />
  encryption:<br />
    key: "WeVOuL5oNhjXcfzXtTirlOwvtWvCD5yqIxd3oV4es1k="<br />
<br />
ethernet:<br />
  type: W5500<br />
  clk_pin: GPIO42<br />
  mosi_pin: GPIO43<br />
  miso_pin: GPIO44<br />
  cs_pin: GPIO41<br />
  interrupt_pin: GPIO2<br />
  reset_pin: GPIO1<br />
<br />
i2c:<br />
   - id: bus_a<br />
     sda: 8<br />
     scl: 18<br />
     scan: true<br />
     frequency: 400kHz<br />
<br />
pcf8574:<br />
  - id: 'pcf8574_hub_out_1'  # for output channel 9-24<br />
    i2c_id: bus_a<br />
    address: 0x25<br />
    pcf8575: true<br />
<br />
  - id: 'pcf8574_hub_in_1'  # for digital input channel 1-16<br />
    i2c_id: bus_a<br />
    address: 0x24<br />
    pcf8575: true<br />
<br />
  - id: 'pcf8574_hub_out_in_2'  # for output channel 1-8  + (input 17-24)<br />
    i2c_id: bus_a<br />
    address: 0x26<br />
    pcf8575: true<br />
<br />
uart:<br />
  - id: myuart1<br />
    tx_pin: 16<br />
    rx_pin: 17<br />
    baud_rate: 9600<br />
    debug:<br />
      direction: BOTH<br />
      dummy_receiver: false<br />
<br />
  - id: tuya_mcu_uart<br />
    tx_pin: GPIO39<br />
    rx_pin: GPIO38<br />
    baud_rate: 9600<br />
<br />
tuya_wifi_mcu:<br />
  # tuya mcu product id<br />
  product_id: cchos3g1j2ucfbyd<br />
  uart_id: tuya_mcu_uart<br />
  wifi_reset_pin: 28<br />
  wifi_led_pin: 16<br />
<br />
kc868_ha:<br />
  uart_id: myuart1<br />
<br />
switch:<br />
<br />
  - platform: gpio<br />
    name: "f24-output01"<br />
    id: "f24_output01"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 12<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output1-tuya<br />
    dp_id: 1<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output01"<br />
<br />
  - platform: gpio<br />
    name: "f24-output02"<br />
    id: "f24_output02"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 13<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output2-tuya<br />
    dp_id: 2<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output02"<br />
<br />
  - platform: gpio<br />
    name: "f24-output03"<br />
    id: "f24_output03"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 14<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output3-tuya<br />
    dp_id: 3<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output03"<br />
<br />
  - platform: gpio<br />
    name: "f24-output04"<br />
    id: "f24_output04"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 15<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output4-tuya<br />
    dp_id: 4<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output04"<br />
<br />
  - platform: gpio<br />
    name: "f24-output05"<br />
    id: "f24_output05"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 8<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output5-tuya<br />
    dp_id: 5<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output05"<br />
<br />
  - platform: gpio<br />
    name: "f24-output06"<br />
    id: "f24_output06"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 9<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output6-tuya<br />
    dp_id: 6<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output06"<br />
<br />
  - platform: gpio<br />
    name: "f24-output07"<br />
    id: "f24_output07"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 10<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output7-tuya<br />
    dp_id: 101<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output07"<br />
<br />
  - platform: gpio<br />
    name: "f24-output08"<br />
    id: "f24_output08"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 11<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output8-tuya<br />
    dp_id: 102<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output08"<br />
<br />
  - platform: gpio<br />
    name: "f24-output09"<br />
    id: "f24_output09"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 0<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output9-tuya<br />
    dp_id: 103<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output09"<br />
<br />
  - platform: gpio<br />
    name: "f24-output10"<br />
    id: "f24_output10"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 1<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output10-tuya<br />
    dp_id: 104<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output10"<br />
<br />
  - platform: gpio<br />
    name: "f24-output11"<br />
    id: "f24_output11"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 2<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output11-tuya<br />
    dp_id: 105<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output11"<br />
<br />
  - platform: gpio<br />
    name: "f24-output12"<br />
    id: "f24_output12"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 3<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output12-tuya<br />
    dp_id: 106<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output12"<br />
<br />
  - platform: gpio<br />
    name: "f24-output13"<br />
    id: "f24_output13"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 4<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output13-tuya<br />
    dp_id: 107<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output13"<br />
<br />
  - platform: gpio<br />
    name: "f24-output14"<br />
    id: "f24_output14"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 5<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output14-tuya<br />
    dp_id: 108<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output14"<br />
<br />
  - platform: gpio<br />
    name: "f24-output15"<br />
    id: "f24_output15"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 6<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output15-tuya<br />
    dp_id: 109<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output15"<br />
<br />
  - platform: gpio<br />
    name: "f24-output16"<br />
    id: "f24_output16"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 7<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output16-tuya<br />
    dp_id: 110<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output16"<br />
<br />
  - platform: gpio<br />
    name: "f24-output17"<br />
    id: "f24_output17"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 8<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output17-tuya<br />
    dp_id: 126<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output17"<br />
<br />
  - platform: gpio<br />
    name: "f24-output18"<br />
    id: "f24_output18"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 9<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output18-tuya<br />
    dp_id: 129<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output18"<br />
<br />
  - platform: gpio<br />
    name: "f24-output19"<br />
    id: "f24_output19"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 10<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output19-tuya<br />
    dp_id: 130<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output19"<br />
<br />
  - platform: gpio<br />
    name: "f24-output20"<br />
    id: "f24_output20"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 11<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output20-tuya<br />
    dp_id: 131<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output20"<br />
<br />
  - platform: gpio<br />
    name: "f24-output21"<br />
    id: "f24_output21"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 12<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output21-tuya<br />
    dp_id: 132<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output21"<br />
<br />
  - platform: gpio<br />
    name: "f24-output22"<br />
    id: "f24_output22"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 13<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output22-tuya<br />
    dp_id: 133<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output22"<br />
<br />
  - platform: gpio<br />
    name: "f24-output23"<br />
    id: "f24_output23"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 14<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output23-tuya<br />
    dp_id: 134<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output23"<br />
<br />
  - platform: gpio<br />
    name: "f24-output24"<br />
    id: "f24_output24"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 15<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output24-tuya<br />
    dp_id: 135<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output24"<br />
<br />
  # The switch is used to control the D1~D6 level output on the KC868 HA board<br />
  # bind_output is required. Corresponds to the BindOutput parameter in HA485_Ctrl software<br />
  # Other parameters refer to: https://esphome.io/components/switch/index.html<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 1<br />
    name: "switch 1"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 2<br />
    name: "switch 2"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 3<br />
    name: "switch 3"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 4<br />
    name: "switch 4"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 5<br />
    name: "switch 5"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 6<br />
    name: "switch 6"<br />
<br />
<br />
<br />
binary_sensor:<br />
  - platform: gpio<br />
    name: "f24-input01"<br />
    id: "f24_input01"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 0<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input1-tuya<br />
    dp_id: 111<br />
    bind_binary_sensor_id: f24_input01<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input02"<br />
    id: "f24_input02"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 1<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input2-tuya<br />
    dp_id: 112<br />
    bind_binary_sensor_id: f24_input02<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input03"<br />
    id: "f24_input03"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 2<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input3-tuya<br />
    dp_id: 113<br />
    bind_binary_sensor_id: f24_input03<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input04"<br />
    id: "f24_input04"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 3<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input4-tuya<br />
    dp_id: 114<br />
    bind_binary_sensor_id: f24_input04<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input05"<br />
    id: "f24_input05"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 4<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input5-tuya<br />
    dp_id: 115<br />
    bind_binary_sensor_id: f24_input05<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input06"<br />
    id: "f24_input06"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 5<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input6-tuya<br />
    dp_id: 116<br />
    bind_binary_sensor_id: f24_input06<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input07"<br />
    id: "f24_input07"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 6<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input7-tuya<br />
    dp_id: 117<br />
    bind_binary_sensor_id: f24_input07<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input08"<br />
    id: "f24_input08"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 7<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input8-tuya<br />
    dp_id: 118<br />
    bind_binary_sensor_id: f24_input08<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input09"<br />
    id: "f24_input09"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 8<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input9-tuya<br />
    dp_id: 119<br />
    bind_binary_sensor_id: f24_input09<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input10"<br />
    id: "f24_input10"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 9<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input10-tuya<br />
    dp_id: 120<br />
    bind_binary_sensor_id: f24_input10<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input11"<br />
    id: "f24_input11"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 10<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input11-tuya<br />
    dp_id: 121<br />
    bind_binary_sensor_id: f24_input11<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input12"<br />
    id: "f24_input12"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 11<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input12-tuya<br />
    dp_id: 122<br />
    bind_binary_sensor_id: f24_input12<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input13"<br />
    id: "f24_input13"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 12<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input13-tuya<br />
    dp_id: 123<br />
    bind_binary_sensor_id: f24_input13<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input14"<br />
    id: "f24_input14"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 13<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input14-tuya<br />
    dp_id: 124<br />
    bind_binary_sensor_id: f24_input14<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input15"<br />
    id: "f24_input15"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 14<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input15-tuya<br />
    dp_id: 125<br />
    bind_binary_sensor_id: f24_input15<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input16"<br />
    id: "f24_input16"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 15<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input17"<br />
    id: "f24_input17"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 0<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input18"<br />
    id: "f24_input18"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 1<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input19"<br />
    id: "f24_input19"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 2<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input20"<br />
    id: "f24_input20"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 3<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input21"<br />
    id: "f24_input21"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 4<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input22"<br />
    id: "f24_input22"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 5<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input23"<br />
    id: "f24_input23"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 6<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input24"<br />
    id: "f24_input24"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 7<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
##pull-up resistance on PCB<br />
  - platform: gpio<br />
    name: "f24-W1-io48"<br />
    pin: <br />
      number: 48<br />
      inverted: true<br />
<br />
  - platform: gpio<br />
    name: "f24-W1-io47"<br />
    pin: <br />
      number: 47<br />
      inverted: true<br />
<br />
  - platform: gpio<br />
    name: "f24-W1-io21"<br />
    pin: <br />
      number: 21<br />
      inverted: true<br />
<br />
  - platform: gpio<br />
    name: "f24-W1-io15"<br />
    pin: <br />
      number: 15<br />
      inverted: true<br />
## without resistance on PCB<br />
  - platform: gpio<br />
    name: "f24-W1-io13"<br />
    pin: <br />
      number: 13<br />
      inverted: false<br />
<br />
  - platform: gpio<br />
    name: "f24-W1-io14"<br />
    pin: <br />
      number: 14<br />
      inverted:  false<br />
<br />
  - platform: gpio<br />
    name: "f24-433M"<br />
    pin: <br />
      number: 40<br />
      inverted:  false<br />
<br />
  # The binary_sensor corresponds to the state changes generated by K1~K6 on the KC868 HA board<br />
  # bind_output is required. Corresponds to the BindOutput parameter in HA485_Ctrl software<br />
  # Other parameters refer to: https://esphome.io/components/binary_sensor/index.html<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1 # Default value is 1, corresponds to the Target Relay Controller Addr parameter in HA485_Ctrl software<br />
    switch_adapter_addr: 10 # Default value is 10, corresponds to the Switch Adapter Addr parameter in HA485_Ctrl software<br />
    bind_output: 1 # Corresponds to the BindOutput parameter in HA485_Ctrl software<br />
    name: "binary_sensor 1"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 2<br />
    name: "binary_sensor 2"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 3<br />
    name: "binary_sensor 3"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 4<br />
    name: "binary_sensor 4"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 5<br />
    name: "binary_sensor 5"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 6<br />
    name: "binary_sensor 6"<br />
<br />
sensor:<br />
  - platform: adc<br />
    pin: 5<br />
    name: "f24 A1 Voltage"<br />
    update_interval: 5s<br />
    attenuation: 11db<br />
    filters:<br />
      - lambda:<br />
          if (x &gt;= 3.11) {<br />
            return x * 1.60256;<br />
          } else if (x &lt;= 0.15) {<br />
            return 0;<br />
          } else {<br />
            return x * 1.51;<br />
          }<br />
  - platform: adc<br />
    pin: 7<br />
    name: "f24 A2 Voltage"<br />
    update_interval: 5s<br />
    attenuation: 11db<br />
    filters:<br />
      # - multiply: 1.51515<br />
      - lambda:<br />
          if (x &gt;= 3.11) {<br />
            return x * 1.60256;<br />
          } else if (x &lt;= 0.15) {<br />
            return 0;<br />
          } else {<br />
            return x * 1.51;<br />
          }<br />
  - platform: adc<br />
    pin: 6<br />
    name: "f24 A3 Current"<br />
    update_interval: 5s<br />
    unit_of_measurement: mA<br />
    attenuation: 11db<br />
    filters:<br />
      - multiply: 6.66666666<br />
  - platform: adc<br />
    pin: 4<br />
    name: "f24 A4 Current"<br />
    update_interval: 5s<br />
    unit_of_measurement: mA<br />
    attenuation: 11db<br />
    filters:<br />
      - multiply: 6.66666666<br />
<br />
web_server:<br />
  port: 80<br />
<br />
font:<br />
  - file: "gfonts://Roboto"<br />
    id: roboto<br />
    size: 20<br />
<br />
display:<br />
  - platform: ssd1306_i2c<br />
    i2c_id: bus_a<br />
    model: "SSD1306 128x64"<br />
    address: 0x3C<br />
    lambda: |-<br />
      it.printf(0, 0, id(roboto), "KinCony F24");</code></div></div>esphome yaml download:<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/txt.png" title="Text Document" border="0" alt=".txt" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=8479" target="_blank" title="">HAv2-F24-Tuya.txt</a> (Size: 20.91 KB / Downloads: 200)
<!-- end: postbit_attachments_attachment --><br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=8480" target="_blank" title="">F24-HAv2-PCB.jpg</a> (Size: 265.61 KB / Downloads: 276)
<!-- end: postbit_attachments_attachment --><br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=8481" target="_blank" title="">HAv2-PC-setting.png</a> (Size: 99.73 KB / Downloads: 240)
<!-- end: postbit_attachments_attachment --><br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=8482" target="_blank" title="">home-assistant.png</a> (Size: 165.75 KB / Downloads: 288)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[F24 work with HAv2 without tuya app ESPHome yaml]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8650</link>
			<pubDate>Tue, 14 Oct 2025 08:18:12 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=8650</guid>
			<description><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>esphome:<br />
  name: hav2<br />
  friendly_name: HAv2<br />
<br />
esp32:<br />
  board: esp32-s3-devkitc-1<br />
  framework:<br />
    type: esp-idf<br />
<br />
# Enable logging<br />
logger:<br />
  baud_rate: 0<br />
<br />
# Enable Home Assistant API<br />
api:<br />
<br />
<br />
ethernet:<br />
  type: W5500<br />
  clk_pin: GPIO42<br />
  mosi_pin: GPIO43<br />
  miso_pin: GPIO44<br />
  cs_pin: GPIO41<br />
  interrupt_pin: GPIO2<br />
  reset_pin: GPIO1<br />
<br />
external_components:<br />
  - source:<br />
      type: git<br />
      url: https://github.com/hzkincony/esphome-kc868-ha<br />
      ref: v3.0.1<br />
<br />
uart:<br />
  - id: myuart1<br />
    tx_pin: 16<br />
    rx_pin: 17<br />
    baud_rate: 9600<br />
    debug:<br />
      direction: BOTH<br />
      dummy_receiver: false<br />
<br />
kc868_ha:<br />
<br />
binary_sensor:<br />
<br />
  # The binary_sensor corresponds to the state changes generated by K1~K6 on the KC868 HA board<br />
  # bind_output is required. Corresponds to the BindOutput parameter in HA485_Ctrl software<br />
  # Other parameters refer to: https://esphome.io/components/binary_sensor/index.html<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1 # Default value is 1, corresponds to the Target Relay Controller Addr parameter in HA485_Ctrl software<br />
    switch_adapter_addr: 10 # Default value is 10, corresponds to the Switch Adapter Addr parameter in HA485_Ctrl software<br />
    bind_output: 1 # Corresponds to the BindOutput parameter in HA485_Ctrl software<br />
    name: "binary_sensor 1"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 2<br />
    name: "binary_sensor 2"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 3<br />
    name: "binary_sensor 3"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 4<br />
    name: "binary_sensor 4"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 5<br />
    name: "binary_sensor 5"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 6<br />
    name: "binary_sensor 6"<br />
<br />
switch:<br />
  # The switch is used to control the D1~D6 level output on the KC868 HA board<br />
  # bind_output is required. Corresponds to the BindOutput parameter in HA485_Ctrl software<br />
  # Other parameters refer to: https://esphome.io/components/switch/index.html<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 1<br />
    name: "switch 1"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 2<br />
    name: "switch 2"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 3<br />
    name: "switch 3"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 4<br />
    name: "switch 4"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 5<br />
    name: "switch 5"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 6<br />
    name: "switch 6"<br />
<br />
web_server:<br />
  port: 80</code></div></div>esphome yaml file download:<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/txt.png" title="Text Document" border="0" alt=".txt" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=8475" target="_blank" title="">HAv2-F24-yaml.txt</a> (Size: 3.04 KB / Downloads: 184)
<!-- end: postbit_attachments_attachment --><br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=8476" target="_blank" title="">F24-HAv2-PCB.jpg</a> (Size: 265.61 KB / Downloads: 263)
<!-- end: postbit_attachments_attachment --><br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=8477" target="_blank" title="">HAv2-PC-setting.png</a> (Size: 99.73 KB / Downloads: 281)
<!-- end: postbit_attachments_attachment --><br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=8478" target="_blank" title="">home-assistant.png</a> (Size: 165.75 KB / Downloads: 257)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>esphome:<br />
  name: hav2<br />
  friendly_name: HAv2<br />
<br />
esp32:<br />
  board: esp32-s3-devkitc-1<br />
  framework:<br />
    type: esp-idf<br />
<br />
# Enable logging<br />
logger:<br />
  baud_rate: 0<br />
<br />
# Enable Home Assistant API<br />
api:<br />
<br />
<br />
ethernet:<br />
  type: W5500<br />
  clk_pin: GPIO42<br />
  mosi_pin: GPIO43<br />
  miso_pin: GPIO44<br />
  cs_pin: GPIO41<br />
  interrupt_pin: GPIO2<br />
  reset_pin: GPIO1<br />
<br />
external_components:<br />
  - source:<br />
      type: git<br />
      url: https://github.com/hzkincony/esphome-kc868-ha<br />
      ref: v3.0.1<br />
<br />
uart:<br />
  - id: myuart1<br />
    tx_pin: 16<br />
    rx_pin: 17<br />
    baud_rate: 9600<br />
    debug:<br />
      direction: BOTH<br />
      dummy_receiver: false<br />
<br />
kc868_ha:<br />
<br />
binary_sensor:<br />
<br />
  # The binary_sensor corresponds to the state changes generated by K1~K6 on the KC868 HA board<br />
  # bind_output is required. Corresponds to the BindOutput parameter in HA485_Ctrl software<br />
  # Other parameters refer to: https://esphome.io/components/binary_sensor/index.html<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1 # Default value is 1, corresponds to the Target Relay Controller Addr parameter in HA485_Ctrl software<br />
    switch_adapter_addr: 10 # Default value is 10, corresponds to the Switch Adapter Addr parameter in HA485_Ctrl software<br />
    bind_output: 1 # Corresponds to the BindOutput parameter in HA485_Ctrl software<br />
    name: "binary_sensor 1"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 2<br />
    name: "binary_sensor 2"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 3<br />
    name: "binary_sensor 3"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 4<br />
    name: "binary_sensor 4"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 5<br />
    name: "binary_sensor 5"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 6<br />
    name: "binary_sensor 6"<br />
<br />
switch:<br />
  # The switch is used to control the D1~D6 level output on the KC868 HA board<br />
  # bind_output is required. Corresponds to the BindOutput parameter in HA485_Ctrl software<br />
  # Other parameters refer to: https://esphome.io/components/switch/index.html<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 1<br />
    name: "switch 1"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 2<br />
    name: "switch 2"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 3<br />
    name: "switch 3"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 4<br />
    name: "switch 4"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 5<br />
    name: "switch 5"<br />
  - platform: kc868_ha<br />
    target_relay_controller_addr: 1<br />
    switch_adapter_addr: 10<br />
    bind_output: 6<br />
    name: "switch 6"<br />
<br />
web_server:<br />
  port: 80</code></div></div>esphome yaml file download:<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/txt.png" title="Text Document" border="0" alt=".txt" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=8475" target="_blank" title="">HAv2-F24-yaml.txt</a> (Size: 3.04 KB / Downloads: 184)
<!-- end: postbit_attachments_attachment --><br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="JPG Image" border="0" alt=".jpg" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=8476" target="_blank" title="">F24-HAv2-PCB.jpg</a> (Size: 265.61 KB / Downloads: 263)
<!-- end: postbit_attachments_attachment --><br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=8477" target="_blank" title="">HAv2-PC-setting.png</a> (Size: 99.73 KB / Downloads: 281)
<!-- end: postbit_attachments_attachment --><br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=8478" target="_blank" title="">home-assistant.png</a> (Size: 165.75 KB / Downloads: 257)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[F24 PCB button define]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8477</link>
			<pubDate>Sun, 31 Aug 2025 08:37:17 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=8477</guid>
			<description><![CDATA[F24 buttons on PCB:<br />
  RST: RESET of ESP32<br />
  DL: ESP32 download button<br />
  CFG: tuya config]]></description>
			<content:encoded><![CDATA[F24 buttons on PCB:<br />
  RST: RESET of ESP32<br />
  DL: ESP32 download button<br />
  CFG: tuya config]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[F24 and KC868-AP dimmer sharing same wall switch panel]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8454</link>
			<pubDate>Mon, 18 Aug 2025 15:13:37 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=3298">stansvec</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=8454</guid>
			<description><![CDATA[Hello,<br />
<br />
Can I use one multi-gang Kincony momentary wall switch with different devices, one device per gang? I want a 2-gangs switch:<br />
<br />
 - Gang 1 to an F24 (to control a light bulb by software)<br />
 - Gang 2 to a KC868-AP (ESP32) dimmer (to control an LED strip).<br />
<br />
Is this wiring possible?<br />
<br />
Many thanks]]></description>
			<content:encoded><![CDATA[Hello,<br />
<br />
Can I use one multi-gang Kincony momentary wall switch with different devices, one device per gang? I want a 2-gangs switch:<br />
<br />
 - Gang 1 to an F24 (to control a light bulb by software)<br />
 - Gang 2 to a KC868-AP (ESP32) dimmer (to control an LED strip).<br />
<br />
Is this wiring possible?<br />
<br />
Many thanks]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[F-24: Problem using built-in 433MHz receiver with ESPHome (GPIO40 issue)]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=8174</link>
			<pubDate>Wed, 11 Jun 2025 01:23:00 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=8813">mwsieminski</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=8174</guid>
			<description><![CDATA[Hello,<br />
I'm using the Kincony F-24 controller and trying to get the built-in 433MHz receiver working under ESPHome.<br />
I get the following error:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>[15:27:57][C][remote_receiver.esp32:161]: Remote Receiver:<br />
[15:27:57][C][remote_receiver.esp32:162]:   Pin: GPIO40<br />
[15:27:57][C][remote_receiver.esp32:173]:   Channel: 0<br />
[15:27:57][C][remote_receiver.esp32:174]:   RMT memory blocks: 3<br />
[15:27:57][C][remote_receiver.esp32:175]:   Clock divider: 80<br />
[15:27:57][C][remote_receiver.esp32:178]:   Tolerance: 25%<br />
[15:27:57][C][remote_receiver.esp32:179]:   Filter out pulses shorter than: 50 us<br />
[15:27:57][C][remote_receiver.esp32:180]:   Signal is done after 10000 us of no changes<br />
[15:27:57][E][remote_receiver.esp32:183]: Configuring RMT driver failed: ESP_ERR_INVALID_ARG (in rmt_config)<br />
[15:27:57][E][component:085]:   Component remote_receiver is marked FAILED</code></div></div><br />
<br />
Below is part of my ESPHome YAML configuration:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>esphome:<br />
  name: f24<br />
  friendly_name: "Kincony F24 Controller"<br />
  project:<br />
    name: kincony.f24-smart-home<br />
    version: "1.0"<br />
  <br />
esp32:<br />
  board: esp32-s3-devkitc-1<br />
  framework:<br />
    type: arduino<br />
<br />
# Enable logging<br />
logger:<br />
<br />
# Enable Home Assistant API<br />
api:<br />
  id: ha_api<br />
  encryption:<br />
    key: !secret<br />
<br />
ota:<br />
  platform: esphome<br />
  password: !secret<br />
<br />
ethernet:<br />
  type: W5500<br />
  clk_pin: GPIO42<br />
  mosi_pin: GPIO43<br />
  miso_pin: GPIO44<br />
  cs_pin: GPIO41<br />
  interrupt_pin: GPIO2<br />
  reset_pin: GPIO1<br />
  domain: .local<br />
  id: ethernet_interface<br />
<br />
<br />
web_server:<br />
  port: 80<br />
<br />
i2c:<br />
  - id: bus_a<br />
    sda: GPIO8<br />
    scl: GPIO18<br />
    scan: true<br />
    frequency: 400kHz<br />
<br />
pcf8574:<br />
  - id: 'pcf8574_outputs_9_24'<br />
    i2c_id: bus_a<br />
    address: 0x25<br />
  - id: 'pcf8574_inputs_1_16'<br />
    i2c_id: bus_a<br />
    address: 0x24<br />
  - id: 'pcf8574_outputs_1_8_inputs_17_24'<br />
    i2c_id: bus_a<br />
    address: 0x26<br />
<br />
globals:<br />
  - id: current_ip_address<br />
    type: std::string<br />
    restore_value: no<br />
    initial_value: '"Booting..."'<br />
  - id: ha_status_text<br />
    type: std::string<br />
    restore_value: no<br />
    initial_value: '"Offline"'<br />
  - id: rf_code_display<br />
    type: std::string<br />
    restore_value: no<br />
    initial_value: '""'<br />
  - id: click_counts<br />
    type: int<br />
    initial_value: '0'<br />
<br />
<br />
# Sekcja definiująca fizyczne wyjścia (przekaźniki)<br />
output:<br />
  - platform: gpio<br />
    id: output_wiatrolap<br />
    pin: { pcf8574: pcf8574_outputs_1_8_inputs_17_24, number: 12, mode: OUTPUT, inverted: true }<br />
  - platform: gpio<br />
    id: output_salon<br />
    pin: { pcf8574: pcf8574_outputs_1_8_inputs_17_24, number: 13, mode: OUTPUT, inverted: true }<br />
<br />
<br />
binary_sensor:<br />
  - platform: status<br />
    name: "Kincony F24 Status"<br />
    id: f24_status_ha<br />
  - platform: template<br />
    name: "Kincony F24 Ethernet Status"<br />
    id: ethernet_connected_status<br />
    lambda: |-<br />
      return id(ethernet_interface).is_connected();<br />
    on_press:<br />
      then:<br />
        - lambda: |-<br />
            id(current_ip_address) = id(ethernet_interface).get_ip_addresses()[0].str();<br />
            id(ha_status_text) = "ETH OK";<br />
            ESP_LOGI("ethernet", "Ethernet connected. IP: %s", id(current_ip_address).c_str());<br />
    on_release:<br />
      then:<br />
        - lambda: |-<br />
            id(current_ip_address) = "AP Mode";<br />
            id(ha_status_text) = "AP Mode";<br />
            ESP_LOGW("ethernet", "Ethernet disconnected. Activating AP mode.");<br />
  - platform: template<br />
    id: wifi_ap_active<br />
    name: "Kincony F24 WiFi AP Active"<br />
    internal: true<br />
    lambda: |-<br />
      return !id(ethernet_interface).is_connected();<br />
<br />
<br />
  - platform: gpio<br />
    name: "Włącznik Wiatrołap"<br />
    pin:<br />
      pcf8574: pcf8574_inputs_1_16<br />
      number: 0<br />
      inverted: true<br />
    filters:<br />
      - delayed_on: 10ms<br />
    on_press:<br />
      then:<br />
        - lambda: 'id(click_counts) = 0;'<br />
    on_multi_click:<br />
      - timing:<br />
          - ON for at most 600ms<br />
          - OFF for at most 600ms<br />
          - ON for at most 600ms<br />
          - OFF for at least 200ms<br />
        then:<br />
          - homeassistant.event:<br />
              event: esphome.wiatrolap_double_click<br />
              data:<br />
                input: "1"<br />
          - logger.log: "Włącznik Wiatrołap: Dwuklik"<br />
      - timing:<br />
          - ON for at most 600ms<br />
          - OFF for at least 351ms<br />
        then:<br />
          - light.toggle: light_wiatrolap<br />
          - logger.log: "Wlacznik Wiatrołap: Pojedynczy klik"<br />
<br />
  - platform: gpio<br />
    name: "Włącznik Salon"<br />
    pin:<br />
      pcf8574: pcf8574_inputs_1_16<br />
      number: 1<br />
      inverted: true<br />
    filters:<br />
      - delayed_on: 10ms<br />
    on_press:<br />
      then:<br />
        - lambda: 'id(click_counts) = 0;'<br />
    on_multi_click:<br />
      - timing:<br />
          - ON for at most 600ms<br />
          - OFF for at most 600ms<br />
          - ON for at most 600ms<br />
          - OFF for at least 200ms<br />
        then:<br />
          - homeassistant.event:<br />
              event: esphome.salon_double_click<br />
          - logger.log: "Włącznik Salon: Dwuklik"<br />
      - timing:<br />
          - ON for at most 600ms<br />
          - OFF for at least 351ms<br />
        then:<br />
          - light.toggle: light_salon<br />
          - logger.log: "Wlacznik Salon: Pojedynczy klik"<br />
<br />
 <br />
<br />
# Sekcja definiująca logiczne encje świateł<br />
light:<br />
  - platform: binary<br />
    name: "Wiatrołap"<br />
    id: light_wiatrolap<br />
    output: output_wiatrolap<br />
  - platform: binary<br />
    name: "Salon"<br />
    id: light_salon<br />
    output: output_salon<br />
<br />
#normal version for RF receiver - not working<br />
#remote_receiver:<br />
#  pin:<br />
#    number: GPIO40<br />
#    inverted: true<br />
#  dump:<br />
#    - rc_switch<br />
#  tolerance: 50%<br />
#  filter: 250us<br />
#  idle: 4ms<br />
#  buffer_size: 2kb<br />
<br />
#  on_rc_switch:<br />
#    then:<br />
 #     - logger.log:<br />
 #         format: "RC Switch received. Code: %u"<br />
 #         args: [ 'x.code' ]<br />
 #    - lambda: |-<br />
 #        id(rf_code_display) = "RC: " + to_string(x.code);<br />
 #    - homeassistant.event:<br />
 #         event: esphome.f24_rf_received<br />
 #         data:<br />
 #          code: !lambda 'return x.code;'<br />
<br />
# Minimal version for testing - not working<br />
remote_receiver:<br />
  pin:<br />
    number: GPIO40<br />
    inverted: true <br />
  dump: rc_switch <br />
  <br />
button:<br />
  - platform: restart<br />
    name: "Kincony F24 Restart"<br />
<br />
font:<br />
  - file: "gfonts://Roboto"<br />
    id: roboto_12<br />
    size: 12<br />
  - file: "gfonts://Roboto"<br />
    id: roboto_10<br />
    size: 10<br />
<br />
display:<br />
  - platform: ssd1306_i2c<br />
    id: oled_display<br />
    model: "SSD1306 128x64"<br />
    address: 0x3C<br />
    i2c_id: bus_a<br />
    update_interval: 2s<br />
    pages:<br />
      - id: page1<br />
        lambda: |-<br />
          it.strftime(0, 0, id(roboto_10), "%H:%M:%S", id(homeassistant_time).now());<br />
          it.print(0, 12, id(roboto_12), id(current_ip_address).c_str());<br />
          it.print(0, 28, id(roboto_12), id(ha_status_text).c_str());<br />
          if (!id(rf_code_display).empty()) {<br />
            it.print(0, 44, id(roboto_12), id(rf_code_display).c_str());<br />
          }<br />
          it.horizontal_line(0, 57, 128);<br />
          it.printf(0, 58, id(roboto_10), "F24 Controller");;<br />
          <br />
time:<br />
  - platform: homeassistant<br />
    id: homeassistant_time<br />
    on_time:<br />
      - seconds: 0<br />
        minutes: 0<br />
        then:<br />
          - logger.log: "Synchronizing time with Home Assistant."<br />
<br />
interval:<br />
  - interval: 5s<br />
    then:<br />
      - lambda: |-<br />
          if (id(ethernet_interface).is_connected()) {<br />
            id(current_ip_address) = id(ethernet_interface).get_ip_addresses()[0].str();<br />
            if (id(f24_status_ha).state) {<br />
               id(ha_status_text) = "ETH HA OK";<br />
            } else {<br />
               id(ha_status_text) = "ETH OK";<br />
            }<br />
          } else if (id(wifi_ap_active).state) {<br />
            id(current_ip_address) = "AP: 192.168.4.1";<br />
            id(ha_status_text) = "AP Mode";<br />
          } else {<br />
            id(current_ip_address) = "No Network";<br />
            id(ha_status_text) = "Offline";<br />
          }<br />
  <br />
<br />
sensor:<br />
  - platform: adc<br />
    pin: GPIO5<br />
    name: "F24 A1 Voltage"<br />
    update_interval: 60s<br />
    attenuation: 12db<br />
  - platform: adc<br />
    pin: GPIO7<br />
    name: "F24 A2 Voltage"<br />
    update_interval: 60s<br />
    attenuation: 12db<br />
  - platform: adc<br />
    pin: GPIO6<br />
    name: "F24 A3 Current"<br />
    update_interval: 60s<br />
    unit_of_measurement: mA<br />
    attenuation: 12db<br />
    filters:<br />
      - multiply: 6.66666666<br />
  - platform: adc<br />
    pin: GPIO4<br />
    name: "F24 A4 Current"<br />
    update_interval: 60s<br />
    unit_of_measurement: mA<br />
    attenuation: 12db<br />
    filters:<br />
      - multiply: 6.66666666</code></div></div><br />
My questions:<br />
<ol type="1" class="mycode_list"><li>Is the 433MHz receiver really connected to native GPIO40 of the ESP32?<br />
</li>
<li>Is this GPIO compatible with the RMT hardware required by remote_receiver in ESPHome?<br />
</li>
<li>Could the RF receiver be connected via an I²C expander (like PCF8574), or is it mapped internally in another way?<br />
<br />
</li>
</ol>
Thanks for your support!]]></description>
			<content:encoded><![CDATA[Hello,<br />
I'm using the Kincony F-24 controller and trying to get the built-in 433MHz receiver working under ESPHome.<br />
I get the following error:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>[15:27:57][C][remote_receiver.esp32:161]: Remote Receiver:<br />
[15:27:57][C][remote_receiver.esp32:162]:   Pin: GPIO40<br />
[15:27:57][C][remote_receiver.esp32:173]:   Channel: 0<br />
[15:27:57][C][remote_receiver.esp32:174]:   RMT memory blocks: 3<br />
[15:27:57][C][remote_receiver.esp32:175]:   Clock divider: 80<br />
[15:27:57][C][remote_receiver.esp32:178]:   Tolerance: 25%<br />
[15:27:57][C][remote_receiver.esp32:179]:   Filter out pulses shorter than: 50 us<br />
[15:27:57][C][remote_receiver.esp32:180]:   Signal is done after 10000 us of no changes<br />
[15:27:57][E][remote_receiver.esp32:183]: Configuring RMT driver failed: ESP_ERR_INVALID_ARG (in rmt_config)<br />
[15:27:57][E][component:085]:   Component remote_receiver is marked FAILED</code></div></div><br />
<br />
Below is part of my ESPHome YAML configuration:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>esphome:<br />
  name: f24<br />
  friendly_name: "Kincony F24 Controller"<br />
  project:<br />
    name: kincony.f24-smart-home<br />
    version: "1.0"<br />
  <br />
esp32:<br />
  board: esp32-s3-devkitc-1<br />
  framework:<br />
    type: arduino<br />
<br />
# Enable logging<br />
logger:<br />
<br />
# Enable Home Assistant API<br />
api:<br />
  id: ha_api<br />
  encryption:<br />
    key: !secret<br />
<br />
ota:<br />
  platform: esphome<br />
  password: !secret<br />
<br />
ethernet:<br />
  type: W5500<br />
  clk_pin: GPIO42<br />
  mosi_pin: GPIO43<br />
  miso_pin: GPIO44<br />
  cs_pin: GPIO41<br />
  interrupt_pin: GPIO2<br />
  reset_pin: GPIO1<br />
  domain: .local<br />
  id: ethernet_interface<br />
<br />
<br />
web_server:<br />
  port: 80<br />
<br />
i2c:<br />
  - id: bus_a<br />
    sda: GPIO8<br />
    scl: GPIO18<br />
    scan: true<br />
    frequency: 400kHz<br />
<br />
pcf8574:<br />
  - id: 'pcf8574_outputs_9_24'<br />
    i2c_id: bus_a<br />
    address: 0x25<br />
  - id: 'pcf8574_inputs_1_16'<br />
    i2c_id: bus_a<br />
    address: 0x24<br />
  - id: 'pcf8574_outputs_1_8_inputs_17_24'<br />
    i2c_id: bus_a<br />
    address: 0x26<br />
<br />
globals:<br />
  - id: current_ip_address<br />
    type: std::string<br />
    restore_value: no<br />
    initial_value: '"Booting..."'<br />
  - id: ha_status_text<br />
    type: std::string<br />
    restore_value: no<br />
    initial_value: '"Offline"'<br />
  - id: rf_code_display<br />
    type: std::string<br />
    restore_value: no<br />
    initial_value: '""'<br />
  - id: click_counts<br />
    type: int<br />
    initial_value: '0'<br />
<br />
<br />
# Sekcja definiująca fizyczne wyjścia (przekaźniki)<br />
output:<br />
  - platform: gpio<br />
    id: output_wiatrolap<br />
    pin: { pcf8574: pcf8574_outputs_1_8_inputs_17_24, number: 12, mode: OUTPUT, inverted: true }<br />
  - platform: gpio<br />
    id: output_salon<br />
    pin: { pcf8574: pcf8574_outputs_1_8_inputs_17_24, number: 13, mode: OUTPUT, inverted: true }<br />
<br />
<br />
binary_sensor:<br />
  - platform: status<br />
    name: "Kincony F24 Status"<br />
    id: f24_status_ha<br />
  - platform: template<br />
    name: "Kincony F24 Ethernet Status"<br />
    id: ethernet_connected_status<br />
    lambda: |-<br />
      return id(ethernet_interface).is_connected();<br />
    on_press:<br />
      then:<br />
        - lambda: |-<br />
            id(current_ip_address) = id(ethernet_interface).get_ip_addresses()[0].str();<br />
            id(ha_status_text) = "ETH OK";<br />
            ESP_LOGI("ethernet", "Ethernet connected. IP: %s", id(current_ip_address).c_str());<br />
    on_release:<br />
      then:<br />
        - lambda: |-<br />
            id(current_ip_address) = "AP Mode";<br />
            id(ha_status_text) = "AP Mode";<br />
            ESP_LOGW("ethernet", "Ethernet disconnected. Activating AP mode.");<br />
  - platform: template<br />
    id: wifi_ap_active<br />
    name: "Kincony F24 WiFi AP Active"<br />
    internal: true<br />
    lambda: |-<br />
      return !id(ethernet_interface).is_connected();<br />
<br />
<br />
  - platform: gpio<br />
    name: "Włącznik Wiatrołap"<br />
    pin:<br />
      pcf8574: pcf8574_inputs_1_16<br />
      number: 0<br />
      inverted: true<br />
    filters:<br />
      - delayed_on: 10ms<br />
    on_press:<br />
      then:<br />
        - lambda: 'id(click_counts) = 0;'<br />
    on_multi_click:<br />
      - timing:<br />
          - ON for at most 600ms<br />
          - OFF for at most 600ms<br />
          - ON for at most 600ms<br />
          - OFF for at least 200ms<br />
        then:<br />
          - homeassistant.event:<br />
              event: esphome.wiatrolap_double_click<br />
              data:<br />
                input: "1"<br />
          - logger.log: "Włącznik Wiatrołap: Dwuklik"<br />
      - timing:<br />
          - ON for at most 600ms<br />
          - OFF for at least 351ms<br />
        then:<br />
          - light.toggle: light_wiatrolap<br />
          - logger.log: "Wlacznik Wiatrołap: Pojedynczy klik"<br />
<br />
  - platform: gpio<br />
    name: "Włącznik Salon"<br />
    pin:<br />
      pcf8574: pcf8574_inputs_1_16<br />
      number: 1<br />
      inverted: true<br />
    filters:<br />
      - delayed_on: 10ms<br />
    on_press:<br />
      then:<br />
        - lambda: 'id(click_counts) = 0;'<br />
    on_multi_click:<br />
      - timing:<br />
          - ON for at most 600ms<br />
          - OFF for at most 600ms<br />
          - ON for at most 600ms<br />
          - OFF for at least 200ms<br />
        then:<br />
          - homeassistant.event:<br />
              event: esphome.salon_double_click<br />
          - logger.log: "Włącznik Salon: Dwuklik"<br />
      - timing:<br />
          - ON for at most 600ms<br />
          - OFF for at least 351ms<br />
        then:<br />
          - light.toggle: light_salon<br />
          - logger.log: "Wlacznik Salon: Pojedynczy klik"<br />
<br />
 <br />
<br />
# Sekcja definiująca logiczne encje świateł<br />
light:<br />
  - platform: binary<br />
    name: "Wiatrołap"<br />
    id: light_wiatrolap<br />
    output: output_wiatrolap<br />
  - platform: binary<br />
    name: "Salon"<br />
    id: light_salon<br />
    output: output_salon<br />
<br />
#normal version for RF receiver - not working<br />
#remote_receiver:<br />
#  pin:<br />
#    number: GPIO40<br />
#    inverted: true<br />
#  dump:<br />
#    - rc_switch<br />
#  tolerance: 50%<br />
#  filter: 250us<br />
#  idle: 4ms<br />
#  buffer_size: 2kb<br />
<br />
#  on_rc_switch:<br />
#    then:<br />
 #     - logger.log:<br />
 #         format: "RC Switch received. Code: %u"<br />
 #         args: [ 'x.code' ]<br />
 #    - lambda: |-<br />
 #        id(rf_code_display) = "RC: " + to_string(x.code);<br />
 #    - homeassistant.event:<br />
 #         event: esphome.f24_rf_received<br />
 #         data:<br />
 #          code: !lambda 'return x.code;'<br />
<br />
# Minimal version for testing - not working<br />
remote_receiver:<br />
  pin:<br />
    number: GPIO40<br />
    inverted: true <br />
  dump: rc_switch <br />
  <br />
button:<br />
  - platform: restart<br />
    name: "Kincony F24 Restart"<br />
<br />
font:<br />
  - file: "gfonts://Roboto"<br />
    id: roboto_12<br />
    size: 12<br />
  - file: "gfonts://Roboto"<br />
    id: roboto_10<br />
    size: 10<br />
<br />
display:<br />
  - platform: ssd1306_i2c<br />
    id: oled_display<br />
    model: "SSD1306 128x64"<br />
    address: 0x3C<br />
    i2c_id: bus_a<br />
    update_interval: 2s<br />
    pages:<br />
      - id: page1<br />
        lambda: |-<br />
          it.strftime(0, 0, id(roboto_10), "%H:%M:%S", id(homeassistant_time).now());<br />
          it.print(0, 12, id(roboto_12), id(current_ip_address).c_str());<br />
          it.print(0, 28, id(roboto_12), id(ha_status_text).c_str());<br />
          if (!id(rf_code_display).empty()) {<br />
            it.print(0, 44, id(roboto_12), id(rf_code_display).c_str());<br />
          }<br />
          it.horizontal_line(0, 57, 128);<br />
          it.printf(0, 58, id(roboto_10), "F24 Controller");;<br />
          <br />
time:<br />
  - platform: homeassistant<br />
    id: homeassistant_time<br />
    on_time:<br />
      - seconds: 0<br />
        minutes: 0<br />
        then:<br />
          - logger.log: "Synchronizing time with Home Assistant."<br />
<br />
interval:<br />
  - interval: 5s<br />
    then:<br />
      - lambda: |-<br />
          if (id(ethernet_interface).is_connected()) {<br />
            id(current_ip_address) = id(ethernet_interface).get_ip_addresses()[0].str();<br />
            if (id(f24_status_ha).state) {<br />
               id(ha_status_text) = "ETH HA OK";<br />
            } else {<br />
               id(ha_status_text) = "ETH OK";<br />
            }<br />
          } else if (id(wifi_ap_active).state) {<br />
            id(current_ip_address) = "AP: 192.168.4.1";<br />
            id(ha_status_text) = "AP Mode";<br />
          } else {<br />
            id(current_ip_address) = "No Network";<br />
            id(ha_status_text) = "Offline";<br />
          }<br />
  <br />
<br />
sensor:<br />
  - platform: adc<br />
    pin: GPIO5<br />
    name: "F24 A1 Voltage"<br />
    update_interval: 60s<br />
    attenuation: 12db<br />
  - platform: adc<br />
    pin: GPIO7<br />
    name: "F24 A2 Voltage"<br />
    update_interval: 60s<br />
    attenuation: 12db<br />
  - platform: adc<br />
    pin: GPIO6<br />
    name: "F24 A3 Current"<br />
    update_interval: 60s<br />
    unit_of_measurement: mA<br />
    attenuation: 12db<br />
    filters:<br />
      - multiply: 6.66666666<br />
  - platform: adc<br />
    pin: GPIO4<br />
    name: "F24 A4 Current"<br />
    update_interval: 60s<br />
    unit_of_measurement: mA<br />
    attenuation: 12db<br />
    filters:<br />
      - multiply: 6.66666666</code></div></div><br />
My questions:<br />
<ol type="1" class="mycode_list"><li>Is the 433MHz receiver really connected to native GPIO40 of the ESP32?<br />
</li>
<li>Is this GPIO compatible with the RMT hardware required by remote_receiver in ESPHome?<br />
</li>
<li>Could the RF receiver be connected via an I²C expander (like PCF8574), or is it mapped internally in another way?<br />
<br />
</li>
</ol>
Thanks for your support!]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[F24 ESPHome yaml for home assistant]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=7145</link>
			<pubDate>Thu, 28 Nov 2024 19:54:03 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=7145</guid>
			<description><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>esphome:<br />
  name: f24<br />
  friendly_name: f24<br />
  platformio_options:<br />
    board_build.extra_flags:<br />
      # WIFI_CONTROL_SELF_MODE = 0<br />
      # WIFI_CONTROL_SELF_MODE = 1<br />
      - "-DWIFI_CONTROL_SELF_MODE=1"<br />
esp32:<br />
  board: esp32-s3-devkitc-1<br />
  framework:<br />
    type: arduino<br />
    <br />
<br />
external_components:<br />
  - source:<br />
      type: git<br />
      url: https://github.com/hzkincony/esphome-tuya-wifi-mcu<br />
      ref: v1.3.0<br />
<br />
# Enable logging<br />
<br />
  # hardware_uart: USB_SERIAL_JTAG<br />
# Enable Home Assistant API<br />
api:<br />
  encryption:<br />
    key: "WeVOuL5oNhjXcfzXtTirlOwvtWvCD5yqIxd3oV4es1k="<br />
<br />
ethernet:<br />
  type: W5500<br />
  clk_pin: GPIO42<br />
  mosi_pin: GPIO43<br />
  miso_pin: GPIO44<br />
  cs_pin: GPIO41<br />
  interrupt_pin: GPIO2<br />
  reset_pin: GPIO1<br />
<br />
i2c:<br />
   - id: bus_a<br />
     sda: 8<br />
     scl: 18<br />
     scan: true<br />
     frequency: 400kHz<br />
<br />
pcf8574:<br />
  - id: 'pcf8574_hub_out_1'  # for output channel 9-24<br />
    i2c_id: bus_a<br />
    address: 0x25<br />
    pcf8575: true<br />
<br />
  - id: 'pcf8574_hub_in_1'  # for digital input channel 1-16<br />
    i2c_id: bus_a<br />
    address: 0x24<br />
    pcf8575: true<br />
<br />
  - id: 'pcf8574_hub_out_in_2'  # for output channel 1-8  + (input 17-24)<br />
    i2c_id: bus_a<br />
    address: 0x26<br />
    pcf8575: true<br />
<br />
uart:<br />
  - id: uart_1    #RS485<br />
    baud_rate: 9600<br />
    debug:<br />
      direction: BOTH<br />
      dummy_receiver: true<br />
      after:<br />
        timeout: 10ms<br />
    tx_pin: 16<br />
    rx_pin: 17<br />
<br />
  - id: tuya_mcu_uart<br />
    tx_pin: GPIO39<br />
    rx_pin: GPIO38<br />
    baud_rate: 9600<br />
<br />
tuya_wifi_mcu:<br />
  # tuya mcu product id<br />
  product_id: cchos3g1j2ucfbyd<br />
  uart_id: tuya_mcu_uart<br />
  wifi_reset_pin: 28<br />
  wifi_led_pin: 16<br />
<br />
switch:<br />
  - platform: uart<br />
    uart_id: uart_1<br />
    name: "RS485 Button"<br />
    data: [0x11, 0x22, 0x33, 0x44, 0x55]<br />
<br />
  - platform: gpio<br />
    name: "f24-output01"<br />
    id: "f24_output01"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 12<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output1-tuya<br />
    dp_id: 1<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output01"<br />
<br />
  - platform: gpio<br />
    name: "f24-output02"<br />
    id: "f24_output02"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 13<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output2-tuya<br />
    dp_id: 2<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output02"<br />
<br />
  - platform: gpio<br />
    name: "f24-output03"<br />
    id: "f24_output03"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 14<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output3-tuya<br />
    dp_id: 3<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output03"<br />
<br />
  - platform: gpio<br />
    name: "f24-output04"<br />
    id: "f24_output04"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 15<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output4-tuya<br />
    dp_id: 4<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output04"<br />
<br />
  - platform: gpio<br />
    name: "f24-output05"<br />
    id: "f24_output05"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 8<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output5-tuya<br />
    dp_id: 5<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output05"<br />
<br />
  - platform: gpio<br />
    name: "f24-output06"<br />
    id: "f24_output06"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 9<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output6-tuya<br />
    dp_id: 6<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output06"<br />
<br />
  - platform: gpio<br />
    name: "f24-output07"<br />
    id: "f24_output07"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 10<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output7-tuya<br />
    dp_id: 101<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output07"<br />
<br />
  - platform: gpio<br />
    name: "f24-output08"<br />
    id: "f24_output08"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 11<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output8-tuya<br />
    dp_id: 102<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output08"<br />
<br />
  - platform: gpio<br />
    name: "f24-output09"<br />
    id: "f24_output09"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 0<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output9-tuya<br />
    dp_id: 103<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output09"<br />
<br />
  - platform: gpio<br />
    name: "f24-output10"<br />
    id: "f24_output10"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 1<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output10-tuya<br />
    dp_id: 104<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output10"<br />
<br />
  - platform: gpio<br />
    name: "f24-output11"<br />
    id: "f24_output11"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 2<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output11-tuya<br />
    dp_id: 105<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output11"<br />
<br />
  - platform: gpio<br />
    name: "f24-output12"<br />
    id: "f24_output12"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 3<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output12-tuya<br />
    dp_id: 106<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output12"<br />
<br />
  - platform: gpio<br />
    name: "f24-output13"<br />
    id: "f24_output13"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 4<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output13-tuya<br />
    dp_id: 107<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output13"<br />
<br />
  - platform: gpio<br />
    name: "f24-output14"<br />
    id: "f24_output14"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 5<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output14-tuya<br />
    dp_id: 108<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output14"<br />
<br />
  - platform: gpio<br />
    name: "f24-output15"<br />
    id: "f24_output15"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 6<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output15-tuya<br />
    dp_id: 109<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output15"<br />
<br />
  - platform: gpio<br />
    name: "f24-output16"<br />
    id: "f24_output16"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 7<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output16-tuya<br />
    dp_id: 110<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output16"<br />
<br />
  - platform: gpio<br />
    name: "f24-output17"<br />
    id: "f24_output17"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 8<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output17-tuya<br />
    dp_id: 126<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output17"<br />
<br />
  - platform: gpio<br />
    name: "f24-output18"<br />
    id: "f24_output18"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 9<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output18-tuya<br />
    dp_id: 129<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output18"<br />
<br />
  - platform: gpio<br />
    name: "f24-output19"<br />
    id: "f24_output19"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 10<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output19-tuya<br />
    dp_id: 130<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output19"<br />
<br />
  - platform: gpio<br />
    name: "f24-output20"<br />
    id: "f24_output20"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 11<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output20-tuya<br />
    dp_id: 131<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output20"<br />
<br />
  - platform: gpio<br />
    name: "f24-output21"<br />
    id: "f24_output21"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 12<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output21-tuya<br />
    dp_id: 132<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output21"<br />
<br />
  - platform: gpio<br />
    name: "f24-output22"<br />
    id: "f24_output22"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 13<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output22-tuya<br />
    dp_id: 133<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output22"<br />
<br />
  - platform: gpio<br />
    name: "f24-output23"<br />
    id: "f24_output23"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 14<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output23-tuya<br />
    dp_id: 134<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output23"<br />
<br />
  - platform: gpio<br />
    name: "f24-output24"<br />
    id: "f24_output24"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 15<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output24-tuya<br />
    dp_id: 135<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output24"<br />
<br />
<br />
binary_sensor:<br />
  - platform: gpio<br />
    name: "f24-input01"<br />
    id: "f24_input01"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 0<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input1-tuya<br />
    dp_id: 111<br />
    bind_binary_sensor_id: f24_input01<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input02"<br />
    id: "f24_input02"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 1<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input2-tuya<br />
    dp_id: 112<br />
    bind_binary_sensor_id: f24_input02<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input03"<br />
    id: "f24_input03"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 2<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input3-tuya<br />
    dp_id: 113<br />
    bind_binary_sensor_id: f24_input03<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input04"<br />
    id: "f24_input04"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 3<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input4-tuya<br />
    dp_id: 114<br />
    bind_binary_sensor_id: f24_input04<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input05"<br />
    id: "f24_input05"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 4<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input5-tuya<br />
    dp_id: 115<br />
    bind_binary_sensor_id: f24_input05<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input06"<br />
    id: "f24_input06"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 5<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input6-tuya<br />
    dp_id: 116<br />
    bind_binary_sensor_id: f24_input06<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input07"<br />
    id: "f24_input07"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 6<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input7-tuya<br />
    dp_id: 117<br />
    bind_binary_sensor_id: f24_input07<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input08"<br />
    id: "f24_input08"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 7<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input8-tuya<br />
    dp_id: 118<br />
    bind_binary_sensor_id: f24_input08<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input09"<br />
    id: "f24_input09"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 8<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input9-tuya<br />
    dp_id: 119<br />
    bind_binary_sensor_id: f24_input09<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input10"<br />
    id: "f24_input10"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 9<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input10-tuya<br />
    dp_id: 120<br />
    bind_binary_sensor_id: f24_input10<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input11"<br />
    id: "f24_input11"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 10<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input11-tuya<br />
    dp_id: 121<br />
    bind_binary_sensor_id: f24_input11<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input12"<br />
    id: "f24_input12"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 11<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input12-tuya<br />
    dp_id: 122<br />
    bind_binary_sensor_id: f24_input12<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input13"<br />
    id: "f24_input13"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 12<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input13-tuya<br />
    dp_id: 123<br />
    bind_binary_sensor_id: f24_input13<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input14"<br />
    id: "f24_input14"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 13<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input14-tuya<br />
    dp_id: 124<br />
    bind_binary_sensor_id: f24_input14<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input15"<br />
    id: "f24_input15"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 14<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input15-tuya<br />
    dp_id: 125<br />
    bind_binary_sensor_id: f24_input15<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input16"<br />
    id: "f24_input16"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 15<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input17"<br />
    id: "f24_input17"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 0<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input18"<br />
    id: "f24_input18"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 1<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input19"<br />
    id: "f24_input19"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 2<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input20"<br />
    id: "f24_input20"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 3<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input21"<br />
    id: "f24_input21"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 4<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input22"<br />
    id: "f24_input22"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 5<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input23"<br />
    id: "f24_input23"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 6<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input24"<br />
    id: "f24_input24"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 7<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
##pull-up resistance on PCB<br />
  - platform: gpio<br />
    name: "f24-W1-io48"<br />
    pin: <br />
      number: 48<br />
      inverted: true<br />
<br />
  - platform: gpio<br />
    name: "f24-W1-io47"<br />
    pin: <br />
      number: 47<br />
      inverted: true<br />
<br />
  - platform: gpio<br />
    name: "f24-W1-io21"<br />
    pin: <br />
      number: 21<br />
      inverted: true<br />
<br />
  - platform: gpio<br />
    name: "f24-W1-io15"<br />
    pin: <br />
      number: 15<br />
      inverted: true<br />
## without resistance on PCB<br />
  - platform: gpio<br />
    name: "f24-W1-io13"<br />
    pin: <br />
      number: 13<br />
      inverted: false<br />
<br />
  - platform: gpio<br />
    name: "f24-W1-io14"<br />
    pin: <br />
      number: 14<br />
      inverted:  false<br />
<br />
  - platform: gpio<br />
    name: "f24-433M"<br />
    pin: <br />
      number: 40<br />
      inverted:  false<br />
<br />
sensor:<br />
  - platform: adc<br />
    pin: 5<br />
    name: "f24 A1 Voltage"<br />
    update_interval: 5s<br />
    attenuation: 11db<br />
    filters:<br />
      - lambda:<br />
          if (x &gt;= 3.11) {<br />
            return x * 1.60256;<br />
          } else if (x &lt;= 0.15) {<br />
            return 0;<br />
          } else {<br />
            return x * 1.51;<br />
          }<br />
  - platform: adc<br />
    pin: 7<br />
    name: "f24 A2 Voltage"<br />
    update_interval: 5s<br />
    attenuation: 11db<br />
    filters:<br />
      # - multiply: 1.51515<br />
      - lambda:<br />
          if (x &gt;= 3.11) {<br />
            return x * 1.60256;<br />
          } else if (x &lt;= 0.15) {<br />
            return 0;<br />
          } else {<br />
            return x * 1.51;<br />
          }<br />
  - platform: adc<br />
    pin: 6<br />
    name: "f24 A3 Current"<br />
    update_interval: 5s<br />
    unit_of_measurement: mA<br />
    attenuation: 11db<br />
    filters:<br />
      - multiply: 6.66666666<br />
  - platform: adc<br />
    pin: 4<br />
    name: "f24 A4 Current"<br />
    update_interval: 5s<br />
    unit_of_measurement: mA<br />
    attenuation: 11db<br />
    filters:<br />
      - multiply: 6.66666666<br />
<br />
web_server:<br />
  port: 80<br />
<br />
font:<br />
  - file: "gfonts://Roboto"<br />
    id: roboto<br />
    size: 20<br />
<br />
display:<br />
  - platform: ssd1306_i2c<br />
    i2c_id: bus_a<br />
    model: "SSD1306 128x64"<br />
    address: 0x3C<br />
    lambda: |-<br />
      it.printf(0, 0, id(roboto), "KinCony F24");</code></div></div> download yaml file: <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/txt.png" title="Text Document" border="0" alt=".txt" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=6538" target="_blank" title="">F24-HA.txt</a> (Size: 18.55 KB / Downloads: 552)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>esphome:<br />
  name: f24<br />
  friendly_name: f24<br />
  platformio_options:<br />
    board_build.extra_flags:<br />
      # WIFI_CONTROL_SELF_MODE = 0<br />
      # WIFI_CONTROL_SELF_MODE = 1<br />
      - "-DWIFI_CONTROL_SELF_MODE=1"<br />
esp32:<br />
  board: esp32-s3-devkitc-1<br />
  framework:<br />
    type: arduino<br />
    <br />
<br />
external_components:<br />
  - source:<br />
      type: git<br />
      url: https://github.com/hzkincony/esphome-tuya-wifi-mcu<br />
      ref: v1.3.0<br />
<br />
# Enable logging<br />
<br />
  # hardware_uart: USB_SERIAL_JTAG<br />
# Enable Home Assistant API<br />
api:<br />
  encryption:<br />
    key: "WeVOuL5oNhjXcfzXtTirlOwvtWvCD5yqIxd3oV4es1k="<br />
<br />
ethernet:<br />
  type: W5500<br />
  clk_pin: GPIO42<br />
  mosi_pin: GPIO43<br />
  miso_pin: GPIO44<br />
  cs_pin: GPIO41<br />
  interrupt_pin: GPIO2<br />
  reset_pin: GPIO1<br />
<br />
i2c:<br />
   - id: bus_a<br />
     sda: 8<br />
     scl: 18<br />
     scan: true<br />
     frequency: 400kHz<br />
<br />
pcf8574:<br />
  - id: 'pcf8574_hub_out_1'  # for output channel 9-24<br />
    i2c_id: bus_a<br />
    address: 0x25<br />
    pcf8575: true<br />
<br />
  - id: 'pcf8574_hub_in_1'  # for digital input channel 1-16<br />
    i2c_id: bus_a<br />
    address: 0x24<br />
    pcf8575: true<br />
<br />
  - id: 'pcf8574_hub_out_in_2'  # for output channel 1-8  + (input 17-24)<br />
    i2c_id: bus_a<br />
    address: 0x26<br />
    pcf8575: true<br />
<br />
uart:<br />
  - id: uart_1    #RS485<br />
    baud_rate: 9600<br />
    debug:<br />
      direction: BOTH<br />
      dummy_receiver: true<br />
      after:<br />
        timeout: 10ms<br />
    tx_pin: 16<br />
    rx_pin: 17<br />
<br />
  - id: tuya_mcu_uart<br />
    tx_pin: GPIO39<br />
    rx_pin: GPIO38<br />
    baud_rate: 9600<br />
<br />
tuya_wifi_mcu:<br />
  # tuya mcu product id<br />
  product_id: cchos3g1j2ucfbyd<br />
  uart_id: tuya_mcu_uart<br />
  wifi_reset_pin: 28<br />
  wifi_led_pin: 16<br />
<br />
switch:<br />
  - platform: uart<br />
    uart_id: uart_1<br />
    name: "RS485 Button"<br />
    data: [0x11, 0x22, 0x33, 0x44, 0x55]<br />
<br />
  - platform: gpio<br />
    name: "f24-output01"<br />
    id: "f24_output01"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 12<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output1-tuya<br />
    dp_id: 1<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output01"<br />
<br />
  - platform: gpio<br />
    name: "f24-output02"<br />
    id: "f24_output02"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 13<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output2-tuya<br />
    dp_id: 2<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output02"<br />
<br />
  - platform: gpio<br />
    name: "f24-output03"<br />
    id: "f24_output03"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 14<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output3-tuya<br />
    dp_id: 3<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output03"<br />
<br />
  - platform: gpio<br />
    name: "f24-output04"<br />
    id: "f24_output04"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 15<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output4-tuya<br />
    dp_id: 4<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output04"<br />
<br />
  - platform: gpio<br />
    name: "f24-output05"<br />
    id: "f24_output05"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 8<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output5-tuya<br />
    dp_id: 5<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output05"<br />
<br />
  - platform: gpio<br />
    name: "f24-output06"<br />
    id: "f24_output06"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 9<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output6-tuya<br />
    dp_id: 6<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output06"<br />
<br />
  - platform: gpio<br />
    name: "f24-output07"<br />
    id: "f24_output07"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 10<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output7-tuya<br />
    dp_id: 101<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output07"<br />
<br />
  - platform: gpio<br />
    name: "f24-output08"<br />
    id: "f24_output08"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 11<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output8-tuya<br />
    dp_id: 102<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output08"<br />
<br />
  - platform: gpio<br />
    name: "f24-output09"<br />
    id: "f24_output09"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 0<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output9-tuya<br />
    dp_id: 103<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output09"<br />
<br />
  - platform: gpio<br />
    name: "f24-output10"<br />
    id: "f24_output10"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 1<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output10-tuya<br />
    dp_id: 104<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output10"<br />
<br />
  - platform: gpio<br />
    name: "f24-output11"<br />
    id: "f24_output11"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 2<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output11-tuya<br />
    dp_id: 105<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output11"<br />
<br />
  - platform: gpio<br />
    name: "f24-output12"<br />
    id: "f24_output12"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 3<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output12-tuya<br />
    dp_id: 106<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output12"<br />
<br />
  - platform: gpio<br />
    name: "f24-output13"<br />
    id: "f24_output13"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 4<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output13-tuya<br />
    dp_id: 107<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output13"<br />
<br />
  - platform: gpio<br />
    name: "f24-output14"<br />
    id: "f24_output14"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 5<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output14-tuya<br />
    dp_id: 108<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output14"<br />
<br />
  - platform: gpio<br />
    name: "f24-output15"<br />
    id: "f24_output15"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 6<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output15-tuya<br />
    dp_id: 109<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output15"<br />
<br />
  - platform: gpio<br />
    name: "f24-output16"<br />
    id: "f24_output16"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 7<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output16-tuya<br />
    dp_id: 110<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output16"<br />
<br />
  - platform: gpio<br />
    name: "f24-output17"<br />
    id: "f24_output17"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 8<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output17-tuya<br />
    dp_id: 126<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output17"<br />
<br />
  - platform: gpio<br />
    name: "f24-output18"<br />
    id: "f24_output18"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 9<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output18-tuya<br />
    dp_id: 129<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output18"<br />
<br />
  - platform: gpio<br />
    name: "f24-output19"<br />
    id: "f24_output19"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 10<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output19-tuya<br />
    dp_id: 130<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output19"<br />
<br />
  - platform: gpio<br />
    name: "f24-output20"<br />
    id: "f24_output20"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 11<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output20-tuya<br />
    dp_id: 131<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output20"<br />
<br />
  - platform: gpio<br />
    name: "f24-output21"<br />
    id: "f24_output21"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 12<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output21-tuya<br />
    dp_id: 132<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output21"<br />
<br />
  - platform: gpio<br />
    name: "f24-output22"<br />
    id: "f24_output22"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 13<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output22-tuya<br />
    dp_id: 133<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output22"<br />
<br />
  - platform: gpio<br />
    name: "f24-output23"<br />
    id: "f24_output23"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 14<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output23-tuya<br />
    dp_id: 134<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output23"<br />
<br />
  - platform: gpio<br />
    name: "f24-output24"<br />
    id: "f24_output24"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_1<br />
      number: 15<br />
      mode: OUTPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-output24-tuya<br />
    dp_id: 135<br />
    # hide from homeassistant ui<br />
    internal: true<br />
    # bind other switch, sync state<br />
    bind_switch_id: "f24_output24"<br />
<br />
<br />
binary_sensor:<br />
  - platform: gpio<br />
    name: "f24-input01"<br />
    id: "f24_input01"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 0<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input1-tuya<br />
    dp_id: 111<br />
    bind_binary_sensor_id: f24_input01<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input02"<br />
    id: "f24_input02"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 1<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input2-tuya<br />
    dp_id: 112<br />
    bind_binary_sensor_id: f24_input02<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input03"<br />
    id: "f24_input03"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 2<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input3-tuya<br />
    dp_id: 113<br />
    bind_binary_sensor_id: f24_input03<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input04"<br />
    id: "f24_input04"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 3<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input4-tuya<br />
    dp_id: 114<br />
    bind_binary_sensor_id: f24_input04<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input05"<br />
    id: "f24_input05"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 4<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input5-tuya<br />
    dp_id: 115<br />
    bind_binary_sensor_id: f24_input05<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input06"<br />
    id: "f24_input06"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 5<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input6-tuya<br />
    dp_id: 116<br />
    bind_binary_sensor_id: f24_input06<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input07"<br />
    id: "f24_input07"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 6<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input7-tuya<br />
    dp_id: 117<br />
    bind_binary_sensor_id: f24_input07<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input08"<br />
    id: "f24_input08"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 7<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input8-tuya<br />
    dp_id: 118<br />
    bind_binary_sensor_id: f24_input08<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input09"<br />
    id: "f24_input09"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 8<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input9-tuya<br />
    dp_id: 119<br />
    bind_binary_sensor_id: f24_input09<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input10"<br />
    id: "f24_input10"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 9<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input10-tuya<br />
    dp_id: 120<br />
    bind_binary_sensor_id: f24_input10<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input11"<br />
    id: "f24_input11"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 10<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input11-tuya<br />
    dp_id: 121<br />
    bind_binary_sensor_id: f24_input11<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input12"<br />
    id: "f24_input12"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 11<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input12-tuya<br />
    dp_id: 122<br />
    bind_binary_sensor_id: f24_input12<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input13"<br />
    id: "f24_input13"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 12<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input13-tuya<br />
    dp_id: 123<br />
    bind_binary_sensor_id: f24_input13<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input14"<br />
    id: "f24_input14"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 13<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input14-tuya<br />
    dp_id: 124<br />
    bind_binary_sensor_id: f24_input14<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input15"<br />
    id: "f24_input15"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 14<br />
      mode: INPUT<br />
      inverted: true<br />
  - platform: tuya_wifi_mcu<br />
    name: f24-input15-tuya<br />
    dp_id: 125<br />
    bind_binary_sensor_id: f24_input15<br />
    internal: true<br />
<br />
  - platform: gpio<br />
    name: "f24-input16"<br />
    id: "f24_input16"<br />
    pin:<br />
      pcf8574: pcf8574_hub_in_1<br />
      number: 15<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input17"<br />
    id: "f24_input17"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 0<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input18"<br />
    id: "f24_input18"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 1<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input19"<br />
    id: "f24_input19"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 2<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input20"<br />
    id: "f24_input20"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 3<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input21"<br />
    id: "f24_input21"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 4<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input22"<br />
    id: "f24_input22"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 5<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input23"<br />
    id: "f24_input23"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 6<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
  - platform: gpio<br />
    name: "f24-input24"<br />
    id: "f24_input24"<br />
    pin:<br />
      pcf8574: pcf8574_hub_out_in_2<br />
      number: 7<br />
      mode: INPUT<br />
      inverted: true<br />
<br />
<br />
##pull-up resistance on PCB<br />
  - platform: gpio<br />
    name: "f24-W1-io48"<br />
    pin: <br />
      number: 48<br />
      inverted: true<br />
<br />
  - platform: gpio<br />
    name: "f24-W1-io47"<br />
    pin: <br />
      number: 47<br />
      inverted: true<br />
<br />
  - platform: gpio<br />
    name: "f24-W1-io21"<br />
    pin: <br />
      number: 21<br />
      inverted: true<br />
<br />
  - platform: gpio<br />
    name: "f24-W1-io15"<br />
    pin: <br />
      number: 15<br />
      inverted: true<br />
## without resistance on PCB<br />
  - platform: gpio<br />
    name: "f24-W1-io13"<br />
    pin: <br />
      number: 13<br />
      inverted: false<br />
<br />
  - platform: gpio<br />
    name: "f24-W1-io14"<br />
    pin: <br />
      number: 14<br />
      inverted:  false<br />
<br />
  - platform: gpio<br />
    name: "f24-433M"<br />
    pin: <br />
      number: 40<br />
      inverted:  false<br />
<br />
sensor:<br />
  - platform: adc<br />
    pin: 5<br />
    name: "f24 A1 Voltage"<br />
    update_interval: 5s<br />
    attenuation: 11db<br />
    filters:<br />
      - lambda:<br />
          if (x &gt;= 3.11) {<br />
            return x * 1.60256;<br />
          } else if (x &lt;= 0.15) {<br />
            return 0;<br />
          } else {<br />
            return x * 1.51;<br />
          }<br />
  - platform: adc<br />
    pin: 7<br />
    name: "f24 A2 Voltage"<br />
    update_interval: 5s<br />
    attenuation: 11db<br />
    filters:<br />
      # - multiply: 1.51515<br />
      - lambda:<br />
          if (x &gt;= 3.11) {<br />
            return x * 1.60256;<br />
          } else if (x &lt;= 0.15) {<br />
            return 0;<br />
          } else {<br />
            return x * 1.51;<br />
          }<br />
  - platform: adc<br />
    pin: 6<br />
    name: "f24 A3 Current"<br />
    update_interval: 5s<br />
    unit_of_measurement: mA<br />
    attenuation: 11db<br />
    filters:<br />
      - multiply: 6.66666666<br />
  - platform: adc<br />
    pin: 4<br />
    name: "f24 A4 Current"<br />
    update_interval: 5s<br />
    unit_of_measurement: mA<br />
    attenuation: 11db<br />
    filters:<br />
      - multiply: 6.66666666<br />
<br />
web_server:<br />
  port: 80<br />
<br />
font:<br />
  - file: "gfonts://Roboto"<br />
    id: roboto<br />
    size: 20<br />
<br />
display:<br />
  - platform: ssd1306_i2c<br />
    i2c_id: bus_a<br />
    model: "SSD1306 128x64"<br />
    address: 0x3C<br />
    lambda: |-<br />
      it.printf(0, 0, id(roboto), "KinCony F24");</code></div></div> download yaml file: <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/txt.png" title="Text Document" border="0" alt=".txt" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=6538" target="_blank" title="">F24-HA.txt</a> (Size: 18.55 KB / Downloads: 552)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[arduino code examples for F24]-12 How to control one relay]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=7144</link>
			<pubDate>Thu, 28 Nov 2024 19:52:59 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=7144</guid>
			<description><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 *<br />
 * This program controls a 24-channel relay board via two PCF8575 I/O expanders.<br />
 * It toggles relay 24 every 2 seconds and prints its status via the serial port.<br />
 * <br />
 * Pin Definitions:<br />
 * - SDA: GPIO 8<br />
 * - SCL: GPIO 18<br />
 * <br />
 * Relay 24 is controlled through the first PCF8575 (I2C_ADDRESS_R1).<br />
 */<br />
<br />
#include &lt;Wire.h&gt;        // Include the Wire library for I2C communication<br />
#include &lt;PCF8575.h&gt;   &nbsp;&nbsp;// Include the PCF8575 library to control the I/O expander<br />
<br />
#define SDA 8            // Define the SDA pin<br />
#define SCL 18         &nbsp;&nbsp;// Define the SCL pin<br />
#define TOGGLE_DELAY 2000  // Define the toggle delay time (2 seconds)<br />
<br />
// Set I2C addresses of the PCF8575 modules<br />
#define I2C_ADDRESS_R1 0x25 // I2C address of the first PCF8575 module (for relays 9-24)<br />
#define I2C_ADDRESS_R2 0x26 // I2C address of the second PCF8575 module (for relays 1-8)<br />
<br />
PCF8575 pcf8575_R1(I2C_ADDRESS_R1); // Create a PCF8575 object for the first module (for relays 9-24)<br />
PCF8575 pcf8575_R2(I2C_ADDRESS_R2); // Create a PCF8575 object for the second module (for relays 1-8)<br />
<br />
bool relay24State = HIGH; // Initialize relay 24 state to OFF (assuming HIGH is OFF)<br />
<br />
void setup() {<br />
  // Initialize I2C communication<br />
  Wire.begin(SDA, SCL); // SDA on GPIO 8, SCL on GPIO 18 (according to your board's configuration)<br />
  <br />
  // Initialize serial communication for debugging<br />
  Serial.begin(115200);<br />
  Serial.println("PCF8575 Relay 24 Toggle Program: Starting...");<br />
<br />
  // Initialize the PCF8575 modules<br />
  pcf8575_R1.begin();<br />
  pcf8575_R2.begin();<br />
<br />
  // Ensure that all relays are turned off initially (set all pins HIGH)<br />
  for (int i = 0; i &lt; 16; i++) {<br />
    pcf8575_R1.write(i, HIGH); // Set relays 9-24 to OFF (assuming HIGH means OFF for relays)<br />
    pcf8575_R2.write(i, HIGH); // Set relays 1-8 to OFF (assuming HIGH means OFF for relays)<br />
  }<br />
}<br />
<br />
void loop() {<br />
  // Toggle relay 24 state (relay 24 corresponds to pin 15 on pcf8575_R1)<br />
  relay24State = !relay24State; // Toggle the state<br />
  pcf8575_R1.write(15, relay24State); // Write the new state to relay 24<br />
<br />
  // Print the current state of relay 24 to the serial port<br />
  if (relay24State == LOW) {<br />
    Serial.println("Relay 24 is ON");<br />
  } else {<br />
    Serial.println("Relay 24 is OFF");<br />
  }<br />
<br />
  // Wait for 2 seconds before toggling again<br />
  delay(TOGGLE_DELAY);<br />
}</code></div></div> arduino ino file download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=6537" target="_blank" title="">12-control-one-relay.zip</a> (Size: 1.09 KB / Downloads: 532)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 *<br />
 * This program controls a 24-channel relay board via two PCF8575 I/O expanders.<br />
 * It toggles relay 24 every 2 seconds and prints its status via the serial port.<br />
 * <br />
 * Pin Definitions:<br />
 * - SDA: GPIO 8<br />
 * - SCL: GPIO 18<br />
 * <br />
 * Relay 24 is controlled through the first PCF8575 (I2C_ADDRESS_R1).<br />
 */<br />
<br />
#include &lt;Wire.h&gt;        // Include the Wire library for I2C communication<br />
#include &lt;PCF8575.h&gt;   &nbsp;&nbsp;// Include the PCF8575 library to control the I/O expander<br />
<br />
#define SDA 8            // Define the SDA pin<br />
#define SCL 18         &nbsp;&nbsp;// Define the SCL pin<br />
#define TOGGLE_DELAY 2000  // Define the toggle delay time (2 seconds)<br />
<br />
// Set I2C addresses of the PCF8575 modules<br />
#define I2C_ADDRESS_R1 0x25 // I2C address of the first PCF8575 module (for relays 9-24)<br />
#define I2C_ADDRESS_R2 0x26 // I2C address of the second PCF8575 module (for relays 1-8)<br />
<br />
PCF8575 pcf8575_R1(I2C_ADDRESS_R1); // Create a PCF8575 object for the first module (for relays 9-24)<br />
PCF8575 pcf8575_R2(I2C_ADDRESS_R2); // Create a PCF8575 object for the second module (for relays 1-8)<br />
<br />
bool relay24State = HIGH; // Initialize relay 24 state to OFF (assuming HIGH is OFF)<br />
<br />
void setup() {<br />
  // Initialize I2C communication<br />
  Wire.begin(SDA, SCL); // SDA on GPIO 8, SCL on GPIO 18 (according to your board's configuration)<br />
  <br />
  // Initialize serial communication for debugging<br />
  Serial.begin(115200);<br />
  Serial.println("PCF8575 Relay 24 Toggle Program: Starting...");<br />
<br />
  // Initialize the PCF8575 modules<br />
  pcf8575_R1.begin();<br />
  pcf8575_R2.begin();<br />
<br />
  // Ensure that all relays are turned off initially (set all pins HIGH)<br />
  for (int i = 0; i &lt; 16; i++) {<br />
    pcf8575_R1.write(i, HIGH); // Set relays 9-24 to OFF (assuming HIGH means OFF for relays)<br />
    pcf8575_R2.write(i, HIGH); // Set relays 1-8 to OFF (assuming HIGH means OFF for relays)<br />
  }<br />
}<br />
<br />
void loop() {<br />
  // Toggle relay 24 state (relay 24 corresponds to pin 15 on pcf8575_R1)<br />
  relay24State = !relay24State; // Toggle the state<br />
  pcf8575_R1.write(15, relay24State); // Write the new state to relay 24<br />
<br />
  // Print the current state of relay 24 to the serial port<br />
  if (relay24State == LOW) {<br />
    Serial.println("Relay 24 is ON");<br />
  } else {<br />
    Serial.println("Relay 24 is OFF");<br />
  }<br />
<br />
  // Wait for 2 seconds before toggling again<br />
  delay(TOGGLE_DELAY);<br />
}</code></div></div> arduino ino file download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=6537" target="_blank" title="">12-control-one-relay.zip</a> (Size: 1.09 KB / Downloads: 532)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[arduino code examples for F24]-11 digital INPUT trigger OUTPUT directly]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=7143</link>
			<pubDate>Thu, 28 Nov 2024 19:51:56 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=7143</guid>
			<description><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 *<br />
 * This program reads 24 input states from two PCF8575 I/O expanders and <br />
 * controls a corresponding 24-channel relay module. <br />
 * When an input pin is LOW, the corresponding relay is turned ON (LOW means ON for the relay).<br />
 * When the input pin is HIGH, the corresponding relay is turned OFF.<br />
 *<br />
 * Pin Definitions:<br />
 * - SDA: GPIO 8<br />
 * - SCL: GPIO 18<br />
 * - Input I2C Address 1 (inputs 1-16): 0x24<br />
 * - Input/Relay I2C Address 2 (inputs 17-24 and relays 1-8): 0x26<br />
 * - Relay I2C Address 3 (relays 9-24): 0x25<br />
 */<br />
<br />
#include &lt;Wire.h&gt;        // I2C communication<br />
#include &lt;PCF8575.h&gt;   &nbsp;&nbsp;// Library to control the PCF8575 I/O expander<br />
<br />
// Define I2C pins<br />
#define SDA 8            // SDA pin<br />
#define SCL 18         &nbsp;&nbsp;// SCL pin<br />
<br />
// I2C addresses for the PCF8575 modules<br />
#define INPUT_I2C_ADDRESS_1 0x24 &nbsp;&nbsp;// I2C address for the first input PCF8575 module (inputs 1-16)<br />
#define INPUT_RELAY_I2C_ADDRESS_2 0x26 &nbsp;&nbsp;// I2C address for inputs 17-24 and relays 1-8<br />
#define RELAY_I2C_ADDRESS_3 0x25 &nbsp;&nbsp;// I2C address for relays 9-24<br />
<br />
PCF8575 pcf8575_IN1(INPUT_I2C_ADDRESS_1);    // Create an object for the first input PCF8575 (inputs 1-16)<br />
PCF8575 pcf8575_IN2(INPUT_RELAY_I2C_ADDRESS_2);    // Create an object for the second input PCF8575 (inputs 17-24 and relays 1-8)<br />
PCF8575 pcf8575_RL(RELAY_I2C_ADDRESS_3);    // Create an object for the relay PCF8575 (relays 9-24)<br />
<br />
void setup() {<br />
  // Initialize I2C communication<br />
  Wire.begin(SDA, SCL);<br />
  <br />
  // Initialize serial communication<br />
  Serial.begin(115200);<br />
  <br />
  // Initialize input and relay modules<br />
  pcf8575_IN1.begin();  // For inputs 1-16<br />
  pcf8575_IN2.begin();  // For inputs 17-24 and relays 1-8<br />
  pcf8575_RL.begin(); &nbsp;&nbsp;// For relays 9-24<br />
  <br />
  // Turn off all relays at the start (LOW means OFF)<br />
  for (int i = 0; i &lt; 8; i++) {<br />
    pcf8575_IN2.write(i, LOW);  // Turn off relays 1-8<br />
  }<br />
  for (int i = 0; i &lt; 16; i++) {<br />
    pcf8575_RL.write(i, LOW);  // Turn off relays 9-24<br />
  }<br />
<br />
  Serial.println("System started: Input state controlling 24 relays");<br />
}<br />
<br />
void loop() {<br />
  // Read and control relays 1-16<br />
  for (int i = 0; i &lt; 16; i++) {<br />
    bool inputState = pcf8575_IN1.read(i);  // Read input i from the first input module<br />
    if (inputState) {<br />
      pcf8575_RL.write(i, HIGH);  // If input is HIGH, turn the corresponding relay OFF<br />
    } else {<br />
      pcf8575_RL.write(i, LOW); &nbsp;&nbsp;// If input is LOW, turn the corresponding relay ON<br />
    }<br />
  }<br />
<br />
  // Read and control relays 17-24 (shared with second input module)<br />
  for (int i = 0; i &lt; 8; i++) {<br />
    bool inputState = pcf8575_IN2.read(i + 8);  // Read input 17-24 from the second input module (pins 8-15)<br />
    if (inputState) {<br />
      pcf8575_IN2.write(i, HIGH);  // If input is HIGH, turn the corresponding relay OFF (1-8)<br />
    } else {<br />
      pcf8575_IN2.write(i, LOW); &nbsp;&nbsp;// If input is LOW, turn the corresponding relay ON (1-8)<br />
    }<br />
  }<br />
<br />
  // Delay for 500 milliseconds<br />
  delay(500);<br />
}</code></div></div> arduino ino file download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=6536" target="_blank" title="">11-input-trigger-output.zip</a> (Size: 1.11 KB / Downloads: 497)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 *<br />
 * This program reads 24 input states from two PCF8575 I/O expanders and <br />
 * controls a corresponding 24-channel relay module. <br />
 * When an input pin is LOW, the corresponding relay is turned ON (LOW means ON for the relay).<br />
 * When the input pin is HIGH, the corresponding relay is turned OFF.<br />
 *<br />
 * Pin Definitions:<br />
 * - SDA: GPIO 8<br />
 * - SCL: GPIO 18<br />
 * - Input I2C Address 1 (inputs 1-16): 0x24<br />
 * - Input/Relay I2C Address 2 (inputs 17-24 and relays 1-8): 0x26<br />
 * - Relay I2C Address 3 (relays 9-24): 0x25<br />
 */<br />
<br />
#include &lt;Wire.h&gt;        // I2C communication<br />
#include &lt;PCF8575.h&gt;   &nbsp;&nbsp;// Library to control the PCF8575 I/O expander<br />
<br />
// Define I2C pins<br />
#define SDA 8            // SDA pin<br />
#define SCL 18         &nbsp;&nbsp;// SCL pin<br />
<br />
// I2C addresses for the PCF8575 modules<br />
#define INPUT_I2C_ADDRESS_1 0x24 &nbsp;&nbsp;// I2C address for the first input PCF8575 module (inputs 1-16)<br />
#define INPUT_RELAY_I2C_ADDRESS_2 0x26 &nbsp;&nbsp;// I2C address for inputs 17-24 and relays 1-8<br />
#define RELAY_I2C_ADDRESS_3 0x25 &nbsp;&nbsp;// I2C address for relays 9-24<br />
<br />
PCF8575 pcf8575_IN1(INPUT_I2C_ADDRESS_1);    // Create an object for the first input PCF8575 (inputs 1-16)<br />
PCF8575 pcf8575_IN2(INPUT_RELAY_I2C_ADDRESS_2);    // Create an object for the second input PCF8575 (inputs 17-24 and relays 1-8)<br />
PCF8575 pcf8575_RL(RELAY_I2C_ADDRESS_3);    // Create an object for the relay PCF8575 (relays 9-24)<br />
<br />
void setup() {<br />
  // Initialize I2C communication<br />
  Wire.begin(SDA, SCL);<br />
  <br />
  // Initialize serial communication<br />
  Serial.begin(115200);<br />
  <br />
  // Initialize input and relay modules<br />
  pcf8575_IN1.begin();  // For inputs 1-16<br />
  pcf8575_IN2.begin();  // For inputs 17-24 and relays 1-8<br />
  pcf8575_RL.begin(); &nbsp;&nbsp;// For relays 9-24<br />
  <br />
  // Turn off all relays at the start (LOW means OFF)<br />
  for (int i = 0; i &lt; 8; i++) {<br />
    pcf8575_IN2.write(i, LOW);  // Turn off relays 1-8<br />
  }<br />
  for (int i = 0; i &lt; 16; i++) {<br />
    pcf8575_RL.write(i, LOW);  // Turn off relays 9-24<br />
  }<br />
<br />
  Serial.println("System started: Input state controlling 24 relays");<br />
}<br />
<br />
void loop() {<br />
  // Read and control relays 1-16<br />
  for (int i = 0; i &lt; 16; i++) {<br />
    bool inputState = pcf8575_IN1.read(i);  // Read input i from the first input module<br />
    if (inputState) {<br />
      pcf8575_RL.write(i, HIGH);  // If input is HIGH, turn the corresponding relay OFF<br />
    } else {<br />
      pcf8575_RL.write(i, LOW); &nbsp;&nbsp;// If input is LOW, turn the corresponding relay ON<br />
    }<br />
  }<br />
<br />
  // Read and control relays 17-24 (shared with second input module)<br />
  for (int i = 0; i &lt; 8; i++) {<br />
    bool inputState = pcf8575_IN2.read(i + 8);  // Read input 17-24 from the second input module (pins 8-15)<br />
    if (inputState) {<br />
      pcf8575_IN2.write(i, HIGH);  // If input is HIGH, turn the corresponding relay OFF (1-8)<br />
    } else {<br />
      pcf8575_IN2.write(i, LOW); &nbsp;&nbsp;// If input is LOW, turn the corresponding relay ON (1-8)<br />
    }<br />
  }<br />
<br />
  // Delay for 500 milliseconds<br />
  delay(500);<br />
}</code></div></div> arduino ino file download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=6536" target="_blank" title="">11-input-trigger-output.zip</a> (Size: 1.11 KB / Downloads: 497)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[arduino code examples for F24]-10 Print TEXT on SSD1306 OLED displayer]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=7142</link>
			<pubDate>Thu, 28 Nov 2024 19:50:29 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=7142</guid>
			<description><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 * <br />
 * This Arduino program demonstrates how to display text on an SSD1306 128x64 OLED display using the U8g2 library.<br />
 * The program draws two lines of text on the display:<br />
 * - The first line is "KINCONY" in a larger font.<br />
 * - The second line is "www.kincony.com" in a smaller font.<br />
 * <br />
 * The display is connected via I2C (software implementation) with:<br />
 * - SCL (clock) on pin IO18<br />
 * - SDA (data) on pin IO8<br />
 * <br />
 * The display's I2C address is set to 0x3C.<br />
 */<br />
<br />
#include &lt;U8g2lib.h&gt;  // Include the U8g2 library for controlling the OLED display<br />
#include &lt;Wire.h&gt;   &nbsp;&nbsp;// Include the Wire library for I2C communication<br />
<br />
// Initialize the display using the software I2C method (SCL = IO18, SDA = IO8)<br />
U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0,  18, 8, U8X8_PIN_NONE);  // Screen rotation: U8G2_R0<br />
<br />
// Function to display page 1 content<br />
void page1() {<br />
  // Set font size 18 for the larger "KINCONY" text<br />
  u8g2.setFont(u8g2_font_timR18_tf);  // Use the Times Roman font, size 18<br />
  u8g2.setFontPosTop();             &nbsp;&nbsp;// Set the text position at the top of the display<br />
  u8g2.setCursor(5, 0);             &nbsp;&nbsp;// Position the cursor at coordinates (5, 0)<br />
  u8g2.print("KINCONY");              // Display the text "KINCONY" on the screen<br />
<br />
  // Set font size 12 for the smaller "www.kincony.com" text<br />
  u8g2.setFont(u8g2_font_timR12_tf);  // Use the Times Roman font, size 12<br />
  u8g2.setCursor(0, 40);              // Position the cursor at coordinates (0, 40)<br />
  u8g2.print("www.kincony.com");      // Display the text "www.kincony.com"<br />
}<br />
<br />
// Setup function, runs once when the program starts<br />
void setup() {<br />
  // Set the I2C address for the display to 0x3C<br />
  u8g2.setI2CAddress(0x3C*2);  // I2C address shift for 8-bit format<br />
  <br />
  // Initialize the display<br />
  u8g2.begin();<br />
  <br />
  // Enable UTF-8 character printing for the display<br />
  u8g2.enableUTF8Print();  // Allow UTF-8 encoded text to be printed<br />
}<br />
<br />
// Main loop function, continuously runs after setup()<br />
void loop() {<br />
  // Begin the display drawing process<br />
  u8g2.firstPage();  // Prepare the first page for drawing<br />
  do {<br />
    // Call the page1() function to draw content on the display<br />
    page1();<br />
  } while (u8g2.nextPage());  // Continue to the next page until all pages are drawn<br />
}</code></div></div> arduino ino file download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=6535" target="_blank" title="">10-oled-ssd1306.zip</a> (Size: 1.11 KB / Downloads: 505)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 * <br />
 * This Arduino program demonstrates how to display text on an SSD1306 128x64 OLED display using the U8g2 library.<br />
 * The program draws two lines of text on the display:<br />
 * - The first line is "KINCONY" in a larger font.<br />
 * - The second line is "www.kincony.com" in a smaller font.<br />
 * <br />
 * The display is connected via I2C (software implementation) with:<br />
 * - SCL (clock) on pin IO18<br />
 * - SDA (data) on pin IO8<br />
 * <br />
 * The display's I2C address is set to 0x3C.<br />
 */<br />
<br />
#include &lt;U8g2lib.h&gt;  // Include the U8g2 library for controlling the OLED display<br />
#include &lt;Wire.h&gt;   &nbsp;&nbsp;// Include the Wire library for I2C communication<br />
<br />
// Initialize the display using the software I2C method (SCL = IO18, SDA = IO8)<br />
U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0,  18, 8, U8X8_PIN_NONE);  // Screen rotation: U8G2_R0<br />
<br />
// Function to display page 1 content<br />
void page1() {<br />
  // Set font size 18 for the larger "KINCONY" text<br />
  u8g2.setFont(u8g2_font_timR18_tf);  // Use the Times Roman font, size 18<br />
  u8g2.setFontPosTop();             &nbsp;&nbsp;// Set the text position at the top of the display<br />
  u8g2.setCursor(5, 0);             &nbsp;&nbsp;// Position the cursor at coordinates (5, 0)<br />
  u8g2.print("KINCONY");              // Display the text "KINCONY" on the screen<br />
<br />
  // Set font size 12 for the smaller "www.kincony.com" text<br />
  u8g2.setFont(u8g2_font_timR12_tf);  // Use the Times Roman font, size 12<br />
  u8g2.setCursor(0, 40);              // Position the cursor at coordinates (0, 40)<br />
  u8g2.print("www.kincony.com");      // Display the text "www.kincony.com"<br />
}<br />
<br />
// Setup function, runs once when the program starts<br />
void setup() {<br />
  // Set the I2C address for the display to 0x3C<br />
  u8g2.setI2CAddress(0x3C*2);  // I2C address shift for 8-bit format<br />
  <br />
  // Initialize the display<br />
  u8g2.begin();<br />
  <br />
  // Enable UTF-8 character printing for the display<br />
  u8g2.enableUTF8Print();  // Allow UTF-8 encoded text to be printed<br />
}<br />
<br />
// Main loop function, continuously runs after setup()<br />
void loop() {<br />
  // Begin the display drawing process<br />
  u8g2.firstPage();  // Prepare the first page for drawing<br />
  do {<br />
    // Call the page1() function to draw content on the display<br />
    page1();<br />
  } while (u8g2.nextPage());  // Continue to the next page until all pages are drawn<br />
}</code></div></div> arduino ino file download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=6535" target="_blank" title="">10-oled-ssd1306.zip</a> (Size: 1.11 KB / Downloads: 505)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[arduino code examples for F24]-09 how to communication with Tuya WiFi module]]></title>
			<link>https://www.kincony.com/forum/showthread.php?tid=7141</link>
			<pubDate>Thu, 28 Nov 2024 19:49:35 +0800</pubDate>
			<dc:creator><![CDATA[<a href="https://www.kincony.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.kincony.com/forum/showthread.php?tid=7141</guid>
			<description><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 * <br />
 * This Arduino program implements communication between ESP32 and the Tuya module<br />
 * via UART (serial communication). It listens for specific packets from the Tuya module<br />
 * and responds according to the predefined commands.<br />
 * <br />
 * Functionality:<br />
 * 1. When the ESP32 receives a heartbeat packet (55 AA 00 00 00 00 FF),<br />
 *    it sends a heartbeat response (55 AA 03 00 00 01 00 03).<br />
 * 2. When the ESP32 receives a product information request (55 AA 00 01 00 00 00),<br />
 *    it sends a product information response (55 AA 03 01 ...).<br />
 * 3. When the ESP32 receives a work mode request (55 AA 00 02 00 00 01),<br />
 *    it sends a work mode response (55 AA 03 02 00 03 10 1C 14 47).<br />
 * 4. When the ESP32 receives a network status request (55 AA 00 03 00 01 00 03),<br />
 *    it sends a network status response (55 AA 03 03 00 00 05).<br />
 * 5. Subsequent heartbeat packets (55 AA 00 00 00 00 FF) are responded to with<br />
 *    (55 AA 03 00 00 01 01 04).<br />
 */<br />
<br />
#include &lt;HardwareSerial.h&gt;<br />
<br />
// Create a HardwareSerial object for UART communication on ESP32<br />
HardwareSerial tuyaSerial(1);<br />
<br />
// Define the GPIO pins for TXD and RXD used for serial communication<br />
#define TXD_PIN 39<br />
#define RXD_PIN 38<br />
<br />
// Set the baud rate for Tuya module communication to 9600<br />
#define BAUD_RATE 9600<br />
<br />
// Define the response packets for different commands from the Tuya module<br />
<br />
// Heartbeat response: 55 AA 03 00 00 01 00 03<br />
uint8_t heartBeatResponse[] = {0x55, 0xAA, 0x03, 0x00, 0x00, 0x01, 0x00, 0x03};<br />
<br />
// Product info response with a detailed payload (e.g., firmware version, product name, etc.)<br />
uint8_t productInfoResponse[] = {<br />
  0x55, 0xAA, 0x03, 0x01, 0x00, 0x2A, 0x7B, 0x22, 0x70, 0x22, 0x3A, 0x22, <br />
  0x63, 0x68, 0x6D, 0x7A, 0x6C, 0x67, 0x6A, 0x70, 0x61, 0x64, 0x70, 0x71, <br />
  0x78, 0x64, 0x6B, 0x6F, 0x22, 0x2C, 0x22, 0x76, 0x22, 0x3A, 0x22, 0x31, <br />
  0x2E, 0x30, 0x2E, 0x30, 0x22, 0x2C, 0x22, 0x6D, 0x22, 0x3A, 0x30, 0x7D, 0xAA<br />
};<br />
<br />
// Work mode response: 55 AA 03 02 00 03 10 1C 14 47<br />
uint8_t workModeResponse[] = {0x55, 0xAA, 0x03, 0x02, 0x00, 0x03, 0x10, 0x1C, 0x14, 0x47};<br />
<br />
// Network status response: 55 AA 03 03 00 00 05<br />
uint8_t netStatusResponse[] = {0x55, 0xAA, 0x03, 0x03, 0x00, 0x00, 0x05};<br />
<br />
// Subsequent heartbeat response: 55 AA 03 00 00 01 01 04<br />
uint8_t secondHeartBeatResponse[] = {0x55, 0xAA, 0x03, 0x00, 0x00, 0x01, 0x01, 0x04};<br />
<br />
void setup() {<br />
  // Initialize the serial communication for debugging at 115200 baud rate<br />
  Serial.begin(115200);<br />
<br />
  // Initialize the serial communication with Tuya module at 9600 baud rate<br />
  tuyaSerial.begin(BAUD_RATE, SERIAL_8N1, RXD_PIN, TXD_PIN);<br />
<br />
  // Debug message to indicate that the serial communication has been initialized<br />
  Serial.println("ESP32-Tuya serial communication initialized.");<br />
}<br />
<br />
void loop() {<br />
  // Check if data is available from the Tuya module<br />
  if (tuyaSerial.available()) {<br />
    uint8_t incomingPacket[7];  // Array to store the received packet<br />
    size_t bytesRead = tuyaSerial.readBytes(incomingPacket, 7); // Read 7 bytes from Tuya<br />
<br />
    // Check if the packet has a valid header (0x55, 0xAA)<br />
    if (bytesRead &gt;= 2 &amp;&amp; incomingPacket[0] == 0x55 &amp;&amp; incomingPacket[1] == 0xAA) {<br />
      // If less than 7 bytes were received, wait for more data<br />
      if (bytesRead &lt; 7) {<br />
        Serial.println("Incomplete packet received. Waiting for remaining bytes...");<br />
        delay(50); // Delay to allow more data to be received<br />
        while (tuyaSerial.available()) {<br />
          incomingPacket[bytesRead++] = tuyaSerial.read(); // Continue reading remaining bytes<br />
          if (bytesRead &gt;= 7) break;<br />
        }<br />
      }<br />
<br />
      // If still less than 7 bytes, discard the incomplete packet<br />
      if (bytesRead &lt; 7) {<br />
        Serial.println("Error: Incomplete packet discarded.");<br />
        return;<br />
      }<br />
<br />
      // Debug: Print the received packet for logging<br />
      Serial.print("Received packet: ");<br />
      for (size_t i = 0; i &lt; 7; i++) {<br />
        Serial.print(incomingPacket[i], HEX);<br />
        Serial.print(" ");<br />
      }<br />
      Serial.println();<br />
<br />
      // Call the function to process the received packet<br />
      processTuyaPacket(incomingPacket, 7);<br />
<br />
    } else {<br />
      // If the header is invalid, discard the packet and flush the buffer<br />
      Serial.print("Error: Invalid packet header. Data received: ");<br />
      for (size_t i = 0; i &lt; bytesRead; i++) {<br />
        Serial.print(incomingPacket[i], HEX);<br />
        Serial.print(" ");<br />
      }<br />
      Serial.println();<br />
      tuyaSerial.flush(); // Clear the serial buffer<br />
    }<br />
  }<br />
<br />
  // Delay to avoid CPU overuse<br />
  delay(100);<br />
}<br />
<br />
// Function to process the received packet and send the appropriate response<br />
void processTuyaPacket(uint8_t* packet, size_t size) {<br />
  // Ensure the packet size is 7 and the header is valid<br />
  if (size == 7 &amp;&amp; packet[0] == 0x55 &amp;&amp; packet[1] == 0xAA) {<br />
    // Determine the command in the packet (packet[2])<br />
    switch(packet[2]) {<br />
      case 0x00:<br />
        if (packet[3] == 0x00 &amp;&amp; packet[4] == 0x00 &amp;&amp; packet[5] == 0x00 &amp;&amp; packet[6] == 0xFF) {<br />
          Serial.println("Heartbeat received.");<br />
          sendPacket(heartBeatResponse, sizeof(heartBeatResponse));<br />
        } else if (packet[3] == 0x01 &amp;&amp; packet[4] == 0x00 &amp;&amp; packet[5] == 0x00 &amp;&amp; packet[6] == 0x00) {<br />
          Serial.println("Product info request received.");<br />
          sendPacket(productInfoResponse, sizeof(productInfoResponse));<br />
        } else if (packet[3] == 0x02 &amp;&amp; packet[4] == 0x00 &amp;&amp; packet[5] == 0x00 &amp;&amp; packet[6] == 0x01) {<br />
          Serial.println("Work mode request received.");<br />
          sendPacket(workModeResponse, sizeof(workModeResponse));<br />
        } else if (packet[3] == 0x03 &amp;&amp; packet[4] == 0x00 &amp;&amp; packet[5] == 0x01 &amp;&amp; packet[6] == 0x00) {<br />
          Serial.println("Network status request received.");<br />
          sendPacket(netStatusResponse, sizeof(netStatusResponse));<br />
        }<br />
        break;<br />
<br />
      default:<br />
        Serial.println("Error: Unhandled command received.");<br />
        break;<br />
    }<br />
  }<br />
}<br />
<br />
// Function to send the response packet to the Tuya module<br />
void sendPacket(uint8_t* packet, size_t size) {<br />
  // Send the packet via UART to Tuya module<br />
  tuyaSerial.write(packet, size);<br />
<br />
  // Debug: Print the sent packet for logging<br />
  Serial.print("Sent packet: ");<br />
  for (size_t i = 0; i &lt; size; i++) {<br />
    Serial.print(packet[i], HEX);<br />
    Serial.print(" ");<br />
  }<br />
  Serial.println();<br />
}</code></div></div> arduino ino file download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=6534" target="_blank" title="">9-tuya-wifi-config.zip</a> (Size: 2 KB / Downloads: 518)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/*<br />
 * Made by KinCony IoT: https://www.kincony.com<br />
 * <br />
 * This Arduino program implements communication between ESP32 and the Tuya module<br />
 * via UART (serial communication). It listens for specific packets from the Tuya module<br />
 * and responds according to the predefined commands.<br />
 * <br />
 * Functionality:<br />
 * 1. When the ESP32 receives a heartbeat packet (55 AA 00 00 00 00 FF),<br />
 *    it sends a heartbeat response (55 AA 03 00 00 01 00 03).<br />
 * 2. When the ESP32 receives a product information request (55 AA 00 01 00 00 00),<br />
 *    it sends a product information response (55 AA 03 01 ...).<br />
 * 3. When the ESP32 receives a work mode request (55 AA 00 02 00 00 01),<br />
 *    it sends a work mode response (55 AA 03 02 00 03 10 1C 14 47).<br />
 * 4. When the ESP32 receives a network status request (55 AA 00 03 00 01 00 03),<br />
 *    it sends a network status response (55 AA 03 03 00 00 05).<br />
 * 5. Subsequent heartbeat packets (55 AA 00 00 00 00 FF) are responded to with<br />
 *    (55 AA 03 00 00 01 01 04).<br />
 */<br />
<br />
#include &lt;HardwareSerial.h&gt;<br />
<br />
// Create a HardwareSerial object for UART communication on ESP32<br />
HardwareSerial tuyaSerial(1);<br />
<br />
// Define the GPIO pins for TXD and RXD used for serial communication<br />
#define TXD_PIN 39<br />
#define RXD_PIN 38<br />
<br />
// Set the baud rate for Tuya module communication to 9600<br />
#define BAUD_RATE 9600<br />
<br />
// Define the response packets for different commands from the Tuya module<br />
<br />
// Heartbeat response: 55 AA 03 00 00 01 00 03<br />
uint8_t heartBeatResponse[] = {0x55, 0xAA, 0x03, 0x00, 0x00, 0x01, 0x00, 0x03};<br />
<br />
// Product info response with a detailed payload (e.g., firmware version, product name, etc.)<br />
uint8_t productInfoResponse[] = {<br />
  0x55, 0xAA, 0x03, 0x01, 0x00, 0x2A, 0x7B, 0x22, 0x70, 0x22, 0x3A, 0x22, <br />
  0x63, 0x68, 0x6D, 0x7A, 0x6C, 0x67, 0x6A, 0x70, 0x61, 0x64, 0x70, 0x71, <br />
  0x78, 0x64, 0x6B, 0x6F, 0x22, 0x2C, 0x22, 0x76, 0x22, 0x3A, 0x22, 0x31, <br />
  0x2E, 0x30, 0x2E, 0x30, 0x22, 0x2C, 0x22, 0x6D, 0x22, 0x3A, 0x30, 0x7D, 0xAA<br />
};<br />
<br />
// Work mode response: 55 AA 03 02 00 03 10 1C 14 47<br />
uint8_t workModeResponse[] = {0x55, 0xAA, 0x03, 0x02, 0x00, 0x03, 0x10, 0x1C, 0x14, 0x47};<br />
<br />
// Network status response: 55 AA 03 03 00 00 05<br />
uint8_t netStatusResponse[] = {0x55, 0xAA, 0x03, 0x03, 0x00, 0x00, 0x05};<br />
<br />
// Subsequent heartbeat response: 55 AA 03 00 00 01 01 04<br />
uint8_t secondHeartBeatResponse[] = {0x55, 0xAA, 0x03, 0x00, 0x00, 0x01, 0x01, 0x04};<br />
<br />
void setup() {<br />
  // Initialize the serial communication for debugging at 115200 baud rate<br />
  Serial.begin(115200);<br />
<br />
  // Initialize the serial communication with Tuya module at 9600 baud rate<br />
  tuyaSerial.begin(BAUD_RATE, SERIAL_8N1, RXD_PIN, TXD_PIN);<br />
<br />
  // Debug message to indicate that the serial communication has been initialized<br />
  Serial.println("ESP32-Tuya serial communication initialized.");<br />
}<br />
<br />
void loop() {<br />
  // Check if data is available from the Tuya module<br />
  if (tuyaSerial.available()) {<br />
    uint8_t incomingPacket[7];  // Array to store the received packet<br />
    size_t bytesRead = tuyaSerial.readBytes(incomingPacket, 7); // Read 7 bytes from Tuya<br />
<br />
    // Check if the packet has a valid header (0x55, 0xAA)<br />
    if (bytesRead &gt;= 2 &amp;&amp; incomingPacket[0] == 0x55 &amp;&amp; incomingPacket[1] == 0xAA) {<br />
      // If less than 7 bytes were received, wait for more data<br />
      if (bytesRead &lt; 7) {<br />
        Serial.println("Incomplete packet received. Waiting for remaining bytes...");<br />
        delay(50); // Delay to allow more data to be received<br />
        while (tuyaSerial.available()) {<br />
          incomingPacket[bytesRead++] = tuyaSerial.read(); // Continue reading remaining bytes<br />
          if (bytesRead &gt;= 7) break;<br />
        }<br />
      }<br />
<br />
      // If still less than 7 bytes, discard the incomplete packet<br />
      if (bytesRead &lt; 7) {<br />
        Serial.println("Error: Incomplete packet discarded.");<br />
        return;<br />
      }<br />
<br />
      // Debug: Print the received packet for logging<br />
      Serial.print("Received packet: ");<br />
      for (size_t i = 0; i &lt; 7; i++) {<br />
        Serial.print(incomingPacket[i], HEX);<br />
        Serial.print(" ");<br />
      }<br />
      Serial.println();<br />
<br />
      // Call the function to process the received packet<br />
      processTuyaPacket(incomingPacket, 7);<br />
<br />
    } else {<br />
      // If the header is invalid, discard the packet and flush the buffer<br />
      Serial.print("Error: Invalid packet header. Data received: ");<br />
      for (size_t i = 0; i &lt; bytesRead; i++) {<br />
        Serial.print(incomingPacket[i], HEX);<br />
        Serial.print(" ");<br />
      }<br />
      Serial.println();<br />
      tuyaSerial.flush(); // Clear the serial buffer<br />
    }<br />
  }<br />
<br />
  // Delay to avoid CPU overuse<br />
  delay(100);<br />
}<br />
<br />
// Function to process the received packet and send the appropriate response<br />
void processTuyaPacket(uint8_t* packet, size_t size) {<br />
  // Ensure the packet size is 7 and the header is valid<br />
  if (size == 7 &amp;&amp; packet[0] == 0x55 &amp;&amp; packet[1] == 0xAA) {<br />
    // Determine the command in the packet (packet[2])<br />
    switch(packet[2]) {<br />
      case 0x00:<br />
        if (packet[3] == 0x00 &amp;&amp; packet[4] == 0x00 &amp;&amp; packet[5] == 0x00 &amp;&amp; packet[6] == 0xFF) {<br />
          Serial.println("Heartbeat received.");<br />
          sendPacket(heartBeatResponse, sizeof(heartBeatResponse));<br />
        } else if (packet[3] == 0x01 &amp;&amp; packet[4] == 0x00 &amp;&amp; packet[5] == 0x00 &amp;&amp; packet[6] == 0x00) {<br />
          Serial.println("Product info request received.");<br />
          sendPacket(productInfoResponse, sizeof(productInfoResponse));<br />
        } else if (packet[3] == 0x02 &amp;&amp; packet[4] == 0x00 &amp;&amp; packet[5] == 0x00 &amp;&amp; packet[6] == 0x01) {<br />
          Serial.println("Work mode request received.");<br />
          sendPacket(workModeResponse, sizeof(workModeResponse));<br />
        } else if (packet[3] == 0x03 &amp;&amp; packet[4] == 0x00 &amp;&amp; packet[5] == 0x01 &amp;&amp; packet[6] == 0x00) {<br />
          Serial.println("Network status request received.");<br />
          sendPacket(netStatusResponse, sizeof(netStatusResponse));<br />
        }<br />
        break;<br />
<br />
      default:<br />
        Serial.println("Error: Unhandled command received.");<br />
        break;<br />
    }<br />
  }<br />
}<br />
<br />
// Function to send the response packet to the Tuya module<br />
void sendPacket(uint8_t* packet, size_t size) {<br />
  // Send the packet via UART to Tuya module<br />
  tuyaSerial.write(packet, size);<br />
<br />
  // Debug: Print the sent packet for logging<br />
  Serial.print("Sent packet: ");<br />
  for (size_t i = 0; i &lt; size; i++) {<br />
    Serial.print(packet[i], HEX);<br />
    Serial.print(" ");<br />
  }<br />
  Serial.println();<br />
}</code></div></div> arduino ino file download:  <br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.kincony.com/forum/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=6534" target="_blank" title="">9-tuya-wifi-config.zip</a> (Size: 2 KB / Downloads: 518)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
	</channel>
</rss>