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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 8,475
» Latest member: royalloungeseo
» Forum threads: 3,707
» Forum posts: 19,109

Full Statistics

Online Users
There are currently 23 online users.
» 0 Member(s) | 11 Guest(s)
AhrefsBot, Amazonbot, Crawl, Sogou web, bot

Latest Threads
KC868-A16 - IP & PORT ?? ...
Forum: KC868-A16
Last Post: Guele1
27 minutes ago
» Replies: 12
» Views: 940
Connect um330 and kc828 a...
Forum: DIY Project
Last Post: gtd0916
1 hour ago
» Replies: 31
» Views: 3,737
[arduino code examples fo...
Forum: B24M
Last Post: admin
5 hours ago
» Replies: 4
» Views: 264
"KCS" v3.19.1 firmware BI...
Forum: "KCS" v3 firmware
Last Post: admin
7 hours ago
» Replies: 0
» Views: 10
Problema a cargar .bin al...
Forum: KC868-A2
Last Post: admin
10 hours ago
» Replies: 9
» Views: 106
KC868-A16 ethernet work w...
Forum: KC868-A16
Last Post: admin
11 hours ago
» Replies: 22
» Views: 16,334
flasg esp unexpected erro...
Forum: KC868-A8
Last Post: admin
11 hours ago
» Replies: 15
» Views: 3,183
KC868-D16 dimmer controll...
Forum: KC868-HxB series Smart Controller
Last Post: admin
11 hours ago
» Replies: 13
» Views: 1,985
Z1
Forum: KC868-A16v3
Last Post: Borg357
Yesterday, 02:22 AM
» Replies: 6
» Views: 45
B24M output mosfet relay ...
Forum: B24M
Last Post: admin
01-20-2026, 09:02 PM
» Replies: 3
» Views: 34

  Rotary encoder
Posted by: pietervanstee - 12-13-2022, 09:44 AM - Forum: KC868-A series and Uair Smart Controller - Replies (3)

Hi there,

I'm looking for some information which I can't find about the implementation of a rotary encoder.
I assume this can just be used as a binary input device... which occupies 3 inputs?
CW, CCW, & push

[Image: S366ca414d923475dbfae4b2b2cca49754.jpg?w...&hash=1600]
For example:
https://nl.aliexpress.com/item/100500382...hXBlKonYzV


Thanks,
Pieter

Print this item

Lightbulb ESP32 RF
Posted by: Matt - 12-13-2022, 09:27 AM - Forum: KC868-Server Raspberry Pi4 local server - Replies (49)

Hi! (first of all thx for nice products ;-))

I try to program RF remote.. (on server)
I follow : https://www.kincony.com/home-automation-...moter.html

Flashed the esp i see the codes in the serial monitor but the outputs are not responding..

I think i edit the example right : (just a few buttons to test)

#include <RCSwitch.h>
#include "PinDefinitionsAndMore.h"
#include <IRremote.h>

RCSwitch mySwitch = RCSwitch();
long int keycode=0;
long int temp_keycode=0;


void setup()
{
  Serial.begin(9600);
  Serial1.begin(38400);
  mySwitch.enableReceive(digitalPinToInterrupt(13));

  IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK, USE_DEFAULT_FEEDBACK_LED_PIN);
}

void loop() {
  if (mySwitch.available()) {
   
    Serial.print("Received ");
    Serial.print( mySwitch.getReceivedValue() );
    Serial.print(" / ");
    Serial.print( mySwitch.getReceivedBitlength() );
    Serial.print("bit ");
    Serial.print("Protocol: ");
    Serial.println( mySwitch.getReceivedProtocol() );
    keycode=mySwitch.getReceivedValue();

    if (keycode==1376533) {Serial1.print("RELAY-KEY-255,1,1");delay(500);}  //toggle relay1
    if (keycode==1376532) {Serial1.print("RELAY-KEY-255,2,1");delay(500);}  //toggle relay2
    if (keycode==16405) {Serial1.print("RELAY-KEY-255,3,1");delay(500);}  //toggle relay3
    if (keycode==16404) {Serial1.print("RELAY-KEY-255,4,1");delay(500);}  //toggle relay4
    if (keycode==4117) {Serial1.print("RELAY-KEY-255,5,1");delay(500);}  //toggle relay5
    if (keycode==5723139) {Serial1.print("RELAY-KEY-255,6,1");delay(500);}  //toggle relay6
    if (keycode==20501) {Serial1.print("RELAY-KEY-255,7,1");delay(500);}  //toggle relay7
    if (keycode==20500) {Serial1.print("RELAY-KEY-255,8,1");delay(500);}  //toggle relay8
    if (keycode==5576131) {Serial1.print("RELAY-KEY-255,9,1");delay(500);}  //toggle relay9
    if (keycode==5575951) {Serial1.print("RELAY-KEY-255,10,1");delay(500);}  //toggle relay10
    if (keycode==5576188) {Serial1.print("RELAY-KEY-255,11,1");delay(500);}  //toggle relay11
    if (keycode==5576179) {Serial1.print("RELAY-KEY-255,12,1");delay(500);}  //toggle relay12
    if (keycode==5576191) {Serial1.print("RELAY-KEY-255,13,1");delay(500);}  //toggle relay13
    if (keycode==5576128) {Serial1.print("RELAY-KEY-255,14,1");delay(500);}  //toggle relay14
    if (keycode==5575987) {Serial1.print("RELAY-KEY-255,15,1");delay(500);}  //toggle relay15
    if (keycode==5575936) {Serial1.print("RELAY-KEY-255,16,1");delay(500);}  //toggle relay16

    mySwitch.resetAvailable();
  }

    if (IrReceiver.decode()) {

        // Print a short summary of received data
        IrReceiver.printIRResultShort(&Serial);
        if (IrReceiver.decodedIRData.protocol == UNKNOWN) {
            // We have an unknown protocol here, print more info
            IrReceiver.printIRResultRawFormatted(&Serial, true);
        }
        Serial.println();
        IrReceiver.resume(); // Enable receiving of the next value
   
    if (IrReceiver.decodedIRData.command == 0x15) Serial1.print("RELAY-SET-255,1,1"); //turn ON relay1
    if (IrReceiver.decodedIRData.command == 0x16) Serial1.print("RELAY-SET-255,1,0"); //turn OFF relay1
    if (IrReceiver.decodedIRData.command == 0x17) Serial1.print("RELAY-SET-255,2,1"); //turn ON relay2
    if (IrReceiver.decodedIRData.command == 0x19) Serial1.print("RELAY-SET-255,2,0"); //turn OFF relay2
    if (IrReceiver.decodedIRData.command == 0x1A) Serial1.print("RELAY-SET-255,3,1"); //turn ON relay3
    if (IrReceiver.decodedIRData.command == 0x1B) Serial1.print("RELAY-SET-255,3,0"); //turn OFF relay3
    if (IrReceiver.decodedIRData.command == 0x1D) Serial1.print("RELAY-SET-255,4,1"); //turn ON relay4
    if (IrReceiver.decodedIRData.command == 0x1E) Serial1.print("RELAY-SET-255,4,0"); //turn OFF relay4
    if (IrReceiver.decodedIRData.command == 0x1F) Serial1.print("RELAY-SET-255,5,1"); //turn ON relay5
    if (IrReceiver.decodedIRData.command == 0x41) Serial1.print("RELAY-SET-255,5,0"); //turn OFF relay5
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,6,1"); //turn OFF relay6
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,6,0"); //turn OFF relay6
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,7,1"); //turn OFF relay7
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,7,0"); //turn OFF relay7
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,8,1"); //turn OFF relay8
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,8,0"); //turn OFF relay8
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,9,1"); //turn OFF relay9
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,9,0"); //turn OFF relay9
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,10,1"); //turn OFF relay10
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,10,0"); //turn OFF relay10
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,11,1"); //turn OFF relay11
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,11,0"); //turn OFF relay11
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,12,1"); //turn OFF relay12
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,12,0"); //turn OFF relay12
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,13,1"); //turn OFF relay13
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,13,0"); //turn OFF relay13
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,14,1"); //turn OFF relay14
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,14,0"); //turn OFF relay14
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,15,1"); //turn OFF relay15
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,15,0"); //turn OFF relay15
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,16,1"); //turn OFF relay16
    if (IrReceiver.decodedIRData.command == 0x42) Serial1.print("RELAY-SET-255,16,0"); //turn OFF relay16
    }
}


Thx in advance..

Kind regards,

Matt

Print this item

  Home Assistant 2022.12.0
Posted by: Mandlap - 12-12-2022, 09:31 PM - Forum: KC868-Server Raspberry Pi4 local server - Replies (9)

I have updated my KC868-server to Home Assistant 2022.12.0, now all my sensors and switches from my KC868-Server are "unavailable".
below is my sample configuration. Is the a new configuration for HA 2022.12.0, as they have been warning that this updates will affect the sensor.
 
mqtt:
  broker: 192.168.0.118
  port: 1883
  username: mqtt
  password: 1232332TESETEST

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

  - platform: mqtt
    name: 'output-2'
    unique_id: output-2
    state_topic: 'server/a767350037679/state'
    command_topic: 'server/a767350037679/set'
    payload_on:  '{"relay2":{"on":1}}'
    payload_off:  '{"relay2":{"on":0}}'


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

  - platform: mqtt
    name: 'input-2'
    unique_id: input-2
    state_topic: 'server/a767350037679/state'
    value_template: '{{ value_json.input2.on }}'
    payload_on: 1
    payload_off: 0
    value_template: '{{ value_json.relay2.on }}'
    state_on: 1
    state_off: 0

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

Print this item

  how to connect celling pir sensor with h32b pro
Posted by: engmohades - 12-12-2022, 12:17 PM - Forum: News - Replies (3)

how to connect celling pir sensor with h32b pro ?

there are ( + - ) ( tamper ) ( alarm ) 

What is the tamper and How can I use the tamper in the home automation ?



Attached Files Thumbnail(s)
   
Print this item

  facttoy values KC868-A8
Posted by: Isaac639 - 12-12-2022, 08:43 AM - Forum: KC868-A8 - Replies (1)

Hello, 
I have KC868-A8 v.1.4
How can I reset the motherboard to factory settings?

Thank you very much!
Isaac.

Print this item

  KC868-HA ESP32 arduino demo code work with KC868-A8S
Posted by: admin - 12-12-2022, 12:43 AM - Forum: KC868-HxB series Smart Controller - Replies (4)

This is arduino demo code for KC868-A8S board, you can use for any KC868-A series board just have RS485 interface.
The function is press 6 digital input trigger relay output and feedback relay state to switch panel's LEDs. When press the switch panel buttons, will control KC868-A8S relay output.
arduino code download link:

.zip   KC868-HA-A8S-Demo.zip (Size: 1.79 KB / Downloads: 748)

           

Print this item

  KC868-HA ESP32 arduino demo code work with KC868-A8S
Posted by: admin - 12-12-2022, 12:39 AM - Forum: KC868-A series and Uair Smart Controller - No Replies

This is arduino demo code for KC868-A8S board, you can use for any KC868-A series board just have RS485 interface.
The function is press 6 digital input trigger relay output and feedback relay state to switch panel's LEDs. When press the switch panel buttons, will control KC868-A8S relay output.
arduino code download link:

.zip   KC868-HA-A8S-Demo.zip (Size: 1.79 KB / Downloads: 600)
           

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

#define  RS485Address   0x01

#define  USB_TX_PIN   1
#define  USB_RX_PIN   3
#define  M485_TX_PIN   33
#define  M485_RX_PIN   32

// Set i2c address
PCF8574 pcf8574o(0x24,4,5);
PCF8574 pcf8574i(0x22,4,5);

unsigned long switch_32_1_state = 0;

uint16_t  CRC16_Data = 0;
uint8_t  CRC16_Data_H = 0;
uint8_t  CRC16_Data_L = 0;

unsigned char Rs485_Str[30] = {0};

String indata="";
String val="";

String outdata="";

void setup()
{
  // Serial 0 with USB
  Serial.begin(9600,SERIAL_8N1,USB_RX_PIN,USB_TX_PIN);
  // Serial 2 with 485
  Serial2.begin(9600,SERIAL_8N1,M485_RX_PIN,M485_TX_PIN);

  Serial.println();

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

  Serial.print("Init pcf8574o...");
  if (pcf8574o.begin()){
    Serial.println("OK");
  }else{
    Serial.println("KO");
  }


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

  Serial.print("Init pcf8574i...");
  if (pcf8574i.begin()){
    Serial.println("OK");
  }else{
    Serial.println("KO");
  }


pcf8574o.digitalWrite(P0, HIGH);
pcf8574o.digitalWrite(P1, HIGH);
pcf8574o.digitalWrite(P2, HIGH);
pcf8574o.digitalWrite(P3, HIGH);
pcf8574o.digitalWrite(P4, HIGH);
pcf8574o.digitalWrite(P5, HIGH);
pcf8574o.digitalWrite(P6, HIGH);
pcf8574o.digitalWrite(P7, HIGH);


}

void loop()
{
//------------------------------------

//sample IO
  PCF8574::DigitalInput di = pcf8574i.digitalReadAll();

  if(!((di.p0)&&(di.p1)&&(di.p2)&&(di.p3)&&(di.p4)&&(di.p5)&&(di.p6)&&(di.p7)))
  {
      if(di.p0==0)  
      {
        if(((switch_32_1_state&0x01)?1:0) == 0 )
        {
        pcf8574o.digitalWrite(P0, LOW);
        switch_32_1_state = switch_32_1_state | (1<<(1-1));
        }
        else
        {
        pcf8574o.digitalWrite(P0, HIGH);
        switch_32_1_state = switch_32_1_state & (~(1<<(1-1)));
        }

      }     


      if(di.p1==0)  
      {
     
        if(((switch_32_1_state&0x02)?1:0) == 0 )
        {
        pcf8574o.digitalWrite(P1, LOW);
        switch_32_1_state = switch_32_1_state | (1<<(2-1));
        }
        else
        {
        pcf8574o.digitalWrite(P1, HIGH);
        switch_32_1_state = switch_32_1_state & (~(1<<(2-1)));
        }

      }     


      if(di.p2==0)  
      {
     
        if(((switch_32_1_state&0x04)?1:0) == 0 )
        {
        pcf8574o.digitalWrite(P2, LOW);
        switch_32_1_state = switch_32_1_state | (1<<(3-1));
        }
        else
        {
        pcf8574o.digitalWrite(P2, HIGH);
        switch_32_1_state = switch_32_1_state & (~(1<<(3-1)));
        }

      }     


      if(di.p3==0)  
      {
     
        if(((switch_32_1_state&0x08)?1:0) == 0 )
        {
        pcf8574o.digitalWrite(P3, LOW);
        switch_32_1_state = switch_32_1_state | (1<<(4-1));
        }
        else
        {
        pcf8574o.digitalWrite(P3, HIGH);
        switch_32_1_state = switch_32_1_state & (~(1<<(4-1)));
        }

   }     


      if(di.p4==0)  
      {
        if(((switch_32_1_state&0x10)?1:0) == 0 )
        {
        pcf8574o.digitalWrite(P4, LOW);
        switch_32_1_state = switch_32_1_state | (1<<(5-1));
        }
        else
        {
        pcf8574o.digitalWrite(P4, HIGH);
        switch_32_1_state = switch_32_1_state & (~(1<<(5-1)));
        }

      }     


      if(di.p5==0)  
      {
        if(((switch_32_1_state&0x20)?1:0) == 0 )
        {
        pcf8574o.digitalWrite(P5, LOW);
        switch_32_1_state = switch_32_1_state | (1<<(6-1));
        }
        else
        {
        pcf8574o.digitalWrite(P5, HIGH);
        switch_32_1_state = switch_32_1_state & (~(1<<(6-1)));
        }

      }     


      if(di.p6==0)  
      {
        if(((switch_32_1_state&0x40)?1:0) == 0 )
        {
        pcf8574o.digitalWrite(P6, LOW);
        switch_32_1_state = switch_32_1_state | (1<<(7-1));
        }
        else
        {
        pcf8574o.digitalWrite(P6, HIGH);
        switch_32_1_state = switch_32_1_state & (~(1<<(7-1)));
        }

      }     


      if(di.p7==0)  
      {
     
        if(((switch_32_1_state&0x80)?1:0) == 0 )
        {
        pcf8574o.digitalWrite(P7, LOW);
        switch_32_1_state = switch_32_1_state | (1<<(8-1));
        }
        else
        {
        pcf8574o.digitalWrite(P7, HIGH);
        switch_32_1_state = switch_32_1_state & (~(1<<(8-1)));
        }

      }   


     rs485_feedback();
}

  while(!((di.p0==1)&&(di.p1==1)&&(di.p2==1)&&(di.p3==1)&&(di.p4==1)&&(di.p5==1)&&(di.p6==1)&&(di.p7==1)))
   {
    di = pcf8574i.digitalReadAll();
   }
//------------------------------------
//read RS485 data
while(Serial2.available()>0)
   {
    indata+=char(Serial2.read());   //read  via 485
    delay(2);
    if(Serial2.available()<=0)
     {
        //Serial2.print(indata);
     }
   }   
//------------------------------------
//deal with RS485 data
if(indata.length()>0)
  {
     val=indata;   //
               Serial.print(indata);

      //----Key control relay command 
    if((val[0]==RS485Address)&&(val[1]==0x10)&&(val[2]==0x00)&&(val[3]==0x0A)&&(val[4]==0x00)&&(val[5]==0x06)&&(val[6]==0x0C))
    {
        val[7] = (((val[7]>>4) & 0x0F)*10)+(val[7]& 0x0F); //bcd to hex
        val[8] = val[8] & 0x01;
        switch_32_1_state = switch_32_1_state ^ (val[8]<<(val[7]-1));

        val[9]  = (((val[9]>>4) & 0x0F)*10)+(val[9]& 0x0F); //bcd to hex
        val[10] = val[10] & 0x01;
        switch_32_1_state = switch_32_1_state ^ (val[10]<<(val[9]-1));
       
        val[11]  = (((val[11]>>4) & 0x0F)*10)+(val[11]& 0x0F); //bcd to hex
        val[12] = val[12] & 0x01;
        switch_32_1_state = switch_32_1_state ^ (val[12]<<(val[11]-1));
       
        val[13]  = (((val[13]>>4) & 0x0F)*10)+(val[13]& 0x0F); //bcd to hex
        val[14] = val[14] & 0x01;
        switch_32_1_state = switch_32_1_state ^ (val[14]<<(val[13]-1));
      
        val[15]  = (((val[15]>>4) & 0x0F)*10)+(val[15]& 0x0F); //bcd to hex
        val[16] = val[16] & 0x01;
        switch_32_1_state = switch_32_1_state ^ (val[16]<<(val[15]-1));

        val[17]  = (((val[17]>>4) & 0x0F)*10)+(val[17]& 0x0F); //bcd to hex
        val[18] = val[18] & 0x01;
        switch_32_1_state = switch_32_1_state ^ (val[18]<<(val[17]-1));

        //switch_1_state
        if(((switch_32_1_state&0x01)?1:0) == 0 )
        {
        pcf8574o.digitalWrite(P0, HIGH);
        }
        else
        {
        pcf8574o.digitalWrite(P0, LOW);
        }

        //switch_2_state
        if(((switch_32_1_state&0x02)?1:0) == 0 )
        {
        pcf8574o.digitalWrite(P1, HIGH);
        }
        else
        {
        pcf8574o.digitalWrite(P1, LOW);
        }

        //switch_3_state
        if(((switch_32_1_state&0x04)?1:0) == 0 )
        {
        pcf8574o.digitalWrite(P2, HIGH);
        }
        else
        {
        pcf8574o.digitalWrite(P2, LOW);
        }

        //switch_4_state
        if(((switch_32_1_state&0x08)?1:0) == 0 )
        {
        pcf8574o.digitalWrite(P3, HIGH);
        }
        else
        {
        pcf8574o.digitalWrite(P3, LOW);
        }

        //switch_5_state
        if(((switch_32_1_state&0x10)?1:0) == 0 )
        {
        pcf8574o.digitalWrite(P4, HIGH);
        }
        else
        {
        pcf8574o.digitalWrite(P4, LOW);
        }

        //switch_6_state
        if(((switch_32_1_state&0x20)?1:0) == 0 )
        {
        pcf8574o.digitalWrite(P5, HIGH);
        }
        else
        {
        pcf8574o.digitalWrite(P5, LOW);
        }

        //switch_7_state
        if(((switch_32_1_state&0x40)?1:0) == 0 )
        {
        pcf8574o.digitalWrite(P6, HIGH);
        }
        else
        {
        pcf8574o.digitalWrite(P6, LOW);
        }

        //switch_8_state
        if(((switch_32_1_state&0x80)?1:0) == 0 )
        {
        pcf8574o.digitalWrite(P7, HIGH);
        }
        else
        {
        pcf8574o.digitalWrite(P7, LOW);
        }

     rs485_feedback();
   
    }

  }
   
   
    indata="";   //clear indata
//--------------------------------------------------

 
  delay(30);
 
}

void rs485_feedback(void)
{
       Rs485_Str[0] = RS485Address;
       Rs485_Str[1] = 0x03;
       Rs485_Str[2] = 0x06;
       Rs485_Str[3] = 0x55;
       Rs485_Str[4] = 0xAA;
       Rs485_Str[5] = (int)((switch_32_1_state >> 24) & 0xFF);
       Rs485_Str[6] = (int)((switch_32_1_state >> 16) & 0xFF);
       Rs485_Str[7] = (int)((switch_32_1_state >> 8) & 0xFF);
       Rs485_Str[8] = (int)(switch_32_1_state & 0xFF);
      
       outdata = "12345678901";
       outdata[0] = Rs485_Str[0];
       outdata[1] = Rs485_Str[1];
       outdata[2] = Rs485_Str[2];
       outdata[3] = Rs485_Str[3];
       outdata[4] = Rs485_Str[4];
       outdata[5] = Rs485_Str[5];
       outdata[6] = Rs485_Str[6];
       outdata[7] = Rs485_Str[7];
       outdata[8] = Rs485_Str[8];
    
       CRC16_Data = (crc16((uint8_t *) Rs485_Str, 9, 0x8005, 0xFFFF, 0, true, true));
       CRC16_Data_H = CRC16_Data/256;
       CRC16_Data_L = CRC16_Data%256;
       outdata[9] = CRC16_Data_L;
       outdata[10] = CRC16_Data_H;
       Serial.print(outdata);
       Serial2.print(outdata);
}

Print this item

  Failed to restart Home Assistant
Posted by: Almhlws - 12-10-2022, 05:16 PM - Forum: KC868-HxB series Smart Controller - Replies (4)

The system cannot restart because the configuration is not valid: Invalid config for [mqtt]: [name:] is an invalid option for [mqtt]. Check: mqtt->mqtt->switch->2->name:. (See /config/configuration.yaml, line 17).




Quote:Loads default set of integrations. Do not remove.
default_config:
Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
Text to speech
tts:
• platform: google_translate
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
mqtt:
broker: 192.168.100.172
port: 1883
username: XXXX
password: XXX
Example configuration.yaml entry
switch:
• name: ‘output-1’
unique_id: output-1
state_topic: ‘server/c5a1fc1837679772e927e9de/state’
command_topic: ‘server/c5a1fc1837679772e927e9de/set’
payload_on: ‘{“relay1”:{“on”:1}}’
payload_off: ‘{“relay1”:{“on”:0}}’
value_template: ‘{{ value_json.relay1.on }}’
state_on: 1
state_off: 0
• name: ‘output-2’
unique_id: output-2
state_topic: ‘server/c5a1fc1837679772e927e9de/state’
command_topic: ‘server/c5a1fc1837679772e927e9de/set’
payload_on: ‘{“relay2”:{“on”:1}}’
payload_off: ‘{“relay2”:{“on”:0}}’
value_template: ‘{{ value_json.relay2.on }}’
state_on: 1
state_off: 0

Print this item

  KC868-A16 ESPHome yaml for DHT11/ds18b20 RF
Posted by: stanchiam - 12-09-2022, 01:22 AM - Forum: KC868-A16 - Replies (5)

Hi, 

I am using ESPhome and home assistant, tried the below yaml using REV1.5 board but not sure how to get the temperature sensor and RF receiver/transmitter(already installed) working on HA.

Is my yaml correct? I am not sure about the pin number used, from the board i see the dht data cable is fixed at HT3.
Please help take a look at the yaml and also how to use with HA. Unable to find info for ESPHome and HA using KC868-A16.

remote_receiver:
  pin: 2
  dump: rc_switch
  # Settings to optimize recognition of RF devices
  tolerance: 50%
  filter: 250us
  idle: 4ms
  buffer_size: 2kb
remote_transmitter:
  pin: 15
  carrier_duty_percent: 100%
# Example configuration entry for sensor
sensor:
  - platform: dht
    pin: 14
    temperature:
      name: "Temperature"
    humidity:
      name: "Humidity"
    update_interval: 10s
  # - platform: dallas
  #   pin: 14
  #   address: 0x1c0000031edd2a28
  #   name: "ds18b20-1"

Print this item

  KC868-HA RS485 Button Adapter Protocol document
Posted by: admin - 12-08-2022, 04:25 AM - Forum: KC868-HxB series Smart Controller - No Replies

Here is the protocol of KC868-HA RS485 Button Adapter, send command and relay state feedback protocol:



Attached Files
.pdf   KC868-HA-protocol-for-RS485-relay-board.pdf (Size: 204.94 KB / Downloads: 610)
Print this item