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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 8,788
» Latest member: pipingmaterial
» Forum threads: 3,852
» Forum posts: 19,694

Full Statistics

Online Users
There are currently 41 online users.
» 0 Member(s) | 25 Guest(s)
AhrefsBot, Amazonbot, Bing, Bytespider, Sogou web, bot

Latest Threads
kWh resolution
Forum: N30
Last Post: admin
11 minutes ago
» Replies: 29
» Views: 931
N60 configure yaml for ES...
Forum: N60
Last Post: admin
17 minutes ago
» Replies: 0
» Views: 1
N30 configure yaml for ES...
Forum: N30
Last Post: admin
18 minutes ago
» Replies: 0
» Views: 1
N20 configure yaml for ES...
Forum: N20
Last Post: admin
19 minutes ago
» Replies: 0
» Views: 1
N10 configure yaml for ES...
Forum: N10
Last Post: admin
21 minutes ago
» Replies: 0
» Views: 1
Channels always have curr...
Forum: KC868-AP / ADR
Last Post: admin
1 hour ago
» Replies: 17
» Views: 5,945
A32pro issue
Forum: News
Last Post: admin
2 hours ago
» Replies: 5
» Views: 171
KinCony Cloud Functions
Forum: Suggestions and feedback on KinCony's products
Last Post: admin
03-21-2026, 11:42 PM
» Replies: 1
» Views: 8
AS-ESP32-S3 won't initial...
Forum: Getting Started with ESPHome and Home Assistant
Last Post: admin
03-21-2026, 11:40 PM
» Replies: 5
» Views: 40
Interface T16M E/S et AIO
Forum: News
Last Post: admin
03-21-2026, 11:40 PM
» Replies: 1
» Views: 8

  K868-H32L need to work with Node-RED and Alexa (TCP-OUT)
Posted by: jack859363 - 03-29-2022, 08:44 AM - Forum: DIY Project - Replies (1)

I was told to post here what I am trying to do. My parts are:
1. K868-H32L
2. Tp-link wireless router
3. ESP8266
4. Old PC

Scenario: I tried using the ESP8266 with the K868-H32L to link to Alexa. However, Alexa could only detect 10 switches out of the 32. Kincony notified me that ESP8266 is only limited. Now, I have a bunch of OLD PCs lying around with ready windows. Kincony told me I can use PC with red NODE. I managed to install and sign up for red-node. Again, Kincony support told me that I cannot use MQQT with K868-H32L. I am posting here because I need help how to set-up red-node using TCP-out.

The videos posted are MQQT are very similar to TCP-out. I followed it however, TCP-out would not connect to my 868-H32L, I connected PC and H32L relay to LAN of wireless router, Internet access thru WAN of Wireless router, Alexa module connected to Wireless Router. Everything is working with the KC868-H32.exe pc software so I know parts are working.

I need to automate the system via Alexa. Kindly assist how to connect 868-H32L relay to red-Node via TCP-Out. The programming of Alexa to red Node is already in the MQQT videos.



Attached Files Thumbnail(s)
                       

Print this item

  [Arduino demo source code for KC868-A4]-11 how to create wifi connection
Posted by: KinCony Support - 03-28-2022, 05:40 AM - Forum: KC868-A4 - Replies (8)

Code:
#include <WiFi.h>
void setup(){
  WiFi.begin("SSID", "PASSWORD");
  // SSID and password is the router you want to connect
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.begin(9600);
}

void loop(){
  Serial.println("Local IP:");
  Serial.println(WiFi.localIP());
  delay(1000);
}
       

Print this item

  Lesson9 - integrate KC868-Server to home assistant by MQTT
Posted by: admin - 03-27-2022, 04:56 AM - Forum: Home automation training courses - Replies (59)


1.MQTT communication structure diagram

   

KC868-Server--------

publish message: status of switch (status topic)
Subscription message: turn on / off command (command topic)


home assistant------

publish message:  turn on / off command (command topic)
Subscription message: status of switch (status topic)

2.KC868-Server digital output , digital input , analog input config sample code in configuration.yaml

# Example configuration.yaml entry
switch:
  - platform: mqtt
    name: 'output-1'
    unique_id: output-1
    state_topic: 'server/ xxxxxxxxxxxxxxxxxxxxxxxx /state'
    command_topic: 'server/ xxxxxxxxxxxxxxxxxxxxxxxx /set'
    payload_on:  '{"relay1":{"on":1}}'
    payload_off:  '{"relay1":{"on":0}}'
    value_template: '{{ value_json.relay1.on }}'
    state_on: 1
state_off: 0


binary_sensor:
  - platform: mqtt
    name: 'input-1'
    unique_id: input-1
    state_topic: 'server/ xxxxxxxxxxxxxxxxxxxxxxxx /state'
    value_template: '{{ value_json.input1.on }}'
    payload_on: 1
    payload_off: 0


sensor:
  - platform: mqtt
    name: 'analog-1'
    unique_id: analog-1
    state_topic: 'server/ xxxxxxxxxxxxxxxxxxxxxxxx /state'
    unit_of_measurement: 'v'
    value_template: '{{ value_json.analog1.value }} ' 

Note: xxxxxxxxxxxxxxxxxxxxxxxx is UID of controller, just replace with your device UID. You can find the UID in ethernet setting.

3.KC868-Server 16 channel output, 16 channel digital input, 4 channel analog input all use in configuration.yaml


.txt   KC868-Server-home-assistant-config.txt (Size: 8.15 KB / Downloads: 1545)

Print this item

  KC868-Server integrate to home asssitant by MQTT configuration.yaml
Posted by: admin - 03-27-2022, 04:52 AM - Forum: KC868-Server Raspberry Pi4 local server - Replies (15)

KC868-Server 16 channel output, 16 channel digital input, 4 channel analog input all use in configuration.yaml

.txt   KC868-Server-home-assistant-config.txt (Size: 8.15 KB / Downloads: 895)

Note: xxxxxxxxxxxxxxxxxxxxxxxx is UID of controller, just replace with your device UID. You can find the UID in ethernet setting.

Print this item

  Lesson8 - install Mosquitto broker on home assistant
Posted by: admin - 03-27-2022, 03:29 AM - Forum: Home automation training courses - No Replies


1. MQTT structure

   

   

2. Install mosquito MQTT broker on home assistant

   

Configuration:

logins:
  - username: mqtt
    password: '123'
customize:
  active: false
  folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false

Note: username and password just replace by yourself.

3. MQTT communication
   


4. MQTT communication test

Configuration-->Devices & Services --> Mosquitto broker "CONFIGURE"
   

Print this item

Wink [Arduino IDE demo source code for KC868-A32]--#06-RS485
Posted by: KinCony Support - 03-24-2022, 07:03 AM - Forum: KC868-A32/A32 Pro - Replies (1)

Code:
void setup() {
 Serial1.begin(9600);    //Serial 1
}

void loop() {
Serial1.println("KinCony");
delay(1500);
}

Print this item

Wink [Arduino IDE demo source code for KC868-A32]--#05-PCF8574-DO
Posted by: KinCony Support - 03-24-2022, 06:59 AM - Forum: KC868-A32/A32 Pro - Replies (2)

Code:
#include "Arduino.h"
#include "PCF8574.h"

TwoWire I2Ctwo = TwoWire(1);

// Set i2c address
PCF8574 pcf8574_R1(&I2Ctwo, 0x24, 15, 13);
PCF8574 pcf8574_R2(&I2Ctwo, 0x25, 15, 13);
PCF8574 pcf8574_R3(&I2Ctwo, 0x21, 15, 13);
PCF8574 pcf8574_R4(&I2Ctwo, 0x22, 15, 13);

void setup()
{
    Serial.begin(115200);
//    delay(1000);

    // Set pinMode to OUTPUT
pcf8574_R1.pinMode(P0, OUTPUT);
pcf8574_R1.pinMode(P1, OUTPUT);
pcf8574_R1.pinMode(P2, OUTPUT);
pcf8574_R1.pinMode(P3, OUTPUT);
pcf8574_R1.pinMode(P4, OUTPUT);
pcf8574_R1.pinMode(P5, OUTPUT);
pcf8574_R1.pinMode(P6, OUTPUT);
pcf8574_R1.pinMode(P7, OUTPUT);

pcf8574_R2.pinMode(P0, OUTPUT);
pcf8574_R2.pinMode(P1, OUTPUT);
pcf8574_R2.pinMode(P2, OUTPUT);
pcf8574_R2.pinMode(P3, OUTPUT);
pcf8574_R2.pinMode(P4, OUTPUT);
pcf8574_R2.pinMode(P5, OUTPUT);
pcf8574_R2.pinMode(P6, OUTPUT);
pcf8574_R2.pinMode(P7, OUTPUT);

pcf8574_R3.pinMode(P0, OUTPUT);
pcf8574_R3.pinMode(P1, OUTPUT);
pcf8574_R3.pinMode(P2, OUTPUT);
pcf8574_R3.pinMode(P3, OUTPUT);
pcf8574_R3.pinMode(P4, OUTPUT);
pcf8574_R3.pinMode(P5, OUTPUT);
pcf8574_R3.pinMode(P6, OUTPUT);
pcf8574_R3.pinMode(P7, OUTPUT);

pcf8574_R4.pinMode(P0, OUTPUT);
pcf8574_R4.pinMode(P1, OUTPUT);
pcf8574_R4.pinMode(P2, OUTPUT);
pcf8574_R4.pinMode(P3, OUTPUT);
pcf8574_R4.pinMode(P4, OUTPUT);
pcf8574_R4.pinMode(P5, OUTPUT);
pcf8574_R4.pinMode(P6, OUTPUT);
pcf8574_R4.pinMode(P7, OUTPUT);

    Serial.print("Init pcf8574_R1...");
    if (pcf8574_R1.begin()){
        Serial.println("PCF8574_R1_OK");
    }else{
        Serial.println("PCF8574_R1_KO");
    }

  Serial.print("Init pcf8574_R2...");
  if (pcf8574_R2.begin()){
    Serial.println("PCF8574_R2_OK");
  }else{
    Serial.println("PCF8574_R2_KO");
  }

  Serial.print("Init pcf8574_R3...");
  if (pcf8574_R3.begin()){
    Serial.println("PCF8574_R3_OK");
  }else{
    Serial.println("PCF8574_R3_KO");
  }

  Serial.print("Init pcf8574_R4...");
  if (pcf8574_R4.begin()){
    Serial.println("PCF8574_R4_OK");
  }else{
    Serial.println("PCF8574_R4_KO");
  }



}

void loop()
{
    pcf8574_R1.digitalWrite(P0, LOW);
  delay(200);
  pcf8574_R1.digitalWrite(P1, LOW);
  delay(200);
  pcf8574_R1.digitalWrite(P2, LOW);
  delay(200);
  pcf8574_R1.digitalWrite(P3, LOW);
  delay(200);
  pcf8574_R1.digitalWrite(P4, LOW);
  delay(200);
  pcf8574_R1.digitalWrite(P5, LOW);
  delay(200);
  pcf8574_R1.digitalWrite(P6, LOW);
  delay(200);
  pcf8574_R1.digitalWrite(P7, LOW);
  delay(200);

  pcf8574_R2.digitalWrite(P0, LOW);
  delay(200);
  pcf8574_R2.digitalWrite(P1, LOW);
  delay(200);
  pcf8574_R2.digitalWrite(P2, LOW);
  delay(200);
  pcf8574_R2.digitalWrite(P3, LOW);
  delay(200);
  pcf8574_R2.digitalWrite(P4, LOW);
  delay(200);
  pcf8574_R2.digitalWrite(P5, LOW);
  delay(200);
  pcf8574_R2.digitalWrite(P6, LOW);
  delay(200);
  pcf8574_R2.digitalWrite(P7, LOW);
  delay(200);

  pcf8574_R3.digitalWrite(P0, LOW);
  delay(200);
  pcf8574_R3.digitalWrite(P1, LOW);
  delay(200);
  pcf8574_R3.digitalWrite(P2, LOW);
  delay(200);
  pcf8574_R3.digitalWrite(P3, LOW);
  delay(200);
  pcf8574_R3.digitalWrite(P4, LOW);
  delay(200);
  pcf8574_R3.digitalWrite(P5, LOW);
  delay(200);
  pcf8574_R3.digitalWrite(P6, LOW);
  delay(200);
  pcf8574_R3.digitalWrite(P7, LOW);
  delay(200);

  pcf8574_R4.digitalWrite(P0, LOW);
  delay(200);
  pcf8574_R4.digitalWrite(P1, LOW);
  delay(200);
  pcf8574_R4.digitalWrite(P2, LOW);
  delay(200);
  pcf8574_R4.digitalWrite(P3, LOW);
  delay(200);
  pcf8574_R4.digitalWrite(P4, LOW);
  delay(200);
  pcf8574_R4.digitalWrite(P5, LOW);
  delay(200);
  pcf8574_R4.digitalWrite(P6, LOW);
  delay(200);
  pcf8574_R4.digitalWrite(P7, LOW);
  delay(200);
}
       

Print this item

Wink [Arduino IDE demo source code for KC868-A32]--#04-PCF8574-DI
Posted by: KinCony Support - 03-24-2022, 06:53 AM - Forum: KC868-A32/A32 Pro - No Replies

Code:
/*
KeyPressed on PIN1
by Mischianti Renzo <http://www.mischianti.org>

https://www.mischianti.org/2019/01/02/pcf8574-i2c-digital-i-o-expander-fast-easy-usage/
*/

#include "Arduino.h"
#include "PCF8574.h"


// Instantiate Wire for generic use at 400kHz
TwoWire I2Cone = TwoWire(0);
// Instantiate Wire for generic use at 100kHz
TwoWire I2Ctwo = TwoWire(1);

// Set i2c address
PCF8574 pcf8574_I1(0x24);
PCF8574 pcf8574_I2(0x25);
PCF8574 pcf8574_I3(0x21);
PCF8574 pcf8574_I4(0x22);



unsigned long timeElapsed;
void setup()
{
    Serial.begin(115200);
    delay(1000);

//    pcf8574.pinMode(P0, OUTPUT);
pcf8574_I1.pinMode(P0, INPUT);
pcf8574_I1.pinMode(P1, INPUT);
pcf8574_I1.pinMode(P2, INPUT);
pcf8574_I1.pinMode(P3, INPUT);
pcf8574_I1.pinMode(P4, INPUT);
pcf8574_I1.pinMode(P5, INPUT);
pcf8574_I1.pinMode(P6, INPUT);
pcf8574_I1.pinMode(P7, INPUT);

pcf8574_I2.pinMode(P0, INPUT);
pcf8574_I2.pinMode(P1, INPUT);
pcf8574_I2.pinMode(P2, INPUT);
pcf8574_I2.pinMode(P3, INPUT);
pcf8574_I2.pinMode(P4, INPUT);
pcf8574_I2.pinMode(P5, INPUT);
pcf8574_I2.pinMode(P6, INPUT);
pcf8574_I2.pinMode(P7, INPUT);

pcf8574_I3.pinMode(P0, INPUT);
pcf8574_I3.pinMode(P1, INPUT);
pcf8574_I3.pinMode(P2, INPUT);
pcf8574_I3.pinMode(P3, INPUT);
pcf8574_I3.pinMode(P4, INPUT);
pcf8574_I3.pinMode(P5, INPUT);
pcf8574_I3.pinMode(P6, INPUT);
pcf8574_I3.pinMode(P7, INPUT);

pcf8574_I4.pinMode(P0, INPUT);
pcf8574_I4.pinMode(P1, INPUT);
pcf8574_I4.pinMode(P2, INPUT);
pcf8574_I4.pinMode(P3, INPUT);
pcf8574_I4.pinMode(P4, INPUT);
pcf8574_I4.pinMode(P5, INPUT);
pcf8574_I4.pinMode(P6, INPUT);
pcf8574_I4.pinMode(P7, INPUT);



    Serial.print("Init pcf8574...");
    if (pcf8574_I1.begin()){
        Serial.println("pcf8574_I1_OK");
    }else{
        Serial.println("pcf8574_I1_KO");
    }

  Serial.print("Init pcf8574...");
  if (pcf8574_I2.begin()){
    Serial.println("pcf8574_I2_OK");
  }else{
    Serial.println("pcf8574_I2_KO");
  }

  Serial.print("Init pcf8574_I3...");
  if (pcf8574_I3.begin()){
    Serial.println("pcf8574_I3_OK");
  }else{
    Serial.println("pcf8574_I3_KO");
  }

  Serial.print("Init pcf8574_I4...");
  if (pcf8574_I4.begin()){
    Serial.println("pcf8574_I4_OK");
  }else{
    Serial.println("pcf8574_I4_KO");
  }

}

void loop()
{
uint8_t val1 = pcf8574_I1.digitalRead(P0);
uint8_t val2 = pcf8574_I1.digitalRead(P1);
uint8_t val3 = pcf8574_I1.digitalRead(P2);
uint8_t val4 = pcf8574_I1.digitalRead(P3);
uint8_t val5 = pcf8574_I1.digitalRead(P4);
uint8_t val6 = pcf8574_I1.digitalRead(P5);
uint8_t val7 = pcf8574_I1.digitalRead(P6);
uint8_t val8 = pcf8574_I1.digitalRead(P7);

uint8_t val9 = pcf8574_I2.digitalRead(P0);
uint8_t val10 = pcf8574_I2.digitalRead(P1);
uint8_t val11 = pcf8574_I2.digitalRead(P2);
uint8_t val12 = pcf8574_I2.digitalRead(P3);
uint8_t val13 = pcf8574_I2.digitalRead(P4);
uint8_t val14 = pcf8574_I2.digitalRead(P5);
uint8_t val15 = pcf8574_I2.digitalRead(P6);
uint8_t val16 = pcf8574_I2.digitalRead(P7);


uint8_t val17 = pcf8574_I3.digitalRead(P0);
uint8_t val18 = pcf8574_I3.digitalRead(P1);
uint8_t val19 = pcf8574_I3.digitalRead(P2);
uint8_t val20 = pcf8574_I3.digitalRead(P3);
uint8_t val21 = pcf8574_I3.digitalRead(P4);
uint8_t val22 = pcf8574_I3.digitalRead(P5);
uint8_t val23 = pcf8574_I3.digitalRead(P6);
uint8_t val24 = pcf8574_I3.digitalRead(P7);


uint8_t val25 = pcf8574_I4.digitalRead(P0);
uint8_t val26 = pcf8574_I4.digitalRead(P1);
uint8_t val27 = pcf8574_I4.digitalRead(P2);
uint8_t val28 = pcf8574_I4.digitalRead(P3);
uint8_t val29 = pcf8574_I4.digitalRead(P4);
uint8_t val30 = pcf8574_I4.digitalRead(P5);
uint8_t val31 = pcf8574_I4.digitalRead(P6);
uint8_t val32 = pcf8574_I4.digitalRead(P7);
 
if (val1==LOW) Serial.println("KEY1 PRESSED");
if (val2==LOW) Serial.println("KEY2 PRESSED");
if (val3==LOW) Serial.println("KEY3 PRESSED");
if (val4==LOW) Serial.println("KEY4 PRESSED");
if (val5==LOW) Serial.println("KEY5 PRESSED");
if (val6==LOW) Serial.println("KEY6 PRESSED");
if (val7==LOW) Serial.println("KEY7 PRESSED");
if (val8==LOW) Serial.println("KEY8 PRESSED");

if (val9==LOW) Serial.println("KEY9 PRESSED");
if (val10==LOW) Serial.println("KEY10 PRESSED");
if (val11==LOW) Serial.println("KEY11 PRESSED");
if (val12==LOW) Serial.println("KEY12 PRESSED");
if (val13==LOW) Serial.println("KEY13 PRESSED");
if (val14==LOW) Serial.println("KEY14 PRESSED");
if (val15==LOW) Serial.println("KEY15 PRESSED");
if (val16==LOW) Serial.println("KEY16 PRESSED");

if (val17==LOW) Serial.println("KEY17 PRESSED");
if (val18==LOW) Serial.println("KEY18 PRESSED");
if (val19==LOW) Serial.println("KEY19 PRESSED");
if (val20==LOW) Serial.println("KEY20 PRESSED");
if (val21==LOW) Serial.println("KEY21 PRESSED");
if (val22==LOW) Serial.println("KEY22 PRESSED");
if (val23==LOW) Serial.println("KEY23 PRESSED");
if (val24==LOW) Serial.println("KEY24 PRESSED");

if (val25==LOW) Serial.println("KEY25 PRESSED");
if (val26==LOW) Serial.println("KEY26 PRESSED");
if (val27==LOW) Serial.println("KEY27 PRESSED");
if (val28==LOW) Serial.println("KEY28 PRESSED");
if (val29==LOW) Serial.println("KEY29 PRESSED");
if (val30==LOW) Serial.println("KEY30 PRESSED");
if (val31==LOW) Serial.println("KEY31 PRESSED");
if (val32==LOW) Serial.println("KEY32 PRESSED");
    delay(300);
}
       

Print this item

Wink [Arduino IDE demo source code for KC868-A32]--#03-Nextion TFT LCD Display
Posted by: KinCony Support - 03-24-2022, 06:34 AM - Forum: KC868-A32/A32 Pro - No Replies

Code:
int i=0;

void setup()
{
Serial2.begin(9600);
}

void loop()
{
i++;
if (i==100) i=0;

Serial2.print("n0.val=");
Serial2.print(i);
Serial2.write(0xff);
Serial2.write(0xff);
Serial2.write(0xff);
delay(200);

}
   

Print this item

Wink [Arduino IDE demo source code for KC868-A32]--#02-LAN8720_UDP
Posted by: KinCony Support - 03-24-2022, 06:29 AM - Forum: KC868-A32/A32 Pro - No Replies

Code:
#include <ETH.h>
#include <WiFiUdp.h>

#define ETH_ADDR        0
#define ETH_POWER_PIN  -1
#define ETH_MDC_PIN    23
#define ETH_MDIO_PIN   18
#define ETH_TYPE       ETH_PHY_LAN8720
#define ETH_CLK_MODE   ETH_CLOCK_GPIO17_OUT

WiFiUDP Udp;                      //Create UDP object
unsigned int localUdpPort = 4196; //local port
IPAddress local_ip(192, 168, 1, 200);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);
IPAddress dns(192, 168, 1, 1);

void setup()
{
  Serial.begin(115200);
  Serial.println();
   
  ETH.begin(ETH_ADDR, ETH_POWER_PIN, ETH_MDC_PIN, ETH_MDIO_PIN, ETH_TYPE, ETH_CLK_MODE); //start with ETH

  // write confir for static IP, gateway,subnet,dns1,dns2
  if (ETH.config(local_ip, gateway, subnet, dns, dns) == false) {
    Serial.println("LAN8720 Configuration failed.");
  }else{Serial.println("LAN8720 Configuration success.");}
 
/* while(!((uint32_t)ETH.localIP())) //wait for IP
  {

  }*/
  Serial.println("Connected");
  Serial.print("IP Address:");
  Serial.println(ETH.localIP());

  Udp.begin(localUdpPort); //begin UDP listener
}

void loop()
{
  int packetSize = Udp.parsePacket(); //get package size
  if (packetSize)                     //if have received data
  {
    char buf[packetSize];
    Udp.read(buf, packetSize); //read current data

    Serial.println();
    Serial.print("Received: ");
    Serial.println(buf);
    Serial.print("From IP: ");
    Serial.println(Udp.remoteIP());
    Serial.print("From Port: ");
    Serial.println(Udp.remotePort());

    Udp.beginPacket(Udp.remoteIP(), Udp.remotePort()); //ready to send data
    Udp.print("Received: ");   
    Udp.write((const uint8_t*)buf, packetSize); //copy data to sender buffer
    Udp.endPacket();            //send data
  }
}
   

Print this item