RF remote control

I want to use an esp32 to replicate my RF remote control with very little success:
I have one esp32 with this config for the remote reciever:

logger:
  #level: VERY_VERBOSE
  #tx_buffer_size: 896
  logs:
    remote_receiver.esp8266: DEBUG

remote_receiver:
  pin: 
    number: GPIO21
    mode: INPUT
    inverted: True
  dump:
  - raw: {}
  - rc_switch: {}
  tolerance: 60%
  filter: 250us
  idle: 4ms

and when I press the on button on the remote control i get these logs:

[08:27:42][I][remote.raw:041]: Received Raw: -3070, 601, -771, 602, -768, 601, -766, 604, -308, 600, -309, 601, -3981, 607, -303
[08:27:42][I][remote.raw:041]: Received Raw: -3060, 609, -759, 611, -760, 609, -759, 609, -302, 607, -302, 607, -3972, 615, -296
[08:27:42][I][remote.raw:041]: Received Raw: -3053, 614, -757, 614, -753, 616, -754, 613, -296, 612, -298, 612, -3967, 619, -291
[08:27:42][I][remote.raw:041]: Received Raw: -3046, 620, -751, 619, -749, 619, -749, 619, -291, 617, -294, 614, -3961, 625, -286
[08:27:42][I][remote.raw:041]: Received Raw: -3047, 620, -750, 620, -747, 623, -745, 621, -289, 618, -293, 617, -3961, 624, -287
[08:27:42][I][remote.raw:041]: Received Raw: -3042, 623, -749, 620, -746, 622, -744, 624, -290, 616, -292, 618, -3959, 625, -284
[08:27:42][I][remote.raw:041]: Received Raw: -3042, 625, -746, 624, -744, 622, -744, 623, -288, 621, -289, 619, -3959, 623, -285

on my transmitter esp32 I have this code:

remote_transmitter:
  pin: GPIO21
  carrier_duty_percent: 100%

button:
 

  - platform: template
    name: RF code 1
    on_press:
      - remote_transmitter.transmit_raw:
          code: [
            -3047, 626, -746, 626, -744, 628, -743, 625, -288, 623, -289, 621, -3967, 626, -285
          ]
          repeat:
            times: 8
            wait_time: 0ms 

when I press the button on the transmitter side the logs on the reciever side reflect that is being sent somethign but not quite what I told it to send:

[08:45:59][I][remote.raw:041]: Received Raw: 1235, -1088, 1927, -995
[08:45:59][I][remote.raw:041]: Received Raw: -698, 1824, -2674, 1418, -623
[08:45:59][I][remote.raw:028]: Received Raw: -751, 722, -649, 721, -651, 721, -646, 274, -636, 280, -628, 3948, -650, 3381, -657, 715, -656, 715, -657, 715, -652, 270, -639, 274, -635, 3942, -655, 3348, -659, 713, -658, 712, -660, 712, -655, 265, -644, 271, -639, 3938, -657, 3345, 
[08:45:59][I][remote.raw:028]:   -663, 709, -661, 710, -663, 709, -658, 263, -645, 268, -641, 3938, -658, 3344, -664, 708, -664, 705, -666, 708, -658, 263, -646, 268, -642, 3935, -661, 3360, -667, 706, -665, 705, -667, 704, -662, 260, -651, 263, -645, 3934, -662, 3339, -668, 706, 
[08:45:59][I][remote.raw:041]:   -665, 704, -667, 704, -663, 259, -651, 263, -645, 3934, -662, 3338, -669, 706, -666, 702, -668, 706, -662, 258, -651, 263, -645, 3933, -664
[08:45:59][I][remote.raw:028]: Received Raw: -1828, 928, -2619, 2501, -1384, 2742, -779, 671, -699, 672, -698, 673, -2512, 3904, -690, 3324, -695, 678, -693, 677, -693, 680, -2504, 3911, -684, 3317, -689, 684, -687, 686, -685, 686, -2499, 3914, -682, 3333, -686, 688, -683, 687, -684, 
[08:45:59][I][remote.raw:028]:   688, -2496, 3920, -677, 3323, -683, 690, -680, 691, -681, 690, -1586, 251, -657, 3921, -676, 3324, -682, 692, -680, 691, -677, 694, -1585, 251, -657, 3922, -674, 3327, -680, 692, -679, 692, -677, 694, -1583, 253, -655, 3924, -672, 3342, -677, 695, 
[08:45:59][I][remote.raw:041]:   -676, 694, -677, 696, -670, 252, -659, 254, -653, 3925, -673
[08:46:00][I][remote.raw:028]: Received Raw: 705, -667, 702, -669, 702, -666, 257, -653, 260, -648, 3931, -665, 3348, -671, 701, -670, 700, -671, 701, -667, 254, -655, 259, -650, 3927, -668, 3335, -671, 701, -671, 701, -671, 700, -666, 254, -656, 260, -648, 3928, -669, 3335, -672, 
[08:46:00][I][remote.raw:028]:   699, -672, 700, -672, 700, -667, 253, -655, 259, -649, 3929, -668, 3347, -672, 700, -672, 699, -671, 699, -670, 253, -655, 257, -651, 3928, -669, 3333, -674, 699, -672, 699, -672, 699, -669, 252, -656, 257, -653, 3926, -669, 3333, -674, 699, -672, 700, 
[08:46:00][I][remote.raw:041]:   -670, 700, -669, 253, -656, 256, -651, 3928, -670, 3331, -675, 699, -673, 698, -672, 699, -668, 255, -655, 256, -653, 3927, -669

finally this is the remote:

when I use the remote the lights go on so I know that part is working.

I have tried to get this 2 work with 2 types of recievers and transmiters wiht no luck

How can I troubleshoot this so that I can finally use home assistant to turn lights on and off

Thanks in advance

https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16

i just made a external component that hopefully makes it easier to find and test repeating 433 signals give it a test spin if you like
set the pins, board, and wifi and after you have programmed the board activate raw repeating and adjust the nSeparationLimit slider in home assistant until you hopefully get a valid signal
after that test it with action from homeassistant.

action: esphome.rf_raw_send_raw
data:
  raw_timings: [-2404, 264, -1244, 1046, -488, 275, -1251, 1037, -484, 1042, -481, 1044, -484, 1041, -488, 279, -1242, 286, -1225, 303, -1224, 1062, -471, 1054, -471, 294, -1227, 301, -1217, 311, -1211, 1075, -448, 317, -1210, 1074, -461, 1064, -459, 1065, -464, 301, -1218, 312, -1211, 315, -1206, 321, -1204, 330]
  repeats: 10
#made by swe-dude
esphome:
  name: rf-raw
  platformio_options:
     board_build.f_cpu: 160000000L
  #on_boot:
  #  then:
  #    - lambda: App.set_loop_interval(0); // shorter loop interval

esp8266:
  board: esp01_1m
  framework:
    version: recommended

wifi:
  ssid: "xxxx"
  password: "xxxxx"
  fast_connect: true 


# Enable logging
logger:
  baud_rate: 0 




# Enable Home Assistant API
api:
  reboot_timeout: 0s
  services:
    - service: send_raw #can send raw timings from homeassistant service
      variables:
        raw_timings: int[]
        repeats: int        
      then:
        - lambda: |-  
            auto call = id(my_tx).transmit();
            auto data = call.get_data();
            esphome::remote_base::RawTimings code_ = raw_timings;
            data->set_data(code_);
            call.set_send_times(repeats);
            call.set_send_wait(0);             
            call.perform();


    - service: rf_send_rc
      variables:
        adress: int
        protocol: int
        lenght: int
      then:
        - lambda: |-  
            auto call = id(my_tx).transmit();
            //uint64_t code = 6288992;  
            esphome::remote_base::RC_SWITCH_PROTOCOLS[protocol].transmit(call.get_data(), adress, lenght); //thank you Karosm.
            call.set_send_times(12);
            call.set_send_wait(0); 
            call.perform();



ota:
  - platform: esphome


external_components:
  - source: github://flax2000/my-esphome-components/components@main
    components: [ rf_raw ]
  #- source:
  #    type: local
  #    path: my_components


rf_raw:
  pin: 3
          


remote_transmitter:
  pin: 1
  id: my_tx
  carrier_duty_percent: 100% 
  on_transmit:
    then:
      - lambda: |-  
          //esphome::rf_raw::rx_int_off();
  on_complete:
    then:
      - lambda: |-  
          //esphome::rf_raw::rx_int_on();
   



switch:
  - platform: template
    name: "find raw repeating"
    optimistic: true
    turn_on_action:
      then:
        - lambda: |-  
            esphome::rf_raw::set_capture433_repeating(1);
    turn_off_action:
      then:
        - lambda: |-  
            esphome::rf_raw::set_capture433_repeating(0);

  - platform: template
    name: "rc switch"
    optimistic: true
    turn_on_action:
      then:
        - lambda: |-  
            esphome::rf_raw::set_rc_switch(1);
    turn_off_action:
      then:
        - lambda: |-  
            esphome::rf_raw::set_rc_switch(0);



button:
  - platform: template
    name: "capture 1000 timings"
    on_press:
      then:
        - lambda: |-  
            esphome::rf_raw::set_capture433(1);


number:
  - platform: template
    name: "nSeparationLimit"
    optimistic: true
    min_value: 100
    max_value: 20000
    step: 50
    initial_value: 2000 
    mode: slider
    set_action:
      then:
        - lambda: |-  
            esphome::rf_raw::set_nSeparationLimit(x);


  - platform: template
    name: "tolerance"
    optimistic: true
    min_value: 0
    max_value: 150
    step: 1
    initial_value: 90 
    mode: slider
    set_action:
      then:
        - lambda: |-  
            esphome::rf_raw::set_tolerance(x);

best of luck

1 Like

Why inverted?
Why you send repeats with wait_time: 0 ?

I don’t think its inverted might be just the signal i’m capturing, rc switch protocol 4

As for wait_time: 0 the raw timing have the wait time in the timings (-2404)
and rc switch appears to add in the same wait time automatically, those timing captured looks the same if i send with esphome rc switch or press the remote, maybe rc switch in esphome behaves different when you send it with lambda? (thank you again)
any my outlets are happy with the signal this way so i wont argue with then.

My question was about the code OP posted.
He has idle:4ms on receiver code, so the gap between repeats has to be longer than that…

Oops sorry

For similar RF remotes this configuration allowede me to receive the codes.


remote_receiver:
  pin: 
    number: D5
  dump: #all
    - raw   
    - rc_switch
  tolerance: 25%
  filter: 5us
  idle: 4ms
  buffer_size: 1kb    

That is absolutely normal to see happen with any remote and i think its because of either or a combination of interference and codes being incomplete due to how many and how fast they are coming in so, some will get their beginnings or ends of the raw code missed, incorrect, or not the correct number of repetitions… To my knowledge there isn’t much you can do about it other than limiting it as much as possible but, you can still make a very reliable RF transmitter/receiver setup when its happening still.

Something that would probably help is if you changed the Repeat wait time to something more than 0ms… Add a slight delay between each of the 8 transmissions to see if it maybe the receiver has an easier time distinguishing where 1 ends and another begins since your currently sending them all instantly… If i spoke to you at 8,000 words per minute without any pauses would you be able to accurately comprehend everything i said with 0 errors??

When I try to compile the code into my esp32 I get the fllowing error

Compiling .pioenvs/test22/src/esphome/components/rf_raw/rf_raw.cpp.o
src/esphome/components/rf_raw/rf_raw.cpp:288:20: error: 'RemoteReceiverComponentStore' has not been declared
  288 | void IRAM_ATTR HOT RemoteReceiverComponentStore::gpio_intr(RemoteReceiverComponentStore *arg)
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/esphome/components/rf_raw/rf_raw.cpp:288:20: error: variable or field 'gpio_intr' declared void
src/esphome/components/rf_raw/rf_raw.cpp:288:60: error: 'RemoteReceiverComponentStore' was not declared in this scope
  288 | void IRAM_ATTR HOT RemoteReceiverComponentStore::gpio_intr(RemoteReceiverComponentStore *arg)
      |                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/esphome/components/rf_raw/rf_raw.cpp:288:90: error: 'arg' was not declared in this scope
  288 | void IRAM_ATTR HOT RemoteReceiverComponentStore::gpio_intr(RemoteReceiverComponentStore *arg)
      |                                                                                          ^~~
src/esphome/components/rf_raw/rf_raw.cpp: In member function 'virtual void esphome::rf_raw::RF_RawComponent::loop()':
src/esphome/components/rf_raw/rf_raw.cpp:305:30: error: 'RemoteReceiverComponentStore' has not been declared
  305 | this->pin_->attach_interrupt(RemoteReceiverComponentStore::gpio_intr, &this->store_, gpio::INTERRUPT_ANY_EDGE);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/esphome/components/rf_raw/rf_raw.cpp:305:78: error: 'class esphome::rf_raw::RF_RawComponent' has no member named 'store_'
  305 | this->pin_->attach_interrupt(RemoteReceiverComponentStore::gpio_intr, &this->store_, gpio::INTERRUPT_ANY_EDGE);
      |                                                                              ^~~~~~
src/esphome/components/rf_raw/rf_raw.cpp: In member function 'virtual void esphome::rf_raw::RF_RawComponent::setup()':
src/esphome/components/rf_raw/rf_raw.cpp:498:9: error: 'class esphome::rf_raw::RF_RawComponent' has no member named 'high_freq_'
  498 |   this->high_freq_.start();
      |         ^~~~~~~~~~
src/esphome/components/rf_raw/rf_raw.cpp:499:32: error: 'RemoteReceiverComponentStore' has not been declared
  499 |   this->pin_->attach_interrupt(RemoteReceiverComponentStore::gpio_intr, &this->store_, gpio::INTERRUPT_ANY_EDGE);
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/esphome/components/rf_raw/rf_raw.cpp:499:80: error: 'class esphome::rf_raw::RF_RawComponent' has no member named 'store_'
  499 |   this->pin_->attach_interrupt(RemoteReceiverComponentStore::gpio_intr, &this->store_, gpio::INTERRUPT_ANY_EDGE);
      |                                                                                ^~~~~~
*** [.pioenvs/test22/src/esphome/components/rf_raw/rf_raw.cpp.o] Error 1

Jimmy I used your setup and while the codes changed still no luck.

I am at the end of my capability with RF signals here so any other suggestion will be appreciated

So post the raw signal you got.

I changed the code to


remote_receiver:
  pin: 
    number: GPIO21
    mode: INPUT
    #inverted: True
  dump:
  #  all
  - raw: {}
  - rc_switch: {}
  tolerance: 25%
  filter: 10us
  idle: 4ms
  buffer_size: 4kb

and now it it working
Thank you all For the assistance!!!

But did you understand why your original code didn’t work?

good that you figured it out, code is fixed for esp32 if you need it for any other 433 signal
happy coding