Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 8,049
» Latest member: HolyKirka
» Forum threads: 3,552
» Forum posts: 18,211

Full Statistics

Online Users
There are currently 44 online users.
» 0 Member(s) | 27 Guest(s)
AhrefsBot, Amazonbot, Crawl, Google, PetalBot, bot, help@dataminr.com, owler

Latest Threads
N30+KCS v3.15.0
Forum: "KCS" v3 firmware
Last Post: HolyKirka
1 hour ago
» Replies: 2
» Views: 12
N30 + KCS v3.15.0 firmwar...
Forum: N30
Last Post: HolyKirka
1 hour ago
» Replies: 2
» Views: 6
KC868-A6 case 3D model
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
2 hours ago
» Replies: 3
» Views: 9
KC868-A8V3 and ESPHome fi...
Forum: KC868-HxB series Smart Controller
Last Post: admin
3 hours ago
» Replies: 1
» Views: 9
KinCony E16v3 RS485 Din R...
Forum: News
Last Post: admin
Today, 12:17 AM
» Replies: 0
» Views: 9
KC868-E16T added Tuya mod...
Forum: KC868-E16T
Last Post: admin
Yesterday, 10:27 PM
» Replies: 2
» Views: 289
Input and output on same ...
Forum: KC868-HxB series Smart Controller
Last Post: admin
Yesterday, 10:26 PM
» Replies: 5
» Views: 24
Using 24VAC with KC868-A1...
Forum: KC868-HxB series Smart Controller
Last Post: admin
Yesterday, 10:40 AM
» Replies: 3
» Views: 71
Z1 Transmit action from. ...
Forum: KC868-AG / AG Pro / AG8 / Z1
Last Post: admin
11-10-2025, 11:41 PM
» Replies: 10
» Views: 241
kc868-server16
Forum: KC868-Server Raspberry Pi4 local server
Last Post: fdcemb5
11-10-2025, 03:52 AM
» Replies: 4
» Views: 115

  [arduino code examples for B24M]-01 Turn ON/OFF OUTPUT
Posted by: admin - 07-31-2025, 06:54 AM - Forum: B24M - No Replies

Code:
/*
* Made by KinCony IoT: https://www.kincony.com
*
* This program controls a 24-channel relay board via two PCF8575 I/O expanders.
* It sequentially turns on each relay and then turns them off in a loop.
*
* Pin Definitions:
* - SDA: GPIO 8
* - SCL: GPIO 18
*
* Delay Time:
* - 200 milliseconds between switching relays
*/

#include <Wire.h>        // Include the Wire library for I2C communication
#include <PCF8575.h>     // Include the PCF8575 library to control the I/O expander

#define SDA 8            // Define the SDA pin
#define SCL 18           // Define the SCL pin
#define DELAY_TIME 200   // Define the delay time in milliseconds

// Set I2C addresses of the PCF8575 modules
#define I2C_ADDRESS_R1 0x25 // I2C address of the first PCF8575 module
#define I2C_ADDRESS_R2 0x24 // I2C address of the second PCF8575 module

PCF8575 pcf8575_R1(I2C_ADDRESS_R1); // Create a PCF8575 object for the first module (for relays 9-24)
PCF8575 pcf8575_R2(I2C_ADDRESS_R2); // Create a PCF8575 object for the second module (for relays 1-8)

void setup() {
  // Initialize I2C communication
  Wire.begin(SDA, SCL); // SDA on GPIO 8, SCL on GPIO 18 (according to your board's configuration)
 
  // Initialize serial communication for debugging (optional)
  Serial.begin(115200);
  Serial.println("PCF8575 Relay Control: Starting...");

  // Initialize the PCF8575 modules
  pcf8575_R1.begin();
  pcf8575_R2.begin();

  // Turn off all relays initially (set all pins HIGH)

  for (int i = 8; i < 16; i++) {
    pcf8575_R1.write(i, HIGH); // Set relays 1-8 to OFF (assuming HIGH means OFF for relays)
  }

  for (int i = 0; i < 16; i++) {
    pcf8575_R2.write(i, HIGH); // Set relays 9-24 to OFF (assuming HIGH means OFF for relays)
  }
}

void loop() {
  // Sequentially turn on each relay (1-24)
 
  // First control the relays on the second PCF8575 (relays 1-8)
  for (int i = 8; i < 16; i++) {
    pcf8575_R1.write(i, LOW);   // Turn on the relay at pin i (LOW means ON for the relay)
    delay(DELAY_TIME);          // Wait for DELAY_TIME milliseconds
  }

  // Then control the relays on the first PCF8575 (relays 9-24)
  for (int i = 0; i < 16; i++) {
    pcf8575_R2.write(i, LOW);   // Turn on the relay at pin i (LOW means ON for the relay)
    delay(DELAY_TIME);          // Wait for DELAY_TIME milliseconds
  }

  // Sequentially turn off each relay (1-24)
 
  // First control the relays on the second PCF8575 (relays 1-8)
  for (int i = 8; i < 16; i++) {
    pcf8575_R1.write(i, HIGH);  // Turn off the relay at pin i (HIGH means OFF for the relay)
    delay(DELAY_TIME);          // Wait for DELAY_TIME milliseconds
  }

  // Then control the relays on the first PCF8575 (relays 9-24)
  for (int i = 0; i < 16; i++) {
    pcf8575_R2.write(i, HIGH);  // Turn off the relay at pin i (HIGH means OFF for the relay)
    delay(DELAY_TIME);          // Wait for DELAY_TIME milliseconds
  }
}
arduino ino file download:

.zip   1-relay.zip (Size: 1.01 KB / Downloads: 197)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:

.zip   1-relay.ino.merged.zip (Size: 192.11 KB / Downloads: 187)

Print this item

  [arduino code examples for B24]-01 Turn ON/OFF OUTPUT
Posted by: admin - 07-31-2025, 06:54 AM - Forum: B24 - No Replies

Code:
/*
* Made by KinCony IoT: https://www.kincony.com
*
* This program controls a 24-channel relay board via two PCF8575 I/O expanders.
* It sequentially turns on each relay and then turns them off in a loop.
*
* Pin Definitions:
* - SDA: GPIO 8
* - SCL: GPIO 18
*
* Delay Time:
* - 200 milliseconds between switching relays
*/

#include <Wire.h>        // Include the Wire library for I2C communication
#include <PCF8575.h>     // Include the PCF8575 library to control the I/O expander

#define SDA 8            // Define the SDA pin
#define SCL 18           // Define the SCL pin
#define DELAY_TIME 200   // Define the delay time in milliseconds

// Set I2C addresses of the PCF8575 modules
#define I2C_ADDRESS_R1 0x25 // I2C address of the first PCF8575 module
#define I2C_ADDRESS_R2 0x24 // I2C address of the second PCF8575 module

PCF8575 pcf8575_R1(I2C_ADDRESS_R1); // Create a PCF8575 object for the first module (for relays 9-24)
PCF8575 pcf8575_R2(I2C_ADDRESS_R2); // Create a PCF8575 object for the second module (for relays 1-8)

void setup() {
  // Initialize I2C communication
  Wire.begin(SDA, SCL); // SDA on GPIO 8, SCL on GPIO 18 (according to your board's configuration)
 
  // Initialize serial communication for debugging (optional)
  Serial.begin(115200);
  Serial.println("PCF8575 Relay Control: Starting...");

  // Initialize the PCF8575 modules
  pcf8575_R1.begin();
  pcf8575_R2.begin();

  // Turn off all relays initially (set all pins HIGH)

  for (int i = 8; i < 16; i++) {
    pcf8575_R1.write(i, HIGH); // Set relays 1-8 to OFF (assuming HIGH means OFF for relays)
  }

  for (int i = 0; i < 16; i++) {
    pcf8575_R2.write(i, HIGH); // Set relays 9-24 to OFF (assuming HIGH means OFF for relays)
  }
}

void loop() {
  // Sequentially turn on each relay (1-24)
 
  // First control the relays on the second PCF8575 (relays 1-8)
  for (int i = 8; i < 16; i++) {
    pcf8575_R1.write(i, LOW);   // Turn on the relay at pin i (LOW means ON for the relay)
    delay(DELAY_TIME);          // Wait for DELAY_TIME milliseconds
  }

  // Then control the relays on the first PCF8575 (relays 9-24)
  for (int i = 0; i < 16; i++) {
    pcf8575_R2.write(i, LOW);   // Turn on the relay at pin i (LOW means ON for the relay)
    delay(DELAY_TIME);          // Wait for DELAY_TIME milliseconds
  }

  // Sequentially turn off each relay (1-24)
 
  // First control the relays on the second PCF8575 (relays 1-8)
  for (int i = 8; i < 16; i++) {
    pcf8575_R1.write(i, HIGH);  // Turn off the relay at pin i (HIGH means OFF for the relay)
    delay(DELAY_TIME);          // Wait for DELAY_TIME milliseconds
  }

  // Then control the relays on the first PCF8575 (relays 9-24)
  for (int i = 0; i < 16; i++) {
    pcf8575_R2.write(i, HIGH);  // Turn off the relay at pin i (HIGH means OFF for the relay)
    delay(DELAY_TIME);          // Wait for DELAY_TIME milliseconds
  }
}
arduino ino file download:

.zip   1-relay.zip (Size: 1.01 KB / Downloads: 175)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:

.zip   1-relay.ino.merged.zip (Size: 192.11 KB / Downloads: 182)

Print this item

  B24M ESPHome yaml for home assistant without tuya
Posted by: admin - 07-31-2025, 06:52 AM - Forum: B24M - No Replies

Code:
esphome:
  name: b24
  friendly_name: b24

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

ethernet:
  type: W5500
  clk_pin: GPIO1
  mosi_pin: GPIO2
  miso_pin: GPIO41
  cs_pin: GPIO42
  interrupt_pin: GPIO43
  reset_pin: GPIO44

uart:
  - id: uart_1    #RS485
    baud_rate: 9600
    debug:
      direction: BOTH
      dummy_receiver: true
      after:
        timeout: 10ms
    tx_pin: 39
    rx_pin: 38

i2c:
   - id: bus_a
     sda: 8
     scl: 18
     scan: true
     frequency: 400kHz

pcf8574:
  - id: 'pcf8574_hub_in_1'  # for input channel 1-16
    i2c_id: bus_a
    address: 0x22
    pcf8575: true

  - id: 'pcf8574_hub_in_out_1'  # for digital input channel 17-24 & ouptut 1-8
    i2c_id: bus_a
    address: 0x25
    pcf8575: true

  - id: 'pcf8574_hub_out_1'  # for output channel 9-24
    i2c_id: bus_a
    address: 0x24
    pcf8575: true

binary_sensor:
  - platform: gpio
    name: "b24-input01"
    id: "b24_input01"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 8
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input02"
    id: "b24_input02"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 9
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input03"
    id: "b24_input03"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 10
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input04"
    id: "b24_input04"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 11
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input05"
    id: "b24_input05"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 12
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input06"
    id: "b24_input06"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 13
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input07"
    id: "b24_input07"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 14
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input08"
    id: "b24_input08"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 15
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input09"
    id: "b24_input09"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 0
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input10"
    id: "b24_input10"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 1
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input11"
    id: "b24_input11"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 2
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input12"
    id: "b24_input12"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 3
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input13"
    id: "b24_input13"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 4
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input14"
    id: "b24_input14"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 5
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input15"
    id: "b24_input15"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 6
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input16"
    id: "b24_input16"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 7
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input17"
    id: "b24_input17"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 0
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input18"
    id: "b24_input18"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 1
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input19"
    id: "b24_input19"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 2
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input20"
    id: "b24_input20"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 3
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input21"
    id: "b24_input21"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 4
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input22"
    id: "b24_input22"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 5
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input23"
    id: "b24_input23"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 6
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input24"
    id: "b24_input24"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 7
      mode: INPUT
      inverted: true

##pull-up resistance on PCB
  - platform: gpio
    name: "b24-W1-io48"
    pin:
      number: 48
      inverted: true

  - platform: gpio
    name: "b24-W1-io47"
    pin:
      number: 47
      inverted: true

  - platform: gpio
    name: "b24-W1-io40"
    pin:
      number: 40
      inverted: true

  - platform: gpio
    name: "b24-W1-io7"
    pin:
      number: 7
      inverted: true
## without resistance on PCB
  - platform: gpio
    name: "b24-W1-io13"
    pin:
      number: 13
      inverted: false

  - platform: gpio
    name: "b24-W1-io14"
    pin:
      number: 14
      inverted:  false

  - platform: gpio
    name: "b24-W1-io21"
    pin:
      number: 21
      inverted:  false

  - platform: gpio
    name: "b24-W1-io0"
    pin:
      number: 0
      inverted:  false

switch:
  - platform: gpio
    name: "b24-output01"
    id: "b24_output01"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 8
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output02"
    id: "b24_output02"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 9
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output03"
    id: "b24_output03"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 10
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output04"
    id: "b24_output04"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 11
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output05"
    id: "b24_output05"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 12
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output06"
    id: "b24_output06"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 13
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output07"
    id: "b24_output07"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 14
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output08"
    id: "b24_output08"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 15
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output09"
    id: b24_output09
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 0
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output10"
    id: b24_output10
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 1
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output11"
    id: b24_output11
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 2
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output12"
    id: b24_output12
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 3
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output13"
    id: b24_output13
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 4
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output14"
    id: b24_output14
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 5
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output15"
    id: b24_output15
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 6
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output16"
    id: b24_output16
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 7
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output17"
    id: b24_output17
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 8
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output18"
    id: b24_output18
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 9
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output19"
    id: b24_output19
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 10
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output20"
    id: b24_output20
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 11
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output21"
    id: b24_output21
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 12
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output22"
    id: b24_output22
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 13
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output23"
    id: b24_output23
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 14
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output24"
    id: b24_output24
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 15
      mode: OUTPUT
      inverted: true

  - platform: uart
    uart_id: uart_1
    name: "RS485 Button"
    data: [0x11, 0x22, 0x33, 0x44, 0x55]

ads1115:
  - address: 0x48
sensor:
  - platform: ads1115
    multiplexer: 'A0_GND'
    gain: 6.144
    resolution: 16_BITS
    name: "ADS1115 Channel A0-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A1_GND'
    gain: 6.144
    name: "ADS1115 Channel A1-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A2_GND'
    gain: 6.144
    name: "ADS1115 Channel A2-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A3_GND'
    gain: 6.144
    name: "ADS1115 Channel A3-GND"
    update_interval: 5s

web_server:
  port: 80

font:
  - file: "gfonts://Roboto"
    id: roboto
    size: 20

display:
  - platform: ssd1306_i2c
    i2c_id: bus_a
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      it.printf(0, 0, id(roboto), "KinCony B24");
download yaml file:

.txt   B24-HA-without Tuya.txt (Size: 10.92 KB / Downloads: 91)

Print this item

  B24 ESPHome yaml for home assistant without tuya
Posted by: admin - 07-31-2025, 06:52 AM - Forum: B24 - No Replies

Code:
esphome:
  name: b24
  friendly_name: b24

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

ethernet:
  type: W5500
  clk_pin: GPIO1
  mosi_pin: GPIO2
  miso_pin: GPIO41
  cs_pin: GPIO42
  interrupt_pin: GPIO43
  reset_pin: GPIO44

uart:
  - id: uart_1    #RS485
    baud_rate: 9600
    debug:
      direction: BOTH
      dummy_receiver: true
      after:
        timeout: 10ms
    tx_pin: 39
    rx_pin: 38

i2c:
   - id: bus_a
     sda: 8
     scl: 18
     scan: true
     frequency: 400kHz

pcf8574:
  - id: 'pcf8574_hub_in_1'  # for input channel 1-16
    i2c_id: bus_a
    address: 0x22
    pcf8575: true

  - id: 'pcf8574_hub_in_out_1'  # for digital input channel 17-24 & ouptut 1-8
    i2c_id: bus_a
    address: 0x25
    pcf8575: true

  - id: 'pcf8574_hub_out_1'  # for output channel 9-24
    i2c_id: bus_a
    address: 0x24
    pcf8575: true

binary_sensor:
  - platform: gpio
    name: "b24-input01"
    id: "b24_input01"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 8
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input02"
    id: "b24_input02"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 9
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input03"
    id: "b24_input03"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 10
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input04"
    id: "b24_input04"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 11
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input05"
    id: "b24_input05"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 12
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input06"
    id: "b24_input06"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 13
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input07"
    id: "b24_input07"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 14
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input08"
    id: "b24_input08"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 15
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input09"
    id: "b24_input09"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 0
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input10"
    id: "b24_input10"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 1
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input11"
    id: "b24_input11"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 2
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input12"
    id: "b24_input12"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 3
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input13"
    id: "b24_input13"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 4
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input14"
    id: "b24_input14"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 5
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input15"
    id: "b24_input15"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 6
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "b24-input16"
    id: "b24_input16"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 7
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input17"
    id: "b24_input17"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 0
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input18"
    id: "b24_input18"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 1
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input19"
    id: "b24_input19"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 2
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input20"
    id: "b24_input20"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 3
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input21"
    id: "b24_input21"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 4
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input22"
    id: "b24_input22"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 5
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input23"
    id: "b24_input23"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 6
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b24-input24"
    id: "b24_input24"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 7
      mode: INPUT
      inverted: true

##pull-up resistance on PCB
  - platform: gpio
    name: "b24-W1-io48"
    pin:
      number: 48
      inverted: true

  - platform: gpio
    name: "b24-W1-io47"
    pin:
      number: 47
      inverted: true

  - platform: gpio
    name: "b24-W1-io40"
    pin:
      number: 40
      inverted: true

  - platform: gpio
    name: "b24-W1-io7"
    pin:
      number: 7
      inverted: true
## without resistance on PCB
  - platform: gpio
    name: "b24-W1-io13"
    pin:
      number: 13
      inverted: false

  - platform: gpio
    name: "b24-W1-io14"
    pin:
      number: 14
      inverted:  false

  - platform: gpio
    name: "b24-W1-io21"
    pin:
      number: 21
      inverted:  false

  - platform: gpio
    name: "b24-W1-io0"
    pin:
      number: 0
      inverted:  false

switch:
  - platform: gpio
    name: "b24-output01"
    id: "b24_output01"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 8
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output02"
    id: "b24_output02"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 9
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output03"
    id: "b24_output03"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 10
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output04"
    id: "b24_output04"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 11
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output05"
    id: "b24_output05"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 12
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output06"
    id: "b24_output06"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 13
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output07"
    id: "b24_output07"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 14
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output08"
    id: "b24_output08"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 15
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output09"
    id: b24_output09
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 0
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output10"
    id: b24_output10
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 1
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output11"
    id: b24_output11
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 2
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output12"
    id: b24_output12
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 3
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output13"
    id: b24_output13
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 4
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output14"
    id: b24_output14
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 5
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output15"
    id: b24_output15
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 6
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output16"
    id: b24_output16
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 7
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output17"
    id: b24_output17
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 8
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output18"
    id: b24_output18
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 9
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output19"
    id: b24_output19
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 10
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output20"
    id: b24_output20
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 11
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output21"
    id: b24_output21
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 12
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output22"
    id: b24_output22
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 13
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output23"
    id: b24_output23
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 14
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b24-output24"
    id: b24_output24
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 15
      mode: OUTPUT
      inverted: true

  - platform: uart
    uart_id: uart_1
    name: "RS485 Button"
    data: [0x11, 0x22, 0x33, 0x44, 0x55]

ads1115:
  - address: 0x48
sensor:
  - platform: ads1115
    multiplexer: 'A0_GND'
    gain: 6.144
    resolution: 16_BITS
    name: "ADS1115 Channel A0-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A1_GND'
    gain: 6.144
    name: "ADS1115 Channel A1-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A2_GND'
    gain: 6.144
    name: "ADS1115 Channel A2-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A3_GND'
    gain: 6.144
    name: "ADS1115 Channel A3-GND"
    update_interval: 5s

web_server:
  port: 80

font:
  - file: "gfonts://Roboto"
    id: roboto
    size: 20

display:
  - platform: ssd1306_i2c
    i2c_id: bus_a
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      it.printf(0, 0, id(roboto), "KinCony B24");
download yaml file:

.txt   B24-HA-without Tuya.txt (Size: 10.92 KB / Downloads: 80)

Print this item

  B24M ESPHome yaml for home assistant with tuya
Posted by: admin - 07-31-2025, 06:51 AM - Forum: B24M - No Replies

Code:
esphome:
  name: b24
  friendly_name: b24
  platformio_options:
    board_build.extra_flags:
      # WIFI_CONTROL_SELF_MODE = 0
      # WIFI_CONTROL_SELF_MODE = 1
      - "-DWIFI_CONTROL_SELF_MODE=1"

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

external_components:
  - source:
      type: git
      url: https://github.com/hzkincony/esphome-tuya-wifi-mcu
      ref: v1.1.0

# Enable logging
#logger:

# Enable Home Assistant API
api:

ethernet:
  type: W5500
  clk_pin: GPIO1
  mosi_pin: GPIO2
  miso_pin: GPIO41
  cs_pin: GPIO42
  interrupt_pin: GPIO43
  reset_pin: GPIO44

uart:
  - id: uart_1    #RS485
    baud_rate: 9600
    debug:
      direction: BOTH
      dummy_receiver: true
      after:
        timeout: 10ms
    tx_pin: 39
    rx_pin: 38

  - id: tuya_mcu_uart
    tx_pin: GPIO16
    rx_pin: GPIO17
    baud_rate: 9600

i2c:
   - id: bus_a
     sda: 8
     scl: 18
     scan: true
     frequency: 400kHz

pcf8574:
  - id: 'pcf8574_hub_in_1'  # for input channel 1-16
    i2c_id: bus_a
    address: 0x22
    pcf8575: true

  - id: 'pcf8574_hub_in_out_1'  # for digital input channel 17-24 & ouptut 1-8
    i2c_id: bus_a
    address: 0x25
    pcf8575: true

  - id: 'pcf8574_hub_out_1'  # for output channel 9-24
    i2c_id: bus_a
    address: 0x24
    pcf8575: true

tuya_wifi_mcu:
  # tuya mcu product id
  product_id: vyznobv3bahs2pwl
  uart_id: tuya_mcu_uart
  wifi_reset_pin: 28
  wifi_led_pin: 16

binary_sensor:
  - platform: gpio
    name: "b24-input01"
    id: "b24_input01"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 8
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input1-tuya
    dp_id: 125
    bind_binary_sensor_id: b24_input01
    internal: true

  - platform: gpio
    name: "b24-input02"
    id: "b24_input02"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 9
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input2-tuya
    dp_id: 126
    bind_binary_sensor_id: b24_input02
    internal: true

  - platform: gpio
    name: "b24-input03"
    id: "b24_input03"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 10
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input3-tuya
    dp_id: 127
    bind_binary_sensor_id: b24_input03
    internal: true

  - platform: gpio
    name: "b24-input04"
    id: "b24_input04"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 11
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input4-tuya
    dp_id: 128
    bind_binary_sensor_id: b24_input04
    internal: true

  - platform: gpio
    name: "b24-input05"
    id: "b24_input05"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 12
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input5-tuya
    dp_id: 129
    bind_binary_sensor_id: b24_input05
    internal: true

  - platform: gpio
    name: "b24-input06"
    id: "b24_input06"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 13
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input6-tuya
    dp_id: 130
    bind_binary_sensor_id: b24_input06
    internal: true

  - platform: gpio
    name: "b24-input07"
    id: "b24_input07"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 14
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input7-tuya
    dp_id: 131
    bind_binary_sensor_id: b24_input07
    internal: true

  - platform: gpio
    name: "b24-input08"
    id: "b24_input08"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 15
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input8-tuya
    dp_id: 132
    bind_binary_sensor_id: b24_input08
    internal: true

  - platform: gpio
    name: "b24-input09"
    id: "b24_input09"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 0
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input9-tuya
    dp_id: 133
    bind_binary_sensor_id: b24_input09
    internal: true

  - platform: gpio
    name: "b24-input10"
    id: "b24_input10"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 1
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input10-tuya
    dp_id: 134
    bind_binary_sensor_id: b24_input10
    internal: true

  - platform: gpio
    name: "b24-input11"
    id: "b24_input11"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 2
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input11-tuya
    dp_id: 135
    bind_binary_sensor_id: b24_input11
    internal: true

  - platform: gpio
    name: "b24-input12"
    id: "b24_input12"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 3
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input12-tuya
    dp_id: 136
    bind_binary_sensor_id: b24_input12
    internal: true

  - platform: gpio
    name: "b24-input13"
    id: "b24_input13"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 4
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input13-tuya
    dp_id: 137
    bind_binary_sensor_id: b24_input13
    internal: true

  - platform: gpio
    name: "b24-input14"
    id: "b24_input14"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 5
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input14-tuya
    dp_id: 138
    bind_binary_sensor_id: b24_input14
    internal: true

  - platform: gpio
    name: "b24-input15"
    id: "b24_input15"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 6
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input15-tuya
    dp_id: 139
    bind_binary_sensor_id: b24_input15
    internal: true

  - platform: gpio
    name: "b24-input16"
    id: "b24_input16"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 7
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input16-tuya
    dp_id: 140
    bind_binary_sensor_id: b24_input16
    internal: true

  - platform: gpio
    name: "b24-input17"
    id: "b24_input17"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 0
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input17-tuya
    dp_id: 141
    bind_binary_sensor_id: b24_input17
    internal: true


  - platform: gpio
    name: "b24-input18"
    id: "b24_input18"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 1
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input18-tuya
    dp_id: 142
    bind_binary_sensor_id: b24_input18
    internal: true

  - platform: gpio
    name: "b24-input19"
    id: "b24_input19"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 2
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input19-tuya
    dp_id: 143
    bind_binary_sensor_id: b24_input19
    internal: true

  - platform: gpio
    name: "b24-input20"
    id: "b24_input20"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 3
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input20-tuya
    dp_id: 144
    bind_binary_sensor_id: b24_input20
    internal: true

  - platform: gpio
    name: "b24-input21"
    id: "b24_input21"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 4
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input21-tuya
    dp_id: 145
    bind_binary_sensor_id: b24_input21
    internal: true

  - platform: gpio
    name: "b24-input22"
    id: "b24_input22"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 5
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input22-tuya
    dp_id: 146
    bind_binary_sensor_id: b24_input22
    internal: true

  - platform: gpio
    name: "b24-input23"
    id: "b24_input23"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 6
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input23-tuya
    dp_id: 147
    bind_binary_sensor_id: b24_input23
    internal: true

  - platform: gpio
    name: "b24-input24"
    id: "b24_input24"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 7
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input24-tuya
    dp_id: 148
    bind_binary_sensor_id: b24_input24
    internal: true

##pull-up resistance on PCB
  - platform: gpio
    name: "b24-W1-io48"
    pin:
      number: 48
      inverted: true

  - platform: gpio
    name: "b24-W1-io47"
    pin:
      number: 47
      inverted: true

  - platform: gpio
    name: "b24-W1-io40"
    pin:
      number: 40
      inverted: true

  - platform: gpio
    name: "b24-W1-io7"
    pin:
      number: 7
      inverted: true
## without resistance on PCB
  - platform: gpio
    name: "b24-W1-io13"
    pin:
      number: 13
      inverted: false

  - platform: gpio
    name: "b24-W1-io14"
    pin:
      number: 14
      inverted:  false

  - platform: gpio
    name: "b24-W1-io21"
    pin:
      number: 21
      inverted:  false

  - platform: gpio
    name: "b24-W1-io0"
    pin:
      number: 0
      inverted:  false

switch:
  - platform: gpio
    name: "b24-output01"
    id: "b24_output01"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 8
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output1-tuya
    dp_id: 101
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output01"

  - platform: gpio
    name: "b24-output02"
    id: "b24_output02"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 9
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output2-tuya
    dp_id: 102
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output02"

  - platform: gpio
    name: "b24-output03"
    id: "b24_output03"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 10
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output3-tuya
    dp_id: 103
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output03"

  - platform: gpio
    name: "b24-output04"
    id: "b24_output04"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 11
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output4-tuya
    dp_id: 104
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output04"

  - platform: gpio
    name: "b24-output05"
    id: "b24_output05"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 12
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output5-tuya
    dp_id: 105
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output05"


  - platform: gpio
    name: "b24-output06"
    id: "b24_output06"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 13
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output6-tuya
    dp_id: 106
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output06"


  - platform: gpio
    name: "b24-output07"
    id: "b24_output07"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 14
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output7-tuya
    dp_id: 107
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output07"


  - platform: gpio
    name: "b24-output08"
    id: "b24_output08"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 15
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output8-tuya
    dp_id: 108
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output08"


  - platform: gpio
    name: "b24-output09"
    id: b24_output09
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 0
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output9-tuya
    dp_id: 109
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output09"

  - platform: gpio
    name: "b24-output10"
    id: b24_output10
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 1
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output10-tuya
    dp_id: 110
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output10"


  - platform: gpio
    name: "b24-output11"
    id: b24_output11
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 2
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output11-tuya
    dp_id: 111
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output11"


  - platform: gpio
    name: "b24-output12"
    id: b24_output12
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 3
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output12-tuya
    dp_id: 112
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output12"


  - platform: gpio
    name: "b24-output13"
    id: b24_output13
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 4
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output13-tuya
    dp_id: 113
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output13"


  - platform: gpio
    name: "b24-output14"
    id: b24_output14
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 5
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output14-tuya
    dp_id: 114
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output14"


  - platform: gpio
    name: "b24-output15"
    id: b24_output15
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 6
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output15-tuya
    dp_id: 115
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output15"


  - platform: gpio
    name: "b24-output16"
    id: b24_output16
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 7
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output16-tuya
    dp_id: 116
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output16"


  - platform: gpio
    name: "b24-output17"
    id: b24_output17
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 8
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output17-tuya
    dp_id: 117
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output17"


  - platform: gpio
    name: "b24-output18"
    id: b24_output18
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 9
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output18-tuya
    dp_id: 118
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output18"


  - platform: gpio
    name: "b24-output19"
    id: b24_output19
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 10
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output19-tuya
    dp_id: 119
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output19"


  - platform: gpio
    name: "b24-output20"
    id: b24_output20
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 11
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output20-tuya
    dp_id: 120
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output20"

  - platform: gpio
    name: "b24-output21"
    id: b24_output21
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 12
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output21-tuya
    dp_id: 121
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output21"


  - platform: gpio
    name: "b24-output22"
    id: b24_output22
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 13
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output22-tuya
    dp_id: 122
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output22"


  - platform: gpio
    name: "b24-output23"
    id: b24_output23
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 14
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output23-tuya
    dp_id: 123
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output23"


  - platform: gpio
    name: "b24-output24"
    id: b24_output24
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 15
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output24-tuya
    dp_id: 124
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output24"

  - platform: uart
    uart_id: uart_1
    name: "RS485 Button"
    data: [0x11, 0x22, 0x33, 0x44, 0x55]

ads1115:
  - address: 0x48
sensor:
  - platform: ads1115
    multiplexer: 'A0_GND'
    gain: 6.144
    resolution: 16_BITS
    name: "ADS1115 Channel A0-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A1_GND'
    gain: 6.144
    name: "ADS1115 Channel A1-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A2_GND'
    gain: 6.144
    name: "ADS1115 Channel A2-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A3_GND'
    gain: 6.144
    name: "ADS1115 Channel A3-GND"
    update_interval: 5s

web_server:
  port: 80

font:
  - file: "gfonts://Roboto"
    id: roboto
    size: 20

display:
  - platform: ssd1306_i2c
    i2c_id: bus_a
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      it.printf(0, 0, id(roboto), "KinCony B24");
download yaml file:

.txt   B24-HA-with-Tuya.txt (Size: 19.26 KB / Downloads: 78)

Print this item

  B24 ESPHome yaml for home assistant with tuya
Posted by: admin - 07-31-2025, 06:51 AM - Forum: B24 - No Replies

Code:
esphome:
  name: b24
  friendly_name: b24
  platformio_options:
    board_build.extra_flags:
      # WIFI_CONTROL_SELF_MODE = 0
      # WIFI_CONTROL_SELF_MODE = 1
      - "-DWIFI_CONTROL_SELF_MODE=1"

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

external_components:
  - source:
      type: git
      url: https://github.com/hzkincony/esphome-tuya-wifi-mcu
      ref: v1.1.0

# Enable logging
#logger:

# Enable Home Assistant API
api:

ethernet:
  type: W5500
  clk_pin: GPIO1
  mosi_pin: GPIO2
  miso_pin: GPIO41
  cs_pin: GPIO42
  interrupt_pin: GPIO43
  reset_pin: GPIO44

uart:
  - id: uart_1    #RS485
    baud_rate: 9600
    debug:
      direction: BOTH
      dummy_receiver: true
      after:
        timeout: 10ms
    tx_pin: 39
    rx_pin: 38

  - id: tuya_mcu_uart
    tx_pin: GPIO16
    rx_pin: GPIO17
    baud_rate: 9600

i2c:
   - id: bus_a
     sda: 8
     scl: 18
     scan: true
     frequency: 400kHz

pcf8574:
  - id: 'pcf8574_hub_in_1'  # for input channel 1-16
    i2c_id: bus_a
    address: 0x22
    pcf8575: true

  - id: 'pcf8574_hub_in_out_1'  # for digital input channel 17-24 & ouptut 1-8
    i2c_id: bus_a
    address: 0x25
    pcf8575: true

  - id: 'pcf8574_hub_out_1'  # for output channel 9-24
    i2c_id: bus_a
    address: 0x24
    pcf8575: true

tuya_wifi_mcu:
  # tuya mcu product id
  product_id: vyznobv3bahs2pwl
  uart_id: tuya_mcu_uart
  wifi_reset_pin: 28
  wifi_led_pin: 16

binary_sensor:
  - platform: gpio
    name: "b24-input01"
    id: "b24_input01"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 8
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input1-tuya
    dp_id: 125
    bind_binary_sensor_id: b24_input01
    internal: true

  - platform: gpio
    name: "b24-input02"
    id: "b24_input02"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 9
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input2-tuya
    dp_id: 126
    bind_binary_sensor_id: b24_input02
    internal: true

  - platform: gpio
    name: "b24-input03"
    id: "b24_input03"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 10
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input3-tuya
    dp_id: 127
    bind_binary_sensor_id: b24_input03
    internal: true

  - platform: gpio
    name: "b24-input04"
    id: "b24_input04"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 11
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input4-tuya
    dp_id: 128
    bind_binary_sensor_id: b24_input04
    internal: true

  - platform: gpio
    name: "b24-input05"
    id: "b24_input05"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 12
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input5-tuya
    dp_id: 129
    bind_binary_sensor_id: b24_input05
    internal: true

  - platform: gpio
    name: "b24-input06"
    id: "b24_input06"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 13
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input6-tuya
    dp_id: 130
    bind_binary_sensor_id: b24_input06
    internal: true

  - platform: gpio
    name: "b24-input07"
    id: "b24_input07"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 14
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input7-tuya
    dp_id: 131
    bind_binary_sensor_id: b24_input07
    internal: true

  - platform: gpio
    name: "b24-input08"
    id: "b24_input08"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 15
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input8-tuya
    dp_id: 132
    bind_binary_sensor_id: b24_input08
    internal: true

  - platform: gpio
    name: "b24-input09"
    id: "b24_input09"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 0
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input9-tuya
    dp_id: 133
    bind_binary_sensor_id: b24_input09
    internal: true

  - platform: gpio
    name: "b24-input10"
    id: "b24_input10"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 1
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input10-tuya
    dp_id: 134
    bind_binary_sensor_id: b24_input10
    internal: true

  - platform: gpio
    name: "b24-input11"
    id: "b24_input11"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 2
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input11-tuya
    dp_id: 135
    bind_binary_sensor_id: b24_input11
    internal: true

  - platform: gpio
    name: "b24-input12"
    id: "b24_input12"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 3
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input12-tuya
    dp_id: 136
    bind_binary_sensor_id: b24_input12
    internal: true

  - platform: gpio
    name: "b24-input13"
    id: "b24_input13"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 4
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input13-tuya
    dp_id: 137
    bind_binary_sensor_id: b24_input13
    internal: true

  - platform: gpio
    name: "b24-input14"
    id: "b24_input14"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 5
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input14-tuya
    dp_id: 138
    bind_binary_sensor_id: b24_input14
    internal: true

  - platform: gpio
    name: "b24-input15"
    id: "b24_input15"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 6
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input15-tuya
    dp_id: 139
    bind_binary_sensor_id: b24_input15
    internal: true

  - platform: gpio
    name: "b24-input16"
    id: "b24_input16"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 7
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input16-tuya
    dp_id: 140
    bind_binary_sensor_id: b24_input16
    internal: true

  - platform: gpio
    name: "b24-input17"
    id: "b24_input17"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 0
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input17-tuya
    dp_id: 141
    bind_binary_sensor_id: b24_input17
    internal: true


  - platform: gpio
    name: "b24-input18"
    id: "b24_input18"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 1
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input18-tuya
    dp_id: 142
    bind_binary_sensor_id: b24_input18
    internal: true

  - platform: gpio
    name: "b24-input19"
    id: "b24_input19"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 2
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input19-tuya
    dp_id: 143
    bind_binary_sensor_id: b24_input19
    internal: true

  - platform: gpio
    name: "b24-input20"
    id: "b24_input20"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 3
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input20-tuya
    dp_id: 144
    bind_binary_sensor_id: b24_input20
    internal: true

  - platform: gpio
    name: "b24-input21"
    id: "b24_input21"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 4
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input21-tuya
    dp_id: 145
    bind_binary_sensor_id: b24_input21
    internal: true

  - platform: gpio
    name: "b24-input22"
    id: "b24_input22"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 5
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input22-tuya
    dp_id: 146
    bind_binary_sensor_id: b24_input22
    internal: true

  - platform: gpio
    name: "b24-input23"
    id: "b24_input23"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 6
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input23-tuya
    dp_id: 147
    bind_binary_sensor_id: b24_input23
    internal: true

  - platform: gpio
    name: "b24-input24"
    id: "b24_input24"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 7
      mode: INPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-input24-tuya
    dp_id: 148
    bind_binary_sensor_id: b24_input24
    internal: true

##pull-up resistance on PCB
  - platform: gpio
    name: "b24-W1-io48"
    pin:
      number: 48
      inverted: true

  - platform: gpio
    name: "b24-W1-io47"
    pin:
      number: 47
      inverted: true

  - platform: gpio
    name: "b24-W1-io40"
    pin:
      number: 40
      inverted: true

  - platform: gpio
    name: "b24-W1-io7"
    pin:
      number: 7
      inverted: true
## without resistance on PCB
  - platform: gpio
    name: "b24-W1-io13"
    pin:
      number: 13
      inverted: false

  - platform: gpio
    name: "b24-W1-io14"
    pin:
      number: 14
      inverted:  false

  - platform: gpio
    name: "b24-W1-io21"
    pin:
      number: 21
      inverted:  false

  - platform: gpio
    name: "b24-W1-io0"
    pin:
      number: 0
      inverted:  false

switch:
  - platform: gpio
    name: "b24-output01"
    id: "b24_output01"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 8
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output1-tuya
    dp_id: 101
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output01"

  - platform: gpio
    name: "b24-output02"
    id: "b24_output02"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 9
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output2-tuya
    dp_id: 102
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output02"

  - platform: gpio
    name: "b24-output03"
    id: "b24_output03"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 10
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output3-tuya
    dp_id: 103
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output03"

  - platform: gpio
    name: "b24-output04"
    id: "b24_output04"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 11
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output4-tuya
    dp_id: 104
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output04"

  - platform: gpio
    name: "b24-output05"
    id: "b24_output05"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 12
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output5-tuya
    dp_id: 105
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output05"


  - platform: gpio
    name: "b24-output06"
    id: "b24_output06"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 13
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output6-tuya
    dp_id: 106
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output06"


  - platform: gpio
    name: "b24-output07"
    id: "b24_output07"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 14
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output7-tuya
    dp_id: 107
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output07"


  - platform: gpio
    name: "b24-output08"
    id: "b24_output08"
    pin:
      pcf8574: pcf8574_hub_in_out_1
      number: 15
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output8-tuya
    dp_id: 108
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output08"


  - platform: gpio
    name: "b24-output09"
    id: b24_output09
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 0
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output9-tuya
    dp_id: 109
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output09"

  - platform: gpio
    name: "b24-output10"
    id: b24_output10
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 1
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output10-tuya
    dp_id: 110
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output10"


  - platform: gpio
    name: "b24-output11"
    id: b24_output11
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 2
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output11-tuya
    dp_id: 111
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output11"


  - platform: gpio
    name: "b24-output12"
    id: b24_output12
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 3
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output12-tuya
    dp_id: 112
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output12"


  - platform: gpio
    name: "b24-output13"
    id: b24_output13
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 4
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output13-tuya
    dp_id: 113
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output13"


  - platform: gpio
    name: "b24-output14"
    id: b24_output14
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 5
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output14-tuya
    dp_id: 114
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output14"


  - platform: gpio
    name: "b24-output15"
    id: b24_output15
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 6
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output15-tuya
    dp_id: 115
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output15"


  - platform: gpio
    name: "b24-output16"
    id: b24_output16
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 7
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output16-tuya
    dp_id: 116
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output16"


  - platform: gpio
    name: "b24-output17"
    id: b24_output17
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 8
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output17-tuya
    dp_id: 117
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output17"


  - platform: gpio
    name: "b24-output18"
    id: b24_output18
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 9
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output18-tuya
    dp_id: 118
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output18"


  - platform: gpio
    name: "b24-output19"
    id: b24_output19
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 10
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output19-tuya
    dp_id: 119
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output19"


  - platform: gpio
    name: "b24-output20"
    id: b24_output20
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 11
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output20-tuya
    dp_id: 120
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output20"

  - platform: gpio
    name: "b24-output21"
    id: b24_output21
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 12
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output21-tuya
    dp_id: 121
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output21"


  - platform: gpio
    name: "b24-output22"
    id: b24_output22
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 13
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output22-tuya
    dp_id: 122
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output22"


  - platform: gpio
    name: "b24-output23"
    id: b24_output23
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 14
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output23-tuya
    dp_id: 123
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output23"


  - platform: gpio
    name: "b24-output24"
    id: b24_output24
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 15
      mode: OUTPUT
      inverted: true
  - platform: tuya_wifi_mcu
    name: b24-output24-tuya
    dp_id: 124
    # hide from homeassistant ui
    internal: true
    # bind other switch, sync state
    bind_switch_id: "b24_output24"

  - platform: uart
    uart_id: uart_1
    name: "RS485 Button"
    data: [0x11, 0x22, 0x33, 0x44, 0x55]

ads1115:
  - address: 0x48
sensor:
  - platform: ads1115
    multiplexer: 'A0_GND'
    gain: 6.144
    resolution: 16_BITS
    name: "ADS1115 Channel A0-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A1_GND'
    gain: 6.144
    name: "ADS1115 Channel A1-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A2_GND'
    gain: 6.144
    name: "ADS1115 Channel A2-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A3_GND'
    gain: 6.144
    name: "ADS1115 Channel A3-GND"
    update_interval: 5s

web_server:
  port: 80

font:
  - file: "gfonts://Roboto"
    id: roboto
    size: 20

display:
  - platform: ssd1306_i2c
    i2c_id: bus_a
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      it.printf(0, 0, id(roboto), "KinCony B24");
download yaml file:

.txt   B24-HA-with-Tuya.txt (Size: 19.26 KB / Downloads: 89)

Print this item

  B24M ESP32-S3 IO pins define
Posted by: admin - 07-31-2025, 06:49 AM - Forum: B24M - No Replies

IIC Bus:

SDA:GPIO8
SCL:GPIO18

PCF8575: (input1-16): i2c address:0x22 by B16-core

P8:input1
P9:input2
P10:input3
P11:input4
P12:input5
P13:input6
P14:input7
P15:input8

P0:input9
P1:input10
P2:input11
P3:input12
P4:input13
P5:input14
P6:input15
P7:input16

U4: PCF8575 i2c address:0x25
P0:input17
P1:input18
P2:input19
P3:input20
P4:input21
P5:input22
P6:input23
P7:input24

P8:output1
P9:output2
P10:output3
P11:output4
P12:output5
P13:output6
P14:output7
P15:output8

U2: PCF8575 i2c address:0x24
P0:output9
P1:output10
P2:output11
P3:output12
P4:output13
P5:output14
P6:output15
P7:output16

P8:output17
P9:output18
P10:output19
P11:output20
P12:output21
P13:output22
P14:output23
P15:output24


24C02 EPROM i2c address: 0x50
DS3231 RTC i2c address: 0x68
SSD1306 display: i2c address:0x3c
ADS1115 (4CH ADC) : i2c address:0x48

Analog input (A1: DC 0-5v)
Analog input (A2: DC 0-5v)
Analog input (A3: DC 4-20mA)
Analog input (A4: DC 4-20mA)

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

free GPIOs (without pull-up resistance on PCB):
GPIO13
GPIO14
GPIO21

free GPIOs (with pull-up resistance on PCB):
GPIO40
GPIO48
GPIO47
GPIO7

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

Ethernet (W5500) I/O define:

clk_pin: GPIO1
mosi_pin: GPIO2
miso_pin: GPIO41
cs_pin: GPIO42

interrupt_pin: GPIO43
reset_pin: GPIO44

--------------------
RS485:
RXD:GPIO38
TXD:GPIO39

Tuya module:
RXD:GPIO17
TXD:GPIO16

Tuya network button: Tuya module's P28
Tuya network LED: Tuya module's P16
--------------------
SD Card:
SPI-MOSI:GPIO10
SPI-SCK:GPIO11
SPI-MISO:GPIO12
SPI-CS:GPIO9

Print this item

  B24 ESP32-S3 IO pins define
Posted by: admin - 07-31-2025, 06:49 AM - Forum: B24 - No Replies

IIC Bus:

SDA:GPIO8
SCL:GPIO18

PCF8575: (input1-16): i2c address:0x22 by B16-core

P8:input1
P9:input2
P10:input3
P11:input4
P12:input5
P13:input6
P14:input7
P15:input8

P0:input9
P1:input10
P2:input11
P3:input12
P4:input13
P5:input14
P6:input15
P7:input16

U4: PCF8575 i2c address:0x25
P0:input17
P1:input18
P2:input19
P3:input20
P4:input21
P5:input22
P6:input23
P7:input24

P8:output1
P9:output2
P10:output3
P11:output4
P12:output5
P13:output6
P14:output7
P15:output8

U2: PCF8575 i2c address:0x24
P0:output9
P1:output10
P2:output11
P3:output12
P4:output13
P5:output14
P6:output15
P7:output16

P8:output17
P9:output18
P10:output19
P11:output20
P12:output21
P13:output22
P14:output23
P15:output24


24C02 EPROM i2c address: 0x50
DS3231 RTC i2c address: 0x68
SSD1306 display: i2c address:0x3c
ADS1115 (4CH ADC) : i2c address:0x48

Analog input (A1: DC 0-5v)
Analog input (A2: DC 0-5v)
Analog input (A3: DC 4-20mA)
Analog input (A4: DC 4-20mA)

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

free GPIOs (without pull-up resistance on PCB):
GPIO13
GPIO14
GPIO21

free GPIOs (with pull-up resistance on PCB):
GPIO40
GPIO48
GPIO47
GPIO7

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

Ethernet (W5500) I/O define:

clk_pin: GPIO1
mosi_pin: GPIO2
miso_pin: GPIO41
cs_pin: GPIO42

interrupt_pin: GPIO43
reset_pin: GPIO44

--------------------
RS485:
RXD:GPIO38
TXD:GPIO39

Tuya module:
RXD:GPIO17
TXD:GPIO16

Tuya network button: Tuya module's P28
Tuya network LED: Tuya module's P16
--------------------
SD Card:
SPI-MOSI:GPIO10
SPI-SCK:GPIO11
SPI-MISO:GPIO12
SPI-CS:GPIO9

Print this item

  KinCony T32M Tiny ESP32 Smart Controller released
Posted by: admin - 07-31-2025, 04:50 AM - Forum: News - Replies (2)

KinCony T32M tiny ESP32 smart controller based on ESP32-S3-WROOM-1U (N16R8) wifi chip. Support 32 channel MOSFET output, 4 channel 1-wire GPIOs, 3 channel free GPIOs. T32M have RS485 port. You can write any code by Arduino IDE / Micro Python / ESP-IDF development tool to ESP32 module. We will supply Arduino / ESP-IDF demo code for different samples. Everyone can modify and change the code for your own smart home automation system project. it support use by ESPHome for home assistant or tasmota firmware for smart home automation DIY. T64M use KCS v3 firmware, it support home assistant auto discovery function by MQTT, so without write any config code (zero code) for home assistant. KCS v3 support KinCony cloud service (official shop customer free 2 years), remote monitor and control device by webpage in anywhere. KCS v3 support KinCony board integrate to Loxone Miniserver. Support Apple HomeKit for Siri.
[Image: T32M-1.jpg]
Model No. KinCony T32M
Description: KinCony 32 Channel Tiny ESP32-S3 Smart Controller – T32M
Power supply: 12-24V DC
Processor: ESP32-S3-WROOM-1U (N16R8)
Size: 130mm*83mm*56mm
interfaces: Ethernet(RJ45)-LAN 100Mbps IPv4/IPv6,WiFi,RS485,Bluetooth,USB-C
Installation method: DIN RAIL
Outputs:
32CH MOSFET Outputs, every channel use MAX 4A driver IC
Inputs:
32CH dry contact inputs (optocoupler isolation, long distance circuit for MAX 500 meters cable)
2 buttons: 1:ESP32 Reset 2:ESP32 Download
1-Wire GPIO: 4CH (with pull-up resistance on PCB)
free GPIO: 3CH (connect with ESP32S3 pin directly)
2CH analog input DC0-5V (A1,A2) 2CH analog input 4-20mA (A3,A4)
[Image: T32M-2.jpg]

Print this item

  Red or Green LED's
Posted by: Onepointbrewing - 07-30-2025, 03:42 AM - Forum: F16 - Replies (1)

Is there any GPIO access to the Red LED near the ethernet jack or the green power on the front panel?

Print this item