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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 5,374
» Latest member: zeth
» Forum threads: 2,574
» Forum posts: 13,315

Full Statistics

Online Users
There are currently 59 online users.
» 2 Member(s) | 43 Guest(s)
Bing, Bytespider, Crawl, Google, PetalBot, Yandex, bot, owler, biofects, Verresen

Latest Threads
KC868-A2 configure yaml f...
Forum: KC868-A2
Last Post: elemarek
8 hours ago
» Replies: 15
» Views: 7,685
How can I power multiple ...
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
9 hours ago
» Replies: 12
» Views: 134
how to use AS ESP32-S3 vo...
Forum: KinCony AS
Last Post: biofects
Today, 03:07 AM
» Replies: 13
» Views: 469
change wake up name
Forum: KinCony AS
Last Post: admin
Today, 02:10 AM
» Replies: 13
» Views: 104
Problem with IFTTT automa...
Forum: "KCS" firmware system
Last Post: admin
Yesterday, 11:41 PM
» Replies: 6
» Views: 51
A32 Pro ESPHome yaml incl...
Forum: KC868-A32/A32 Pro
Last Post: admin
Yesterday, 11:15 PM
» Replies: 18
» Views: 191
KC868-A2 ESP32 I/O pin de...
Forum: KC868-A2
Last Post: admin
Yesterday, 11:12 PM
» Replies: 8
» Views: 2,272
Need help with configurat...
Forum: KC868-HxB series Smart Controller
Last Post: admin
Yesterday, 04:32 AM
» Replies: 32
» Views: 399
ESP32 S3 set up issue
Forum: Extender module
Last Post: admin
12-17-2024, 11:43 PM
» Replies: 10
» Views: 73
KC868-A8 Schematic
Forum: KC868-A8
Last Post: admin
12-17-2024, 11:40 PM
» Replies: 7
» Views: 55

  Binary Inputs 9-15 turn off with 1-8
Posted by: dockside - 05-16-2024, 08:20 PM - Forum: KC868-A16 - Replies (7)

Used ESPHome to configure Digital Inputs. However both inputs 8 & 16 turn off when shorting input 16.  Same with inputs 9 & 15 when shorting input 15. Same with all inputs from 16 down to 9, that is inputs 8 down to 1 also turn off. My KC868-A16 board is at REV 1.6 and log information attached.

Thanks for the help.

Ted

Print this item

  AM2301
Posted by: milan.net - 05-14-2024, 03:32 PM - Forum: KC868-A8S - Replies (8)

Hello, I'm verry interested in this board( the v2 version)

I have  2 questions.

I need to use 2x AM2301 sensors, is it possible to use them with this board?

Which poe expansion board do I need to add to this board to use poe directly?

Print this item

  Kc868-AM and sensors
Posted by: fdcemb5 - 05-14-2024, 02:31 PM - Forum: KC868-AM - Replies (4)

Where can I get yaml configuration file for esphome for the diagram attached

Print this item

  KC868-AM with DS18B20
Posted by: fdcemb5 - 05-14-2024, 12:06 PM - Forum: KC868-AM - Replies (1)

Your ESphome yaml file example for KC868-AM does not show for DS18B20 sensor, how do add configuration entries for temperature sensors

Print this item

  KC868 server
Posted by: fdcemb5 - 05-14-2024, 12:00 PM - Forum: KC868-Server Raspberry Pi4 local server - Replies (3)

if I connect DS18B20/DHT11/21 Temperature and humidity sensor to these pins, how do I make it appear in Home Assistant since I cannot write Arduino code on KC868 server

GPIO-1: GPIO4
GPIO-2: GPIO5
GPIO-3: GPIO18
GPIO-4: GPIO19

Print this item

  Board Boot Error
Posted by: corkers - 05-14-2024, 06:28 AM - Forum: KC868-A16 - Replies (9)

Hi I have an A16 v1.5 board that will not flash.

   
   


   

From doing some reading this is a fatal error....

Print this item

  Tuya adapter V2 arduino source code - RS485 relay controller KC868-H32BS
Posted by: admin - 05-14-2024, 02:18 AM - Forum: KC868-ATC / Tuya adapter V2 - Replies (6)

This is sample demo let RS485 digital output device (KinCony KC868-H32BS controller) can work with Tuya app by internet.  you can let your own RS485 relay board add to Tuya app.
added Tuya adapter v2, relay board will support alexa or Google home speaker for voice control directly.
   
   
   
arduino source code download: 
.zip   Tuya_AdapterV2_RS485_Relay.zip (Size: 2.63 KB / Downloads: 72)

Code:
#include <ModbusMaster.h>
#include <Arduino.h>
#include <TuyaWifi.h>
#include "HardwareSerial.h"
//---------RS485 setting
#define DEBUG   1

#define SERIAL_BAUD   9600
#define RX_PIN    32
#define TX_PIN    33
#define ADAPT485_NUM  2
#define SLAVE_ADDR  1
#define READ_ADDR  0
#define READ_NUM   32 

/* Current device DP values */
bool rt_coils_status[32] = {0};

HardwareSerial My485Serial(ADAPT485_NUM);
ModbusMaster node;
uint16_t rcv_buf[READ_NUM>>4] = {0};
  
static void ReadEmeterRegs(void)
{
  uint32_t read_tmp = 0;
  
  uint8_t result = node.readCoils(READ_ADDR, READ_NUM);
  if (result == node.ku8MBSuccess) {//if communicate successful then
       
    for (uint8_t i = 0; i < 2; i++)
    {
      rcv_buf[i] = node.getResponseBuffer(i);
      for(uint8_t j = 0; j < 16; j++)
      {
        if(j<8) rt_coils_status[i*16 + j+8] = (rcv_buf[1-i]&(1<<j))?true:false;
        else rt_coils_status[i*16 + j - 8] = (rcv_buf[1-i]&(1<<j))?true:false;
      }
    }
   
    #if DEBUG
    Serial1.print("Get switch[0..31] value is");
    Serial1.print(":<0x");
    Serial1.print(rcv_buf[0],HEX);
    Serial1.print(rcv_buf[1],HEX);
    Serial1.println("> ");
    #endif
    
  }
  else
  {
    node.clearResponseBuffer();
  }

  delay(100);
}

//---RS485 setting end----

TuyaWifi my_device;



/* Current LED status */
unsigned char led_state = 0;
/* Connect network button pin */
int key_pin = 25;


/* Data point define */
typedef enum
{
  DPID_SWITCH01 = 1,
  DPID_SWITCH02,DPID_SWITCH03,
  DPID_SWITCH04,DPID_SWITCH05,DPID_SWITCH06,
  DPID_SWITCH07 = 113,
  DPID_SWITCH08,DPID_SWITCH09,DPID_SWITCH10,
  DPID_SWITCH11,DPID_SWITCH12,DPID_SWITCH13,
  DPID_SWITCH14,DPID_SWITCH15,DPID_SWITCH16,
  DPID_SWITCH17,DPID_SWITCH18,DPID_SWITCH19,
  DPID_SWITCH20,DPID_SWITCH21,DPID_SWITCH22,
  DPID_SWITCH23,DPID_SWITCH24,DPID_SWITCH25,
  DPID_SWITCH26,DPID_SWITCH27,DPID_SWITCH28,
  DPID_SWITCH29,DPID_SWITCH30,DPID_SWITCH31,
  DPID_SWITCH32,
}H32BS_DPID_DEF;

/*const unsigned char dpid_arr[32] = {
  1,2,3,4,5,6,
  113,114,115,116,117,118,119,120,
  121,122,123,124,125,126,127,128,
  129,130,131,132,133,134,135,136,
  137,138,
};*/

#define LED_WiFi  26
//#define LED_User  33



/* Stores all DPs and their types. PS: array[][0]:dpid, array[][1]:dp type.
*                                     dp type(TuyaDefs.h) : DP_TYPE_RAW, DP_TYPE_BOOL, DP_TYPE_VALUE, DP_TYPE_STRING, DP_TYPE_ENUM, DP_TYPE_BITMAP
*/
unsigned char dp_array[][2] =
{
  {DPID_SWITCH01, DP_TYPE_BOOL},{DPID_SWITCH02, DP_TYPE_BOOL},
  {DPID_SWITCH03, DP_TYPE_BOOL},{DPID_SWITCH04, DP_TYPE_BOOL},
  {DPID_SWITCH05, DP_TYPE_BOOL},{DPID_SWITCH06, DP_TYPE_BOOL},
  {DPID_SWITCH07, DP_TYPE_BOOL},{DPID_SWITCH08, DP_TYPE_BOOL},

  {DPID_SWITCH09, DP_TYPE_BOOL},{DPID_SWITCH10, DP_TYPE_BOOL},
  {DPID_SWITCH11, DP_TYPE_BOOL},{DPID_SWITCH12, DP_TYPE_BOOL},
  {DPID_SWITCH13, DP_TYPE_BOOL},{DPID_SWITCH14, DP_TYPE_BOOL},
  {DPID_SWITCH15, DP_TYPE_BOOL},{DPID_SWITCH16, DP_TYPE_BOOL},

  {DPID_SWITCH17, DP_TYPE_BOOL},{DPID_SWITCH18, DP_TYPE_BOOL},
  {DPID_SWITCH19, DP_TYPE_BOOL},{DPID_SWITCH20, DP_TYPE_BOOL},
  {DPID_SWITCH21, DP_TYPE_BOOL},{DPID_SWITCH22, DP_TYPE_BOOL},
  {DPID_SWITCH23, DP_TYPE_BOOL},{DPID_SWITCH24, DP_TYPE_BOOL},

  {DPID_SWITCH25, DP_TYPE_BOOL},{DPID_SWITCH26, DP_TYPE_BOOL},
  {DPID_SWITCH27, DP_TYPE_BOOL},{DPID_SWITCH28, DP_TYPE_BOOL},
  {DPID_SWITCH29, DP_TYPE_BOOL},{DPID_SWITCH30, DP_TYPE_BOOL},
  {DPID_SWITCH31, DP_TYPE_BOOL},{DPID_SWITCH32, DP_TYPE_BOOL},
};

unsigned char pid[] = {"3ocztklfu3q32jab"}; ////change pid here....
unsigned char mcu_ver[] = {"1.0.0"};

/* last time */
unsigned long last_time = 0;

/**
* @description: DP download callback function.
* @param {unsigned char} dpid
* @param {const unsigned char} value
* @param {unsigned short} length
* @return {unsigned char}
*/
unsigned char dp_process(unsigned char dpid,const unsigned char value[], unsigned short length)
{
  int16_t index_out_coil = -1;
  unsigned char get_down_cmd = false;
 
  for(int16_t i=0;i<32;i++)
  {
    if(dpid == dp_array[i][0])
    {
      index_out_coil = i;
      break;
    }
  }
  if(index_out_coil < 0) return TY_ERROR;

  get_down_cmd = my_device.mcu_get_dp_download_data(dpid,value,length);

  Serial1.print("Rcv Command:<dpid,");
  Serial1.print(dpid,DEC);
  Serial1.print(" value,");
  Serial1.print(value[0],HEX);
  Serial1.print(" len,");
  Serial1.println(length,HEX);
  Serial1.println("> ");
   
 

  #if DEBUG
    Serial1.print("get_down_cmd value is:<");
    Serial1.print(get_down_cmd,DEC); 
    Serial1.println("> ");
    Serial1.print("Node WriteCoilAddr<");
    Serial1.print(index_out_coil,DEC);
    Serial1.print("> ");
  #endif

  delay(100);
  uint8_t result = node.writeSingleCoil(index_out_coil, value[0]);
  #if DEBUG
    Serial1.print(" result:<");
    Serial1.print(result,DEC); 
    Serial1.println("> ");
  #endif

  delay(100);
  my_device.mcu_dp_update(dpid, value, length);
  return TY_SUCCESS;
}

void setup()
{

  My485Serial.begin(SERIAL_BAUD, SERIAL_8N1, RX_PIN, TX_PIN); //RS485 serial port
  node.begin(SLAVE_ADDR,My485Serial);
  Serial.begin(9600,SERIAL_8N1,22,19);  //Tuya module serial port
  Serial1.begin(115200,SERIAL_8N1,3,1);   //USB serial port

 
  // Serial with tuyawifi
 
 

  //Initialize led port, turn off led.
  pinMode(LED_WiFi, OUTPUT);
  digitalWrite(LED_WiFi, LOW);

/*  pinMode(LED_User, OUTPUT);
  digitalWrite(LED_User, LOW);*/

  //Initialize networking keys.
  pinMode(key_pin, INPUT_PULLUP);

  //Enter the PID and MCU software version
  my_device.init(pid, mcu_ver);
  //incoming all DPs and their types array, DP numbers
  my_device.set_dp_cmd_total(dp_array, 2);
  //register DP download processing callback function
  my_device.dp_process_func_register(dp_process);
  //register upload all DP callback function
  my_device.dp_update_all_func_register(dp_update_all);
 
  //delay(300);
  last_time = millis();
}

void loop()
{
  ReadEmeterRegs();  // read RS485 sensor
  my_device.uart_service();

  //Enter the connection network mode when Pin7 is pressed.
  if (digitalRead(key_pin) == LOW) {
    delay(80);
    if (digitalRead(key_pin) == LOW) {
      my_device.mcu_set_wifi_mode(SMART_CONFIG);
    }
  }
  /* LED blinks when network is being connected */
  if ((my_device.mcu_get_wifi_work_state() != WIFI_LOW_POWER) && (my_device.mcu_get_wifi_work_state() != WIFI_CONN_CLOUD) && (my_device.mcu_get_wifi_work_state() != WIFI_SATE_UNKNOW)) {
    if (millis()- last_time >= 500) {
      last_time = millis();

      if (led_state == LOW) {
        led_state = HIGH;
      } else {
        led_state = LOW;
      }
      digitalWrite(LED_WiFi, led_state);
    }
  }

  /* report the temperature and humidity */
  if ((my_device.mcu_get_wifi_work_state() == WIFI_CONNECTED) ||
      (my_device.mcu_get_wifi_work_state() == WIFI_CONN_CLOUD)) {
    dp_update_all();
  }

  delay(500);
}

static bool coils_old_status[32] = {false};

unsigned char tmp_cmd = 0;
static void CompareAndReport(void)
{
  for(int16_t i=0;i<32;i++)
  {
    if(coils_old_status[i] != rt_coils_status[i])
    {
      coils_old_status[i] = rt_coils_status[i];
      tmp_cmd = rt_coils_status[i]?1:0;
      #if 0
      Serial1.print("Changed happed:<dpid,");
      Serial1.print(dp_array[i][0],DEC);
      Serial1.println("> ");
      #endif
      my_device.mcu_dp_update(dp_array[i][0],tmp_cmd, 1);
      delay(10);
      //break;
    }
  }
}
/**
* @description: Upload all DP status of the current device.
* @param {*}
* @return {*}
*/
void dp_update_all(void)
{
  CompareAndReport();
 
}

Print this item

  Kc868-server VS Kincony server 16
Posted by: Saif Kitany - 05-13-2024, 07:43 PM - Forum: News - Replies (3)

What are the differences between kc868- server & kincony server 16?

I want to purchase one of them, but I’m wondering what are the main difference, and which one i should buy for my home project?

Print this item

  how to install home assistant for Server-16 beginner guide
Posted by: admin - 05-13-2024, 01:33 AM - Forum: KinCony Server-Mini / Server-16 Raspberry Pi4 relay module - No Replies

1. make home assistant SD card for KinCony Server-16.

download  https://www.raspberrypi.com/software/

2. enable i2c for home assistant.

Add files to enable I2C
In the root of the hassos-boot partition, add a new folder called CONFIG.
In the CONFIG folder, add another new folder called modules.
Inside the modules folder add a text file called rpi-i2c.conf with the following content:
i2c-dev

In the root of the hassos-boot partition, edit the file called config.txt add two lines to it:
dtparam=i2c_vc=on
dtparam=i2c_arm=on

3. install HACS addon (use by SSH)

https://hacs.xyz/docs/setup/download/

4. MCP23008/MCP23017 implementation for Home Assistant (HA)

https://github.com/jpcornil-git/HA-mcp23017

5. config ymal for MCP23017

install file edit add-on for HA , then config yaml

https://www.kincony.com/forum/showthread.php?tid=5438

Print this item

  tuya adapter lost code
Posted by: Saif Kitany - 05-12-2024, 06:17 PM - Forum: News - Replies (3)

i bought 2 new tuya adapter,

first one, i puch the reset button and lost the code in esp chip.

the second one, i tried to dowload the firmeware which support tcp connection, i did the steps as described in this link https://www.kincony.com/forum/showthread.php?tid=2339
but it didnt work. i tried to search the wifi of tuya by my laptob, and can't see it!!!

Print this item