Can Home Assistant Listen to 433MHz Remotes?

I have installed the pilight deamon as described on their website. But my pi’s kernel is to new or something and now I get a hardware error on the gpio module. I tried to look up the error and there are some people who fixed it. But in my case all fixed didn’t work.

This is Exactly what i wanted to do. However in the HA documentation Removed integration - Home Assistant
you can only specify the GPIO pin for the TX module (Sender) and not the RX module (Receiver)

and i Also installed Pilight but i can’t get the deamon to work. and after four hours of fiddling with it i just gave up on Pilight.

I think HASS needs an RF sensor component (using rpi-rf and the cheap RF receivers), to complement the RF switch component. Perhaps there is a technical reason why this does not exist…

3 Likes

If you want to receive signals with respberry Pi,you can use PIGPIO library. Many people recommend 433Utils, but it doesn’t work on my Pi3 and when it run, CPU is so hot. So in one word, go to this website and you will find what you want:
http://abyz.co.uk/rpi/pigpio/
then use a script component to exec it to read and return the value.

Yes, there is a problem with the new kernel. I thing the dev version of pilight has already fixed it, otherwise you can just downgrade your kernel a little bit and it’s all working perfectly then, that’s what I did.

Use this command to downgrade:
rpi-update 52241088c1da59a359110d39c1875cda56496764

Here is the thread:

Here’s the link on the info to install the dev version of pilight:

Thank you,

I got Pilight Running But i’m sorry to say i don’t get how to configure this software.

I can build computers i can install, Linux servers and install all necesary services on them.

But i really get confused from the pilight Documentation or lack of it.

I have spend over 14 hours to get it to do sometiming.
I got the deamon running because i can see webgui on http://hassbian:5001
But thats it. it won’t discover my remotes or any signal in the air and there is some weather station sensor very active on the 433Mhz band. so i know there are signals in the air.

And as an Extra i added

pilight:
  host: 127.0.0.1
  port: 5000

this code in my config to see if HA could do something with Pilight

but i got this Error

2017-05-23 07:35:35 ERROR (Thread-8) [homeassistant.components.pilight] Unable to connect to 127.0.0.1 on port 5000: [Errno 111] Connection refused
2017-05-23 07:35:35 ERROR (MainThread) [homeassistant.setup] Setup failed for pilight: Component failed to initialize.

I also tried port 5001 wich is the web port and i got the same problem.

Oh and as a cherry on top the new update From HA gives errors on discovery.py

And not i can’t even control my Hue lights anymore. So at this moment i’m giving up on pilight and focus more on getting my hue lights back into Home Assistant.

Sorry that i sound so depressed. i really appreciate all the help i have gotten from all of you and maybe i will pick this project up in a later stage or wait till HA could nativly listen to 433GHZ remotes.

:smiley:

Don’t give up yet :slight_smile: I think I know how to solve your problem.

You didn’t add port 5000 to pilight congif file, therefore HASS connection is refused. Pilight config file is located here:
/etc/pilight/config.json

At the end of that file you have to add a line:
"port": 5000

So config for pilight in that part looks something like that:

"settings": {
        "log-level": 6,
        "pid-file": "/var/run/pilight.pid",
        "log-file": "/var/log/pilight.log",
        "webserver-enable": 1,
        "webserver-root": "/usr/local/share/pilight/",
        "webserver-http-port": 5001,
        "webserver-cache": 1,
        "port": 5000
},

After you edited your config, save it and restart pilight

sudo su
service pilight restart

After restarting pilight, also restart Home Assistant and it should be working now.

Let me know how it goes :slight_smile:

Oh, and in my configuration.yaml I have:

pilight:
  host: 192.168.0.11
  port: 5000

So an actual IP address (instead of 127.0.0.1) of RPi on which pilight is running.

Thank you for the extra Info, i haven’t found the anything about adding the Port in the config of pilight so Thank you for that :slight_smile:

And in my case pilight and HA are running on the same RPI so localhost or 127.0.0.1 is the right IP adress.

Adding the Port option in the Config from pilight removed the error in HA So i guess that is working now. :smile:
and i did kept 127.0.0.1 as the ip because i haven’t bothered giviing the RPI a static IP i might do that in a later stage but for now i don’t need it.

Thank you again for your help. :slight_smile:

Hi DJFLuFFy-vs-joe,

sorry to bump your thread - did you ever get it to work?

I am trying to do the exact same thing and I am struggling. I can send signals via rf (gpio17) but i still dont know how to receive signals. I have de-coded my remotes on another pi with rasbian installed. So I “Just” need to be able to receive signals from remotes so i can trigger automation-scripts.

if anybody else have ideas, im all ears (i have spent countless nights reading and i just cant seem to crack it)

thanks.

1 Like

i have an arduino that picks up all 433 mhz in my house.
if i have a new remote i just have to click the buttons to recognize the codes and from that moment i can use them.

No, not really,

I was struggling with upgrades and downgrades and pi light but I did not got it working.

In the end it screwed up my image so I made a backup of my configs and I flashed the SD card with the hass.io image

And I never tried to get it working again.

Instead I just bought two hue dimmer switches and now I use those to control my hue lights.

I’m sorry I could not help you.

I’m not sure how to make this a feature request if it’s possible at all.

Another option is modifying the listener script that you can download from the video and instead of printing the output to the display do a web socket request to HA. And then run the script in the background when the pi starts.

But I don’t know how CPU intensive this will be.
And I’m not familiar enough with the python language to create such a thing.

I could give it a try to make such a script in java but at the moment work is busy.

That’s a great solution but in my case I just want to have one device that controls everything.

I live in a small apartment and I prefer to just have the bare necessities for my home automaton.

i have several arduino’s performing that task, but its possible to have 1 arduino (or esp) that listens for the 433 mhz codes and also send the codes.

so it is:

remote >> arduino >> HA >> arduino >> device

that way you can also use a completely different remote to switch 433 mhz switches.

for instance i have a cheap 4 button remote in the bedroom to switch off a heatingblanket which is connected to a 433 mhz switch that normally never would work with that remote.

1 Like

hi again,

thanks for your swift reply, it’s appreciated.

I considered doing what you did with the hue, but ill keep searching for a solution for a while. Maybe i can use my other pi that is sniffing and sending RF with out problems to send a mqtt telegram to the hassio.

Ill let you know if i succeed!

thanks for your input.

That’s totally possible, or even what ReneTode did with an Arduino.

But I prefer the one device solution.

If you use Pilight and RPI_RF together, you can send and receive all day long. I have several remote controls, door/window sensors, and electrical plugs that I control using HASS and the remote controls. But, there are a few things you need to know to do this:

  1. Use a superheterodyne transmitter and receiver. The cheap ones don’t work well, if at all, because the range sucks on them. A good transmitter/receiver should cost you around $13 or so on Amazon.

Good Type: http://www.amazon.com/dp/B00HEDRHG6/
Bad Type: http://www.amazon.com/dp/B00M2CUALS/

  1. Use an external antenna on your superheterodyne transmitter and receiver. The jumper kits that you can get have roughly 6-8" wires in them. These are more than sufficient to have a 50’ or more range.

Jumper Kit Example: http://www.amazon.com/dp/B01LZF1ZSZ/

  1. If you have a remote that already controls an outlet, and the remote/outlet cannot be reprogrammed, you may experience some sync issues with HASS. This is because 433 stuff doesn’t have confirmation messages in its design. If HASS doesn’t “hear” the button press, it won’t know that the light is off/on. That causes the HASS state to not match the live state of the device. If you are intentional in your button presses and make sure you press it for at least a second, this is less likely to happen. But even if it does, you can automate around this to a degree.

So… in my example, you can have the following:

Remote 1
Remote 2
Remote 4
Outlet 1
Outlet 2
Outlet 3

As you can see, we’ve “lost” remote 3, and we’ve also “lost” outlet 4. Now, assume that Remote 1 only controls Outlet 1, Remote 2 controls Outlet 2, etc. So there’s no remote for Outlet 3, and no Outlet for Remote 4. If you know the codes to Outlet 3, you can still use HASS to control it. If it’s reprogrammable (like the ones that BRUH uses), you can reprogram it to match the new remote. If you don’t know the codes, you’ll have to use trial and error to guess the codes, but that’s nearly impossible. We’ll come back to Outlet 3 and Remote 4 later on. Let’s keep going.

In Pilight, you must first setup Pilight to listen to ALL protocols. This is documented in the manual install of Pilight, so I’m not going to go into detail on that.

NOTE: If you are up to date on your firmware on the Raspberry PI, you’ll need to use the Development Branch of Pilight. I’ve written another article on that, so I’m not going into detail on that either.

Once Pilight is installed and setup to listen to all the codes, you’ll use sudo pilight-receive to “listen” the codes from each Remote. When you press a button on the remote, you should see something like this:

{
	"message": {
		"id": "A3",
		"unit": 61,
		"state": "off"
	},
	"origin": "receiver",
	"protocol": "clarus_switch",
	"uuid": "0000-b8-27-eb-4ffabe",
	"repeats": 1
}

Repeat this for each button press on each remote. Once you have your codes and device types, you can re-run the Pilight setup so that Pilight only listens to those protocols that you need.

Once you’ve finished getting all the Pilight codes, you’ll still need to get the codes using RPI_RF so we can transmit them later. To do this, you’ll need the rpi-rf_receive.py file from the RPI_RF repository. The master link is: https://pypi.python.org/pypi/rpi-rf

Using the link above, download the rpi-rf_receive.py file located in the SCRIPTS section. Place that file in your home folder on your PI (not your AIO Virtual Environment if you’ve install HASS using that method). Then run chmod +x ./rpi-rf_receive.py in the same directory that you placed the file. This will allow it to be executed. Now, run the file using sudo ./rpi-rf_receive.py. You should see something like this if you did it correctly:

2017-10-22 22:15:00 - [INFO] rfrx: Listening for codes on GPIO 27
2017-10-22 22:16:00 - [INFO] rfrx: 21280 [pulselength 200, protocol 1]
2017-10-22 22:17:00 - [INFO] rfrx: 21211 [pulselength 200, protocol 1]

This will give you the “codes” that HASS will transmit when the button press is received. Repeat this for each button press.

Now that you have both the Pilight and RPI-RF codes, here’s how to set things up. We will have Pilight receive the codes, and RPI-RF transmit the codes. You “can” do both with Pilight, but I’ve found this method to be nearly bulletproof in accuracy, which is why I use it.

First, create 2 automations. The first one is triggered by the Pilight message that is generated when you press the ON button on the remote and will turn on the RPI-RF switch we will create later. The second one is triggered by the Pilight message that is generated when you press the OFF button on the remote and will turn off the RPI-RF switch we will create later.

automations/pilight_remote1_on.yaml

alias: "pilight_outlet1_on"
trigger:
  platform: event
  event_type: pilight_received
  event_data:
    protocol: clarus_switch
    uuid: 0000-b8-27-eb-4ffabe
    id: 'A3'
    state: 'on'
action:
  - service: homeassistant.turn_on
    entity_id: switch.rpirf_outlet1

automations/pilight_remote1_off.yaml

alias: "pilight_remote1_off"
trigger:
  platform: event
  event_type: pilight_received
  event_data:
    protocol: clarus_switch
    uuid: 0000-b8-27-eb-4ffabe
    id: 'A3'
    state: 'off'
action:
  - service: homeassistant.turn_off
    entity_id: switch.rpirf_outlet1

Next, we will create the RPI-RF switch in HASS:

switches/rpi_rf.yaml

platform: rpi_rf
gpio: 17
switches:
  rpirf_outlet1:
    #Outlet 1
    code_off: 21820
    code_on: 21811
    protocol: 1
    pulselength: 200
    signal_repetitions: 15

Now, make sure Pilight is running and restart HASS to activate the switch/automations you just created. Whenever you press the button on the remote, Pilight will receive that message, place that message on the HASS event bus, and the automation will be triggered. The automation tells the switch to be turned on (or off), which sends the RPI-RF code, which turns on the light.

Now, all you’ve really done is setup a switch in HASS that “mimics” the state of the REAL switch and remote. So now that you are armed with this information, you can now use a remote (Remote 4) to control an outlet that it wasn’t originally programmed for (Outlet 1 or 2). And assuming that you could successfully find the codes for Outlet 3, you could use Remote 4 to control Outlet 3.

Hopefully this helps. Also keep in mind, I wrote this late at night, so if I missed something or something doesn’t make sense, let me know.

2 Likes

So for my next example, I actually use a door/window sensor to turn on a light. In my real-world example, the door sensor turns on a Z-Wave light, but I’ll adopt the example for a RPI-RF switch instead.

Use Pilight to receive the codes as stated above and create 2 automations, one for the door opening and the other for the door closing.

automations/pilight_door1_opening.yaml

alias: "pilight_door1_opened"
trigger:
  platform: event
  event_type: pilight_received
  event_data:
    protocol: ev1527
    uuid: 0000-b8-27-eb-4ffabe
    unitcode: 355554
    state: opened
action:
  - service: homeassistant.turn_on
    entity_id: input_boolean.closet_door

automations/pilight_door1_closed.yaml

alias: "pilight_door1_closed"
trigger:
  platform: event
  event_type: pilight_received
  event_data:
    protocol: ev1527
    uuid: 0000-b8-27-eb-4ffabe
    unitcode: 879842
    state: opened
action:
  - service: homeassistant.turn_off
    entity_id: input_boolean.closet_door

The above Pilight automations trigger a fake switch (input_boolean) in HASS. Now we need to create this input_boolean switch. We use this fake switch in HASS so you can track the status of the door:

input_boolean:
  closet_door:
    name: Closet Door
    initial: off
    icon: mdi:glassdoor

Now, we need to create automations that actually send the RPI-RF codes to turn on/off the light whenever the input_boolean switch is turned on (opened) and off (closed):

automations/closet_door_opened.yaml

alias: "closet_door_opened"
trigger:
  platform: state
  entity_id: input_boolean.closet_door
  from: 'off'
  to: 'on'
action:
  - service: homeassistant.turn_on
    entity_id: switch.rpirf_closet_light

automations/closet_door_closed.yaml

alias: "closet_door_closed"
trigger:
  platform: state
  entity_id: input_boolean.closet_door
  from: 'on'
  to: 'off'
action:
  - service: homeassistant.turn_off
    entity_id: switch.rpirf_closet_light

Now, create the RPI-RF switch in HASS:

rpirf_closet_light:
  #Closet Light
  code_off: 28890
  code_on: 28881
  protocol: 1
  pulselength: 200
  signal_repetitions: 15

Save everything and restart HASS. You should now have a light that turns on when you open the door, and off when you close the door.

1 Like

This is cool, but as i’m trying to wrap my head around it, i’m wondering. It seems that these settings are for switches that stays on or off. I just realized that my doorbell uses RF, and i would like to have HA listen to that signal. So i need to configure an entity that changes state from 0 to 1, or quiet to dingdong for a sec or something that i can use in an automation to, say, send me a notification or blink a light if someone’s at the door. I’m only interested in the receiver as i do not intend to use any RF transmit signal as of now or probably ever. My struggle is to have a momentary state change on a received signal…