ESP & CC1101-rf 433Mhz Received OK, sent KO

Hello,
I am trying to capture a code and replay it via a button in Home Assistant using an ESP & CC1101-rf.
I can successfully capture the code from a button, but I am unable to send it—it just doesn't work. Can you help me?

When I capture a signal from the remote:
[18:14:42.661][I][remote.rc_switch:260]: Received RCSwitch Raw: protocol=1 data='01001011111000000101010110101'

When I press the button in HA to send the command:
[18:14:57.150][I][remote.raw:035]: Received Raw: 275

esphome:
  name: cc1101-rf
  friendly_name: CC1101 RF

esp32:
  board: nodemcu-32s
  framework:
    type: esp-idf

logger:
  level: INFO

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

  ap:
    ssid: "CC1101 RF Fallback"
    password: "12345678"

captive_portal:

spi:
  clk_pin: GPIO18
  miso_pin: GPIO19
  mosi_pin: GPIO23

cc1101:
  id: radio
  cs_pin: GPIO15
  gdo0_pin:
    number: GPIO4
    allow_other_uses: true
  frequency: 433.92MHz

# remote_receiver:
#   pin:
#     number: GPIO4
#     allow_other_uses: true
#   dump:
#     - raw
#     - rc_switch
#   tolerance: 60%
#   filter: 4us
#   idle: 10ms
#   buffer_size: 8kb
#   on_rc_switch:
#     then:
#       - logger.log:
#           format: "RF reçu: protocol=%d code=0x%llX"
#           args: [x.protocol, x.code]
#       - homeassistant.event:
#           event: esphome.rf433_received
#           data:
#             protocol: !lambda |-
#               return std::to_string((int) x.protocol);
#             code: !lambda |-
#               return std::to_string((uint64_t) x.code);

# remote_transmitter:
#   pin:
#     number: GPIO4
#     allow_other_uses: true
#   carrier_duty_percent: 100%
#   on_transmit:
#     then:
#       - cc1101.begin_tx: radio
#   on_complete:
#     then:
#       - cc1101.begin_rx: radio
remote_receiver:
  pin: GPIO25
  dump:
    - raw
    - rc_switch
  tolerance: 60%
  filter: 4us
  idle: 10ms
  buffer_size: 8kb

remote_transmitter:
  pin:
    number: GPIO4
    allow_other_uses: true
  carrier_duty_percent: 100%
  on_transmit:
    then:
      - cc1101.begin_tx: radio
  on_complete:
    then:
      - cc1101.begin_rx: radio
        
button:
- platform: template
  name: "Ventilateur Lumière"
  on_press:
    - remote_transmitter.transmit_rc_switch_raw:
        code: "01001011111000000101010110101"
        protocol: 1
        repeat:
          times: 20
          wait_time: 5ms     
# button:
#   - platform: restart
#     name: "Redémarrer CC1101 RF"

#   - platform: template
#     name: "Ventilateur On Off"
#     on_press:
#       - remote_transmitter.transmit_rc_switch_raw:
#           code: "01001011111000000101110010001"
#           protocol: 1
#           repeat:
#             times: 10
#             wait_time: 0s

#   - platform: template
#     name: "Ventilateur Vitesse 1"
#     on_press:
#       - remote_transmitter.transmit_rc_switch_raw:
#           code: "01001011111000000101111101000"
#           protocol: 1
#           repeat:
#             times: 10
#             wait_time: 0s

#   - platform: template
#     name: "Ventilateur Vitesse 2"
#     on_press:
#       - remote_transmitter.transmit_rc_switch_raw:
#           code: "01001011111000000101111001000"
#           protocol: 1
#           repeat:
#             times: 10
#             wait_time: 0s

#   - platform: template
#     name: "Ventilateur Vitesse 3"
#     on_press:
#       - remote_transmitter.transmit_rc_switch_raw:
#           code: "01001011111000000101110101001"
#           protocol: 1
#           repeat:
#             times: 10
#             wait_time: 0s

#   - platform: template
#     name: "Ventilateur Vitesse 4"
#     on_press:
#       - remote_transmitter.transmit_rc_switch_raw:
#           code: "01001011111000000101110001001"
#           protocol: 1
#           repeat:
#             times: 10
#             wait_time: 0s

#   - platform: template
#     name: "Ventilateur Vitesse 5"
#     on_press:
#       - remote_transmitter.transmit_rc_switch_raw:
#           code: "01001011111000000101101101010"
#           protocol: 1
#           repeat:
#             times: 10
#             wait_time: 0s

#   - platform: template
#     name: "Ventilateur Vitesse 6"
#     on_press:
#       - remote_transmitter.transmit_rc_switch_raw:
#           code: "01001011111000000101101001010"
#           protocol: 1
#           repeat:
#             times: 10
#             wait_time: 0s

#   - platform: template
#     name: "Ventilateur Lumière"
#     on_press:
#       - remote_transmitter.transmit_rc_switch_raw:
#           code: "01001011111000000101010110101"
#           protocol: 1
#           repeat:
#             times: 10
#             wait_time: 0s

Receiving Rcswitch with 60% tolerence is no-sense, whatever signal is getting decoded even if it doesn't match.
Post your log including raw :
dump:
- raw
- rc_switch
tolerance: 20%
filter: 100us
idle: 30ms

Also, what indicates 20 repeats with 5ms gaps?

[12:17:32.093][I][remote.raw:026]: Received Raw: 424, -1089, 1101, -377, 369, -1093, 369, -1114, 1099, -377, 369, -1091, 1088, -388, 1089, -393, 1084, -394, 1095, -366, 1098, -385, 373, -1094, 388, -1090, 370, -1123, 367, -1090, 390, -1088, 383, -1087, 1113, -373, 383, -1099, 1090, -390, 
[12:17:32.097][I][remote.raw:026]:   362, -1099, 1110, -378, 370, -1090, 1101, -391, 1094, -390, 379, -1092, 1084, -374, 392, -1090, 1089, -386, 387, -6698, 395, -1081, 1100, -391, 364, -1091, 391, -1103, 1085, -382, 370, -1115, 1090, -365, 1090, -392, 1108, -360, 1109, -380, 1098, -370, 
[12:17:32.104][I][remote.raw:035]:   367, -1100, 380, -1096, 387, -1094, 365, -1101, 381, -1114, 362, -1116, 1095, -368, 372, -1111, 1094, -370, 394, -1105, 1079, -372, 390, -1087, 1098, -391, 1091, -390, 380, -1094, 1084, -399, 368, -1090, 1088, -387, 366

Your binary is matching the raw signal, but Rcswitch protocol 1 uses 650/1300 pulse pairs and your capture presents ~380/1100 pairs.
Re-send that as raw or use custom rcswitch protocol like:

- remote_transmitter.transmit_rc_switch_raw:
    code: "01001011111000000101010110101"
    protocol:
      pulse_length: 370
      sync: [1, 18]
      zero: [1, 3] #370, 1110
      one: [3, 1]
      inverted: false
    repeat:
      times: 2
      wait_time: 0

Thanks for the help.
I tested it, but it has no effect on my fan.
I tried again while pressing the remote, and it feels like the code isn't the same.
Is that possible?

[13:11:52.859][I][remote.raw:026]: Received Raw: 401, -1108, 1077, -372, 367, -1115, 365, -1112, 1098, -379, 371, -1092, 1091, -391, 1092, -389, 1083, -394, 1092, -368, 1095, -383, 373, -1116, 361, -1095, 366, -1120, 362, -1100, 385, -1097, 367, -1115, 1092, -367, 370, -1122, 1097, -394, 
[13:11:52.864][I][remote.raw:026]:   367, -1107, 1079, -372, 367, -1116, 1093, -392, 1092, -388, 355, -1122, 1085, -392, 366, -1093, 1092, -397, 352, -6735, 364, -1091, 1120, -366, 373, -1100, 390, -1089, 1094, -366, 395, -1099, 1093, -372, 1096, -371, 1107, -372, 1119, -370, 1094, -372, 
[13:11:52.868][I][remote.raw:035]:   385, -1096, 366, -1098, 384, -1098, 361, -1120, 367, -1100, 383, -1095, 1108, -365, 390, -1088, 1101, -367, 396, -1098, 1092, -358, 396, -1094, 1098, -380, 1097, -396, 372, -1084, 1101, -391, 364, -1093, 1096, -369, 395

Code is same. I think you have additionally something else wrong, but try once directly as raw:

 - remote_transmitter.transmit_raw:
     code: [401, -1108, 1077, -372, 367, -1115, 365, -1112, 1098, -379, 371, -1092, 1091, -391, 1092, -389, 1083, -394, 1092, -368, 1095, -383, 373, -1116, 361, -1095, 366, -1120, 362, -1100, 385, -1097, 367, -1115, 1092, -367, 370, -1122, 1097, -394, 367, -1107, 1079, -372, 367, -1116, 1093, -392, 1092, -388, 355, -1122, 1085, -392, 366, -1093, 1092, -397, 352, -6735, 364, -1091, 1120, -366, 373, -1100, 390, -1089, 1094, -366, 395, -1099, 1093, -372, 1096, -371, 1107, -372, 1119, -370, 1094, -372, 385, -1096, 366, -1098, 384, -1098, 361, -1120, 367, -1100, 383, -1095, 1108, -365, 390, -1088, 1101, -367, 396, -1098, 1092, -358, 396, -1094, 1098, -380, 1097, -396, 372, -1084, 1101, -391, 364, -1093, 1096, -369, 395]

No repeats.

Edit: Remove the Gdo_pin config from CC1101 component, doesn't belong there in your setup.

Like that ?

esphome:
  name: cc1101-rf
  friendly_name: CC1101 RF

esp32:
  board: nodemcu-32s
  framework:
    type: esp-idf

logger:
  level: INFO

api:
  encryption:
    key: "SyxgcRGjZB6ipLHs2r6+/aSP4BZNS4KPPglHXZsZiSs="

ota:
  - platform: esphome
    password: "5875752cd04319df134504e51611d02f"

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

  ap:
    ssid: "CC1101 RF Fallback"
    password: "12345678"

captive_portal:

spi:
  clk_pin: GPIO18
  miso_pin: GPIO19
  mosi_pin: GPIO23

cc1101:
  id: radio
  cs_pin: GPIO15
  gdo0_pin:
    number: GPIO4
    allow_other_uses: true
  frequency: 433.92MHz

remote_receiver:
  pin: GPIO25
  dump:
    - raw
    - rc_switch
  tolerance: 60%
  filter: 4us
  idle: 10ms
  buffer_size: 8kb

remote_transmitter:
  pin:
    number: GPIO4
    allow_other_uses: true
  carrier_duty_percent: 100%
  on_transmit:
    then:
      - cc1101.begin_tx: radio
  on_complete:
    then:
      - cc1101.begin_rx: radio
        
button:
  - platform: template
    name: "Ventilateur Lumière"
    on_press:
    - remote_transmitter.transmit_raw:
        code: [401, -1108, 1077, -372, 367, -1115, 365, -1112, 1098, -379, 371, -1092, 1091, -391, 1092, -389, 1083, -394, 1092, -368, 1095, -383, 373, -1116, 361, -1095, 366, -1120, 362, -1100, 385, -1097, 367, -1115, 1092, -367, 370, -1122, 1097, -394, 367, -1107, 1079, -372, 367, -1116, 1093, -392, 1092, -388, 355, -1122, 1085, -392, 366, -1093, 1092, -397, 352, -6735, 364, -1091, 1120, -366, 373, -1100, 390, -1089, 1094, -366, 395, -1099, 1093, -372, 1096, -371, 1107, -372, 1119, -370, 1094, -372, 385, -1096, 366, -1098, 384, -1098, 361, -1120, 367, -1100, 383, -1095, 1108, -365, 390, -1088, 1101, -367, 396, -1098, 1092, -358, 396, -1094, 1098, -380, 1097, -396, 372, -1084, 1101, -391, 364, -1093, 1096, -369, 395]
        repeat:
          times: 2
          wait_time: 0s

Not quite yet.

It works!
Thank you very much.

esphome:
  name: cc1101-rf
  friendly_name: CC1101 RF

esp32:
  board: nodemcu-32s
  framework:
    type: esp-idf

logger:
  level: INFO

api:
  encryption:
    key: "SyxgcRGjZB6ipLHs2r6+/aSP4BZNS4KPPglHXZsZiSs="

ota:
  - platform: esphome
    password: "5875752cd04319df134504e51611d02f"

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

  ap:
    ssid: "CC1101 RF Fallback"
    password: "12345678"

captive_portal:

spi:
  clk_pin: GPIO18
  miso_pin: GPIO19
  mosi_pin: GPIO23

cc1101:
  id: radio
  cs_pin: GPIO15
  frequency: 433.92MHz

remote_receiver:
  pin: GPIO25
  dump:
    - raw
    - rc_switch
  tolerance: 60%
  filter: 4us
  idle: 10ms
  buffer_size: 8kb

remote_transmitter:
  pin:
    number: GPIO4
  carrier_duty_percent: 100%
  on_transmit:
    then:
      - cc1101.begin_tx: radio
  on_complete:
    then:
      - cc1101.begin_rx: radio
        
button:
  - platform: template
    name: "Ventilateur Lumière"
    on_press:
    - remote_transmitter.transmit_raw:
        code: [401, -1108, 1077, -372, 367, -1115, 365, -1112, 1098, -379, 371, -1092, 1091, -391, 1092, -389, 1083, -394, 1092, -368, 1095, -383, 373, -1116, 361, -1095, 366, -1120, 362, -1100, 385, -1097, 367, -1115, 1092, -367, 370, -1122, 1097, -394, 367, -1107, 1079, -372, 367, -1116, 1093, -392, 1092, -388, 355, -1122, 1085, -392, 366, -1093, 1092, -397, 352, -6735, 364, -1091, 1120, -366, 373, -1100, 390, -1089, 1094, -366, 395, -1099, 1093, -372, 1096, -371, 1107, -372, 1119, -370, 1094, -372, 385, -1096, 366, -1098, 384, -1098, 361, -1120, 367, -1100, 383, -1095, 1108, -365, 390, -1088, 1101, -367, 396, -1098, 1092, -358, 396, -1094, 1098, -380, 1097, -396, 372, -1084, 1101, -391, 364, -1093, 1096, -369, 395]

@Karosm
I don't understand; I can no longer pick up the key codes in long format.

esphome:
  name: cc1101-rf
  friendly_name: CC1101 RF

esp32:
  board: nodemcu-32s
  framework:
    type: esp-idf

logger:
  level: INFO

api:
  encryption:
    key: "SyxgcRGjZB6ipLHs2r6+/aSP4BZNS4KPPglHXZsZiSs="

ota:
  - platform: esphome
    password: "5875752cd04319df134504e51611d02f"

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

  ap:
    ssid: "CC1101 RF Fallback"
    password: "12345678"

captive_portal:

spi:
  clk_pin: GPIO18
  miso_pin: GPIO19
  mosi_pin: GPIO23

cc1101:
  id: radio
  cs_pin: GPIO15
  frequency: 433.92MHz

remote_receiver:
  pin: GPIO25
  dump:
    - raw
    - rc_switch
  tolerance: 20%
  filter: 100us
  idle: 30ms
  buffer_size: 8kb

remote_transmitter:
  pin:
    number: GPIO4
  carrier_duty_percent: 100%
  on_transmit:
    then:
      - cc1101.begin_tx: radio
  on_complete:
    then:
      - cc1101.begin_rx: radio
        
button:
  - platform: template
    name: "Ventilateur Lumière"
    on_press:
    - remote_transmitter.transmit_raw:
        code: [401, -1108, 1077, -372, 367, -1115, 365, -1112, 1098, -379, 371, -1092, 1091, -391, 1092, -389, 1083, -394, 1092, -368, 1095, -383, 373, -1116, 361, -1095, 366, -1120, 362, -1100, 385, -1097, 367, -1115, 1092, -367, 370, -1122, 1097, -394, 367, -1107, 1079, -372, 367, -1116, 1093, -392, 1092, -388, 355, -1122, 1085, -392, 366, -1093, 1092, -397, 352, -6735, 364, -1091, 1120, -366, 373, -1100, 390, -1089, 1094, -366, 395, -1099, 1093, -372, 1096, -371, 1107, -372, 1119, -370, 1094, -372, 385, -1096, 366, -1098, 384, -1098, 361, -1120, 367, -1100, 383, -1095, 1108, -365, 390, -1088, 1101, -367, 396, -1098, 1092, -358, 396, -1094, 1098, -380, 1097, -396, 372, -1084, 1101, -391, 364, -1093, 1096, -369, 395]

I used to get full Received Raw: timings, but now ESPHome only logs Received RCSwitch Raw: protocol=1 data='...'. Is there a way to force ESPHome to always print the full raw timings even when the frame is successfully decoded by RCSwitch?

I cleared the cache and recompiled, and it's working now.

I have a similar problem trying to replicate the codes transmitted by a NICE FLO2 transmitter used wiht a garden gate. I recorded the FLO2 remote codes and try to replay them as is. The gateway never moves Does anyone have an idea what’s wrong ?

ESPHome config: ESP32-C3 Super Mini + CC1101 RF proxy

# Purpose: transmit the Nice FLO2 gate remote's 433.92MHz fixed code from HA.
#
#

esphome:
  name: rf-proxy-gate
  friendly_name: RF Proxy Gate

esp32:
  board: esp32-c3-devkitm-1
  framework:
    type: esp-idf

logger:
  level: VERBOSE

api:

ota:
  platform: esphome

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    ssid: "RF-Proxy-Gate Fallback"
    password: !secret wifi_fallback_password

captive_portal:

spi:
  clk_pin: GPIO6
  mosi_pin: GPIO7
  miso_pin: GPIO5

cc1101:
  cs_pin: GPIO10
  frequency: 433.92MHz

remote_transmitter:
  pin:
    number: GPIO4
    inverted: true         
  non_blocking: true
  carrier_duty_percent: 100%
  on_transmit:
    then:
      - cc1101.begin_tx
  on_complete:
    then:
      - cc1101.begin_rx

remote_receiver:
  id: rf_rx
  pin: GPIO3
  dump: raw
  tolerance: 25%
  filter: 50us
  idle: 30ms
  receive_symbols: 500

button:
  - platform: template
    name: "Open Gate"
    on_press:
      then:
        - remote_transmitter.transmit_raw:
            # VERBATIM multi-frame slice of the real remote's raw capture -
            # several complete frames WITH their real ~23.5ms inter-frame gaps
            # left intact, replayed exactly as received. 
            code: [652, -790, 1220, -1445, 560, -1444, 560, -1470, 538, -1468, 542, -1444, 560, -790, 1215, -1446, 539, -792, 1220, -1449, 541, -23553, 554, -848, 1150, -1503, 515, -822, 1172, -1498, 513, -1472, 535, -1473, 535, -1472, 536, -1445, 558, -790, 1192, -1471, 539, -767, 1243, -1445, 542, -23546, 571, -771, 1218, -1452, 568, -797, 1194, -1450, 541, -1468, 541, -1442, 561, -1443, 562, -1444, 560, -768, 1241, -1448, 541, -792, 1218, -1444, 541, -23522, 593, -769, 1220, -1474, 544, -771, 1217, -1473, 520, -1467, 541, -1495, 522, -1443, 555, -1445, 560, -765, 1218, -1448, 559, -793, 1216, -1444, 540, -23534, 553, -822, 1171, -1501, 514, -821, 1193, -1477, 517, -1470, 540, -1469, 540, -1468, 539, -1470, 539, -766, 1217, -1444, 560, -767, 1239, -1445, 538, -23530, 576, -803, 1197, -1452, 566, -794, 1197, -1452, 541, -1470, 538, -1471, 537, -1445, 560, -1441, 558, -766, 1242, -1448, 538, -793, 1216, -1423, 562, -23527]
            repeat:
              times: 2
              wait_time: 0s

Why is your TX pin inverted?

So why you repeat it twice?