433MHz receiver on Raspberry Pi

There is already an rpi_rf switch that uses a RF module connected to the Raspberry Pi GPIO. As the used library also support 433MHz receivers, it would be cool, to have an rpi_rf sensor that can be used with devices like window sensors, garage door openers and motion sensors.

I have something like that running on bbb with 433 arduino. A Python script takes the info from the serial port and publish it on mqtt. Take a look at https://github.com/perrin7/ninjacape-mqtt-bridge/wiki/Setting-up-OpenHAB-on-rpi-(and-BBB)

A 433-MQTT bridge is actually a nice option. You would only need the python script (which does the bridging) https://github.com/perrin7/ninjacape-mqtt-bridge/blob/master/ninjaCapeSerialMQTTBridge.py

The “problem” is the arduino code. Which arduino (uno/nano/mega?) & arduino code is needed to get this running?

1 Like

i use mysensors for my arduino sensors and a 433 mysensor to use 433 switches.

it is possible to run the complete mysensor project on 433 but i dont know if that would be reliable.

Ok, I know this can be done on an Arduino. Implementing an RF to MQTT bridge on an ESP8266 wouldn’t be a big deal. However, I’m looking specifically for an implementation directly on the Raspberry Pi as I don’t want to use another device. As nobody seems to work on this yet, I will look into it.

I just added a hub to interface pilight. Sending and receiving of codes is now possible. Even if home assistant does not run on the RF interface computer!

The received codes are put on the event bus, thus to implement automation rules on received RF codes (e.g. weather station) is very simple.

I also added a pilight switch that can be steered by a RF remote. This way we can use our RF remotes to turn on/off lights and home assistant will get the state change.

It is in a pull request, I do not know how fast the maintainers will merge it.

I am now using a 3 € RF remote to switch all my devices in the house, and home assistant has the correct state :slight_smile:

2 Likes

Looks good, I will look into it when it is merged.
However, it would have been nice to have a component fully integrated into Home Assistant without the need of an additional daemon.

But how do you use a RF receiver when it runs on a different computer than home assistant? And what is the disadvantage of a daemon? You cannot implement fast code interpretation in pure python :wink:.

If necessary, you can run multiple HA instances on multiple systems. Many users won’t need an extra RPI as the main software already runs on RPI.
Disadvantage of an additional daemon is that it adds complexity. It has to be installed, configured and monitored. Having everything in HA would make it much easier to use.
Analyzing RF codes in Python isn’t a problem at all. There are plenty of libraries available and this one is already used in HA to send RF codes:

Sending codes is simple. Receiving and interpreting not. You habe several 100 to 10000 Bits/s at the RPi IO. You have to check them in real time and compare them with all possible/selected protocols. This is exactly what pilight does. Please tell me a pure python module that is able to do that.

To have everything in HA is I think not how HA is ment to be. The architecture foresees to have external libraries. And there always has to be a deamon to receive RF codes in real time.

Installing pilight on the RPi is well documented and working out of the box. Precompiled libraries as well as a working 5 commands only installation are available:

git clone https://github.com/pilight/pilight
cd pilight
git checkout tags/v7.0
chmod +x setup.sh
sudo ./setup.sh
1 Like

10000bits/second isn’t really a problem for a modern system as the RPI.

You can find a simple receiver demo script of the RPI RF libary here:

External libraries are ok and I think, the Home Assistant developers are also ok with an external daemon. As a user I don’t like external daemons as they increase complexity and make the whole system harder to maintain. But this is my personal opinion.

Hi. So how can I receive RF codes in HASS?
I can receive (and send) them in pilight (with the pilight sender and receiver).
I can send codes with the HASS rpi_rf platform.
But how/where can I see the received RF codes in HASS through pilight and know how to use them in automation?

Thanks

When you activated the home-assistant pilight hub then all received RF codes will be put onto the event bus. Thus you can create an event trigger as it is mentioned in the manual.

For example:

automation:
   trigger:
     platform: event
     event_type: pilight_received
     event_data:
       protocol: daycom
       unit: 6

This example should be in the pilight hub manual.

Hi David! How can I access or get the values which were received. I can See Them in the log but have no idea to bring them into GUI… Receiving data From a weatherstation… Thanks…

Mhh I guess one has to define a general pilight sensor component, similar to the pilight switch. I do not have a 433 MHz hardware device that just sends data, so I did not implement it. If you would tell me what is being printed in your log I can try to implement such a sensor blindly (I cannot test it …), make a pull request and you test it. Since I am not home right now this will not happen before next week.

If you just want to trigger an automation rule e.g. at a certain temperature you can do this already with a template trigger.

cheers,
David

Automation/triggering is no Problem… I would like to have act temp, hum and battery in the gui…
this is what I received: INFO:homeassistant.core:Bus:Handling Event pilight_received[L]: channel=1, uuid=0000-b8-27-eb-f1f72e, battery=0, id=93, temperature=26.38, protocol=tfa, humidity=39.0
I think this is Standard on the tfa protocol
pilight sensor would be a good idea
cheers raimund

To implement this is straight forward. I will tell you when it is done.

@piffmasta The new pilight sensor component is implemented. Can you test?

Yes! Works perfect! Super! I think now I can also check the 433mhz light switch if it was pressed or not ! super - this is for updateing the gui when automations turned light on/off…