Problem with Rpi RF switch

Hello all,

I am having problem with Rpi RF switch.
I am trying to control my 433mhz plug outlets from HA.
After sniffing the codes, the following is my configuration.yaml file:

switch:
  platform: rpi_rf
  gpio: 17
  switches:
    hall_1:
      protocol: 1
      pulselength: 183
      code_on: 1135923
      code_off: 1135932

Ideally, I would expect the same code to be transmitted at protocol 1.
But when I sniff the sent code in Arduino I receive this.

Decimal: 1135923 (24Bit) Binary: 000100010101010100110011 Tri-State: 0F0FFFFF0101 PulseLength: 430 microseconds Protocol: 5

I receive the correct code. But the protocol changes to 5.
I do not know why.
Because of this, I am unable to control my remote using HA running in raspberry PI.
It does’nt matter which protocol I set, it always changes to 5!

Is this issue an with rpi_rf platform?
Anyone had a similiar problem, any help would be appreciated :slight_smile:. Thanks.

Also, I am able to control the remote successfully with the same codes using an Arduino.

hello adi,
did you solve the issue. I have the exact same situation. I have a arduino receiver and regardless of what protocol I set in rpi_df I always get protocol 5. My gadgets expect protocol 1 and consequently do not respond :frowning:
Best
-Mark

Command Line Switch and just issue a command with wiringPi send code.

you have to install wiringPi on your RPi

Hey @mark!

I struggled on this for a week. I even looked into the source code.
But then I gave up.

Now, I simple use a command switch as you can see here :slight_smile:

And yes, you can find the ./codesend script here :

I hope that solves your problem.
Feel free to ask questions, if isnt solved.

Hi @DJR

Would you elaborate a bit ? After installing Wiring Pi should I use the command line switch as the later post by @adi or should this solve the issue with RPi RF switch component? And my installation in in Venv, so should the installation be different ? On other words should I install wiringpi by apt-get or pip3 ?

I didn’t check what code its sending after plugging the TX to pi but as I see I am in a similar issue (Sending code from Arduino works reliably but not from the Pi).

Apologize for the late reply, been busy doing other stuff.

Just install it via apt-get, from what I read newly built raspbian already comes with raspbian.

Once you have you can run wiringpi command or create a bash script and just call that script in your home assistant.

Since this thread is old, I believe everything has been on the newer version of home assistant.

Let me know if you are still having problems.

Hi @DJR Thanks for the reply. My issue was resolved indeed by reconnecting the cables to the right GPIO port, previously I had connected that in a wrong pi :frowning: as I have multiples stacked for different functions.

1 Like

Do you connect transmitter cable to GPIO 17 & receiver cable to GPIO 27 ?

Didn’t have to connect the rx cable. I sniffed the RF code via Arduino. Then connected the tx on port 17.

Hi All, not sure if this is the right thread, but I seem to be having a similar problem. I can sniff the correct RF codes for my RF controlled wall switches but when my raspberry pi transmits the signal as 24 bit when my sniffed codes are 32 bit. I have amended this line in the rpi-rf code to change the tx_length value to 32, but this doesn’t seem to work either:

# pylint: disable=too-many-instance-attributes,too-many-arguments
def __init__(self, gpio,
             tx_proto=1, tx_pulselength=None, tx_repeat=10, tx_length=24, rx_tolerance=80):
    """Initialize the RF device."""

Is there anything else I should be doing? I have heard others getting 32 bit codes to send properly with this component but haven’t found anything concrete.

Thanks for the help.