Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lesson31- How to decode 433MHz RF signal and control RF device by ESPHome
#1

esphome:
  name: kc868-a4
  platform: ESP32
  board: esp32dev

# Enable logging
logger:

# Enable Home Assistant API
api:

wifi:
  ssid: "KinCony"
  password: "xxxxxxxx"


captive_portal:

web_server:
  port: 80

remote_receiver:
  pin: 19
  dump:
    - rc_switch
  tolerance: 50%
  filter: 250us
  idle: 4ms
  buffer_size: 2kb

 
remote_transmitter:
  pin: 21
  # RF uses a 100% carrier signal
  carrier_duty_percent: 100%

switch:
  - platform: template
    name: RF Power Button
    turn_on_action:
      - remote_transmitter.transmit_rc_switch_raw:
          code: '0101011111111101000000111'
          protocol: 1
          repeat:
            times: 2
            wait_time: 20ms

    turn_off_action:
      - remote_transmitter.transmit_rc_switch_raw:
          code: '0101011111111101000000111'
          protocol: 1
          repeat:
            times: 2
            wait_time: 20ms
Reply
#2
Please guide step by step in configuring the RF mode in EspHome. I've watched all the tutorials posted here and I can't do it at all. The hardware is: KS868-A8, Rasberry Pi with Home Assistant.
I mention that in KCS Firmware v.2.0.2 ... the RF remote works correctly. In EspHome we already have a code... to actuate the relays and the imputs...etc.
My first question:
1. how do I learn and find out the codes from the remote control??
2. what code should I write in continuation of the existing one so that I can activate the relays on the board?

I can attach the code already uploaded ... and maybe someone can help me with the necessary steps.

Regards
.txt   EspHome Kc868 A8.txt (Size: 5.42 KB / Downloads: 291)
Reply
#3
your RF receiver module pin define is wrong.
if using KC868-A8, the pins of RF module should be:
RF433MHz wireless receiver: 2
RF433MHz wireless sender: 15

when you config correctly, press the remote's button, you will see the RF code on LOG output window.

here is example code you can use, just need replce the "code" and "protocol" by yourself:

- platform: remote_receiver
name: "remoter1"
rc_switch_raw:
code: '001111010111001010111000'
protocol: 1
on_press:
then:
- switch.toggle: light1
filters:
- delayed_off: 200ms
Reply
#4
After several unsuccessful tests.... I thought to reverse the pins of .. actually for the Receiver the pin is 15 and for the Transmitter the pin is 2. So... the pins are reversed.  Now I get signals from RF Remote . Pins are for KCS868-A8 v.1.5.
Now I want to write the lines of code above, but I keep getting different errors, please help me insert the code for RF Remote in the attached yaml file. All I want, when they press the button 1 from my remote... to activate Relay 1...and so on and on,,,. I will write the rest if I have a functional model. 
Regards


Attached Files
.txt   ks868-a8-1.txt (Size: 5.38 KB / Downloads: 202)
Reply
#5
(07-17-2023, 06:16 AM)iulik Wrote: After several unsuccessful tests.... I thought to reverse the pins of .. actually for the Receiver the pin is 15 and for the Transmitter the pin is 2. So... the pins are reversed.  Now I get signals from RF Remote . Pins are for KCS868-A8 v.1.5.
Now I want to write the lines of code above, but I keep getting different errors, please help me insert the code for RF Remote in the attached yaml file. All I want, when they press the button 1 from my remote... to activate Relay 1...and so on and on,,,. I will write the rest if I have a functional model. 
Regards

Problem resolved Smile
Reply
#6
good.
Reply
#7
I'm trying to setup my KC868-AG but can't learn the codes

Here's my ESPHome yaml file

```
esphome:
  name: kc868-a4
  friendly_name: "RF 433MHz Gateway"

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:


# Enable Home Assistant API

api:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

captive_portal:

web_server:
  port: 80

remote_receiver:
  pin: 19
  dump: all
  tolerance: 50%
  filter: 250us
  idle: 4ms
  buffer_size: 2kb

remote_transmitter:
  pin: 21
  # RF uses a 100% carrier signal
  carrier_duty_percent: 100%

switch:
  - platform: template
    name: RF Power Button
    turn_on_action:
      - remote_transmitter.transmit_rc_switch_raw:
          code: '0101011111111101000000111'
          protocol: 1
          repeat:
            times: 2
            wait_time: 20ms
    turn_off_action:
      - remote_transmitter.transmit_rc_switch_raw:
          code: '0101011111111101000000111'
          protocol: 1
          repeat:
            times: 2
            wait_time: 20ms

```

Here's the log file
```
INFO ESPHome 2023.10.1
INFO Reading configuration /config/esphome/kc868-ag.yaml...
INFO Starting log output from kc868-a4.local using esphome API
INFO Successfully connected to kc868-a4.local
[14:59:18][I][app:102]: ESPHome version 2023.10.1 compiled on Oct 23 2023, 14:37:50
[14:59:18][C][wifi:546]: WiFi:
[14:59:18][C][wifi:382]:  Local MAC: B8Big Grin6:1A:5A:AD:10
[14:59:18][C][wifi:383]:  SSID: [redacted]
[14:59:18][C][wifi:384]:  IP Address: 192.168.2.243
[14:59:18][C][wifi:386]:  BSSID: [redacted]
[14:59:18][C][wifi:387]:  Hostname: 'kc868-a4'
[14:59:18][C][wifi:389]:  Signal strength: -63 dB ▂▄▆█
[14:59:18][C][wifi:393]:  Channel: 11
[14:59:18][C][wifi:394]:  Subnet: 255.255.255.0
[14:59:18][C][wifi:395]:  Gateway: 192.168.2.1
[14:59:18][C][wifi:396]:  DNS1: 192.168.2.1
[14:59:18][C][wifi:397]:  DNS2: 0.0.0.0
[14:59:18][C][logger:361]: Logger:
[14:59:18][C][logger:362]:  Level: DEBUG
[14:59:18][C][logger:363]:  Log Baud Rate: 115200
[14:59:18][C][logger:365]:  Hardware UART: UART0
[14:59:18][C][remote_transmitter:015]: Remote Transmitter...
[14:59:18][C][remote_transmitter:016]:  Channel: 3
[14:59:18][C][remote_transmitter:017]:  RMT memory blocks: 1
[14:59:18][C][remote_transmitter:018]:  Clock divider: 80
[14:59:18][C][remote_transmitter:019]:  Pin: GPIO21
[14:59:18][C][remote_receiver.esp32:054]: Remote Receiver:
[14:59:18][C][remote_receiver.esp32:055]:  Pin: GPIO19
[14:59:18][C][remote_receiver.esp32:060]:  Channel: 0
[14:59:18][C][remote_receiver.esp32:061]:  RMT memory blocks: 3
[14:59:18][C][remote_receiver.esp32:062]:  Clock divider: 80
[14:59:18][C][remote_receiver.esp32:063]:  Tolerance: 50%
[14:59:18][C][remote_receiver.esp32:064]:  Filter out pulses shorter than: 250 us
[14:59:18][C][remote_receiver.esp32:065]:  Signal is done after 4000 us of no changes
[14:59:18][C][captive_portal:088]: Captive Portal:
[14:59:18][C][web_server:161]: Web Server:
[14:59:18][C][web_server:162]:  Address: kc868-a4.local:80
[14:59:18][C][mdns:115]: mDNS:
[14:59:18][C][mdns:116]:  Hostname: kc868-a4
[14:59:18][C][api:138]: API Server:
[14:59:18][C][api:139]:  Address: kc868-a4.local:6053
[14:59:18][C][api:143]:  Using noise encryption: NO
```

No log messages when pressing any button on the remote.

I have 2 remotes:
DD2702H | https://rollerhouses.com/products/dd2702...ooya-motor
MT02-0101-067008 | https://www.homeautomationandtubularmoto...101-050008

Looks like I'm missing something. One thing I noticed is the YT video shows a Home Assistant connected message I don't get.... Not sure what's this connection for.

Any idea why this is not working?
Reply
#8
I made some progress. Turns out I had the wrong ESP32 connected. Now when I press a button on the remote it shows some code.

Code:
[22:17:23][I][remote.pronto:237]: Received Pronto: data=0000 006D 00C1 0000 0003 0009 0002 0012 0007 003E 001C 0016 0008 0015 0005 0006 000B 0011 0001 000F 001C 000E 0017 0008 000C 000B 0017 000A 0008 0006 0038 0003 000F 0004 0026 0005 0004 0003 0017 0004 000A 0004 000D 000A 003C 0003
[22:17:23][I][remote.pronto:239]: 001E 0008 000C 000A 0011 0008 0009 0004 0012 0013 0016 0010 0004 0003 0002 001B 000D 0006 0006 0003 0004 000C 0005 0004 0006 0005 0013 0007 0003 0004 0012 0009 0002 000C 0068 0005 0006 0007 0003 0009 0003 0005 0003 000B 0006 0018 0003 0004 000D 0019 0022 0004 0007 000B 000A 001E 000C 0009 0039 0004 0008 0004 0004 0016 0005 0006 0009 0012 0014 0012 000C 000A 0003 0022 0005 0006 0009 000B 0015 0003 000E 0017 0003 000D 0005 000B 0005 000A 0001 000C 0001 0002 000E 0008 0001 0008
[22:17:23][W][component:214]: Component remote_receiver took a long time for an operation (0.07 s).
[22:17:23][W][component:215]: Components should block for at most 20-30ms.
[22:17:23][I][remote.pronto:237]: Received Pronto: data=0000 006D 0001 0000 000A 009B 06C3
[22:17:23][I][remote.pronto:237]: Received Pronto: data=0000 006D 0001 0000 0010 009B 06C3
[22:17:24][I][remote.pronto:237]: Received Pronto: data=0000 006D 0001 0000 0002 009B 06C3
[22:17:24][I][remote.pronto:237]: Received Pronto: data=0000 006D 0001 0000 0006 009B 06C3
[22:17:24][I][remote.pronto:237]: Received Pronto: data=0000 006D 0001 0000 0007 009B 06C3
[22:17:24][I][remote.pronto:237]: Received Pronto: data=0000 006D 0002 0000 000B 0034 000A 009B 06C3

I can't see any patterns here. However how do I interpret this code?
Also what's that warning message? It looks like the receiver took 70ms but should only take between 20-30ms?

Lastly for a remote - 2 blinds I can control individually (ch. 1 or 2) or as a group (ch. 0) - there are no on and off actions like in the example but simply button press. What are the appropriate actions to take here?

Code:
[22:00:13][W][component:214]: Component remote_receiver took a long time for an operation (0.07 s).
[22:00:13][W][component:215]: Components should block for at most 20-30ms.
Reply
#9
RF signal support 1527 or 2262 code's remote. you are using DOOYA brand remote, it's own keycode, not opened.
Reply
#10
What do you mean not opened? I have 3 RF remotes that show the following code and don't know which parts of the data blocks I need to use for the transmit actions

Remote 1
[07:30:32][I][remote.pronto:237]: Received Pronto: data=0000 006D 00C1 0000 0004 0021 0008 0023 0000 000A 0017 0014 000B 0007 000F 000C 0020 000B 000E 0004 0022 000C 0010 000A 0001 000D 0002 0005 0003 000A 0006 0011 000C 000E 0006 0004 000A 0005 0004 000B 000F 0008 0005 000F 0007 0008
[07:30:32][I][remote.pronto:239]: 0035 0009 0003 000E 0005 0005 0022 0008 0003 0004 0005 000A 000C 0003 003B 0010 0005 000A 0008 0009 0043 0007 0011 0004 000C 0005 0022 0006 0005 0006 0020 0002 0005 0003 0029 0007 0017 0003 0006 0003 0004 0004 0027 0006 0016 0012 0004 0010 0016 0006 0007 0008 0009 0003 0001 0023 0007 0015 0005 0002 0008 001F 0004 0004 0007 0020 0007 0007 0012 0007 0003 0005 000D 0006 0007 0005 0002 0003 0016 000A 0002 0005 0008 0011 000E 0004 0001 0014 000D 0004 0017 000C 0006 0006 0005 0006
[07:30:32][W][component:214]: Component remote_receiver took a long time for an operation (0.07 s).
[07:30:32][W][component:215]: Components should block for at most 20-30ms.
[07:30:32][I][remote.pronto:237]: Received Pronto: data=0000 006D 0001 0000 000E 009B 06C3
[07:30:33][I][remote.pronto:237]: Received Pronto: data=0000 006D 0001 0000 0002 009B 06C3
[07:30:33][I][remote.canalsat:103]: Received CanalSat: device=0x7F, address=0x3F, command=0x7F, repeat=0x1
[07:30:33][I][remote.canalsatld:100]: Received CanalSatLD: device=0x7F, address=0x3F, command=0x7F, repeat=0x1
[07:30:33][I][remote.pronto:237]: Received Pronto: data=0000 006D 0002 0000 0005 000B 0005 009B 06C3
[07:30:33][I][remote.pronto:237]: Received Pronto: data=0000 006D 0001 0000 0003 009B 06C3
[07:30:33][I][remote.pronto:237]: Received Pronto: data=0000 006D 0004 0000 0004 0047 000A 005F 0004 0039 0008 009B 06C3
[07:30:33][I][remote.pronto:237]: Received Pronto: data=0000 006D 0002 0000 000A 0004 0005 009B 06C3

Remote 2
[07:32:21][I][remote.pronto:237]: Received Pronto: data=0000 006D 00C1 0000 0005 000A 0003 0021 0004 0019 000C 0006 0006 0008 0004 008C 0011 0038 0006 0031 0004 0027 0007 002F 0009 0006 0003 0027 0002 0007 0002 0010 000D 0005 0003 000C 000E 0010 0003 0021 0005 000E 0005 000B 0008 0003
[07:32:21][I][remote.pronto:239]: 000A 0028 0005 003B 0008 0032 0004 003A 0016 0019 0009 0014 0007 0008 0009 000C 0004 0014 0004 000A 0010 000E 0009 000E 0004 002C 0008 0019 0004 0005 0004 0008 0005 001B 0006 001A 0008 0003 0004 001B 0005 0015 0013 0009 0006 0010 0014 0020 0007 0006 000B 001A 0004 0020 0009 0007 0003 0004 0003 0003 0015 0011 0002 0008 0007 001A 000B 000F 0017 0006 0011 0006 000D 0012 0006 0008 0002 0007 0009 0022 000C 001C 000C 0015 0012 0003 0003 0012 0003 0008 0009 0021 000F 000E 0009 0028
[07:32:21][W][component:214]: Component remote_receiver took a long time for an operation (0.07 s).
[07:32:21][W][component:215]: Components should block for at most 20-30ms.
[07:32:21][I][remote.pronto:237]: Received Pronto: data=0000 006D 0042 0000 001F 000F 0012 0002 001D 0012 000F 0004 001C 0005 001B 0006 001A 0014 000D 0014 000D 0006 001A 0007 0019 0008 0019 0008 0019 0008 0018 0008 0018 0009 0018 0009 0018 0009 0018 0009 0018 0016 000B 0008 0018 0016
[07:32:21][I][remote.pronto:239]: 000B 0008 0019 0008 0018 0009 0018 0016 000B 0016 000B 0008 0019 0008 0018 0016 000B 0016 000B 0008 0019 0008 0018 0008 0018 0009 0018 0009 0018 0009 0018 0009 0018 0016 000B 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0017 000B 0009 0018 0009 0018 0009 0018 0016 000B 0016 000B 0008 0018 0009 0018 0009 0018 0016 000B 0016 000B 0008 0019 0016 000B 0016 000B 0016 009B 06C3
[07:32:21][W][component:214]: Component remote_receiver took a long time for an operation (0.07 s).
[07:32:21][W][component:215]: Components should block for at most 20-30ms.
[07:32:21][I][remote.pronto:237]: Received Pronto: data=0000 006D 0042 0000 0019 0015 000C 0008 0019 0015 000B 0008 0019 0008 0019 0008 0018 0016 000B 0016 000B 0008 0019 0008 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0016 000B 0008 0018 0016
[07:32:21][I][remote.pronto:239]: 000B 0008 0018 0009 0018 0009 0018 0016 000B 0016 000B 0008 0018 0009 0018 0016 000B 0016 000B 0008 0018 0008 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0016 000B 0008 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0016 000B 0009 0018 0009 0018 0009 0018 0016 000B 0016 000B 0008 0018 0008 0018 0009 0018 0016 000B 0016 000B 0008 0018 0016 000B 0016 000B 0016 009B 06C3
[07:32:21][W][component:214]: Component remote_receiver took a long time for an operation (0.07 s).
[07:32:21][W][component:215]: Components should block for at most 20-30ms.
[07:32:21][I][remote.pronto:237]: Received Pronto: data=0000 006D 0042 0000 0019 0015 000C 0008 0019 0015 000B 0008 0019 0008 0019 0008 0018 0016 000B 0016 000B 0008 0019 0008 0019 0008 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0016 000B 0009 0018 0016
[07:32:22][I][remote.pronto:239]: 000B 0008 0018 0009 0018 0009 0018 0016 000B 0016 000B 0008 0019 0008 0018 0016 000B 0016 000B 0008 0019 0008 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0016 000B 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0017 0017 000B 0009 0018 0009 0018 0009 0018 0016 000B 0016 000B 0008 0018 0008 0018 0008 0018 0016 000B 0016 000B 0008 0019 0016 000B 0016 000B 0016 009B 06C3
[07:32:22][W][component:214]: Component remote_receiver took a long time for an operation (0.07 s).
[07:32:22][W][component:215]: Components should block for at most 20-30ms.
[07:32:22][I][remote.pronto:237]: Received Pronto: data=0000 006D 0042 0000 0019 0015 000C 0008 0019 0015 000B 0008 0019 0008 0019 0008 0018 0016 000B 0016 000B 0008 0019 0008 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0016 000B 0008 0018 0016
[07:32:22][I][remote.pronto:239]: 000B 0008 0018 0008 0018 0009 0018 0016 000B 0016 000B 0008 0019 0008 0018 0016 000B 0016 000B 0008 0019 0008 0018 0008 0018 0009 0018 0009 0018 0009 0018 0009 0018 0016 000B 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0016 000B 0009 0018 0009 0018 0009 0018 0016 000B 0016 000B 0008 0018 0008 0018 0009 0018 0016 000B 0016 000B 0008 0018 0016 000B 0016 000B 0016 009B 06C3
[07:32:22][W][component:214]: Component remote_receiver took a long time for an operation (0.07 s).
[07:32:22][W][component:215]: Components should block for at most 20-30ms.
[07:32:22][I][remote.pronto:237]: Received Pronto: data=0000 006D 0042 0000 0019 0015 000C 0008 0019 0015 000B 0008 0019 0008 0019 0008 0018 0016 000B 0016 000B 0008 0019 0008 0018 0008 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0016 000B 0009 0018 0016
[07:32:22][I][remote.pronto:239]: 000B 0009 0018 0008 0018 0009 0018 0016 000B 0016 000B 0008 0019 0008 0018 0016 000B 0016 000B 0008 0019 0008 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0016 000B 0008 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0009 0018 0017 000B 0009 0018 0009 0018 0009 0018 0016 000B 0016 000B 0008 0018 0008 0018 0009 0018 0016 000B 0016 000B 0008 0019 0016 000B 0016 000B 0016 009B 06C3
[07:32:22][W][component:214]: Component remote_receiver took a long time for an operation (0.07 s).
[07:32:22][W][component:215]: Components should block for at most 20-30ms.
[07:32:22][I][remote.pronto:237]: Received Pronto: data=0000 006D 0001 0000 0002 009B 06C3
[07:32:22][I][remote.pronto:237]: Received Pronto: data=0000 006D 0002 0000 0005 0032 0004 009B 06C3
[07:32:22][I][remote.pronto:237]: Received Pronto: data=0000 006D 0003 0000 0006 0084 0008 000C 0003 009B 06C3


Remote 3
[07:34:57][I][remote.pronto:237]: Received Pronto: data=0000 006D 00C1 0000 0004 0013 0002 0007 0010 0019 0002 0016 0006 007C 0006 001C 0009 0013 000E 002F 0027 0032 000A 0009 0005 000C 0002 001C 000E 0006 0004 001A 0003 0003 0007 001B 0004 0016 0004 002B 0010 000E 0008 0005 000F 0006
[07:34:57][I][remote.pronto:239]: 000E 0006 0008 0016 0005 000B 0009 0013 0005 001A 0001 0009 000F 0035 0005 000D 0007 000A 0004 001A 0005 000C 0002 0016 0005 0007 0001 0004 0008 0004 0002 0017 000D 0009 0006 0020 0006 000B 0006 000B 0007 0003 0013 000C 0005 0008 0003 0025 0002 0016 000E 0006 0008 0004 0001 000A 001C 000F 0009 0036 000B 0009 000C 0006 0005 0007 0011 0019 000D 0005 0003 0009 000E 0038 000F 0005 0003 0032 000C 0006 0004 0004 0006 0021 0006 0003 0001 0009 0042 0005 0009 000E 001C 0022 0008 0003
[07:34:57][W][component:214]: Component remote_receiver took a long time for an operation (0.07 s).
[07:34:58][W][component:215]: Components should block for at most 20-30ms.
[07:34:58][I][remote.pronto:237]: Received Pronto: data=0000 006D 0001 0000 0017 009B 06C3
[07:34:58][I][remote.pronto:237]: Received Pronto: data=0000 006D 0001 0000 000D 009B 06C3
[07:34:58][I][remote.pronto:237]: Received Pronto: data=0000 006D 0001 0000 000C 009B 06C3
[07:34:58][I][remote.pronto:237]: Received Pronto: data=0000 006D 0004 0000 0003 006A 0009 001B 0005 0043 0005 009B 06C3
[07:34:58][I][remote.pronto:237]: Received Pronto: data=0000 006D 0001 0000 000B 009B 06C3
Reply


Forum Jump:


Users browsing this thread: