It seems like a BIG PROBLEM just to read RX from 433MHz receiver which receives signals from motion sensor. It is no problem to read GPIO27 with python script. Some people use PILIGHT but there are issues with Raspi3, hassbian etc. RF to MQTT on the same raspberry where runs HA seems also be some kind of problem - don´t know why.
Would it be possible to read those data from GPIO27 (attached to RXB6 RX 433MHz receiver) and use them for automation (trigger alarm)? Thank you.
Thanks @gpbenton “Alternatively, you can update your Python script to send MQTT messages to HA.” Do you know how? Or how to create a command line sensor?
You need to include the paho-mqtt package in your python script and use the publish single interface at the point where you have determined the value of the sensor to send the MQTT message.
@keithh666 Maybe this could be the way with Pi RF Switch. But switch needs states ON and OFF. Motion sensor only sends single code - if movement is detected. How to solve some “autooff” of this switch. Do you think it is possible with switch if I need sensor?
@keithh666 IT IS NOT POSSIBLE TO USE PI RF SWITCH - because this component is for sending signal, not receiving. I need to receive signal FROM motion detector and create automation based on this (trigger alarm).
You can use rtl_433 and a supported DVB-T tuner to receive (only receive) 433mhz commands.
There are approx 90 supported protocols.
I understand it works well on RPi - more in this thread:
YOU DON’T NEED TO SHOUT!!! The receive part can be done with the rpi-rf · PyPI rpi_rf module.
I use a combination of pilight and RF Link for my 433Mhz devices as they can both receive and transmit.
The way to get over the fact that most cheap PIR sensors only send a movement detected signal is to create an automation that runs on reception of said “on” signal and delay till just before the retrigger period ends and turn it off. I do the following for my cheap PIR sensors…
From automation.yaml
###############################################################################################
# #
# Turn off the PIR's once they have triggered #
# #
###############################################################################################
- alias: 'Turn off PIRs'
trigger:
- platform: state
entity_id: switch.rfl_bedroom_pir, switch.rfl_livingroom_pir, switch.rfl_hall_pir, switch.rfl_kitchen_pir
from: 'off'
to: 'on'
action:
- delay: '00:00:10'
- service: switch.turn_off
entity_id: switch.rfl_bedroom_pir, switch.rfl_livingroom_pir, switch.rfl_hall_pir, switch.rfl_kitchen_pir
Thank you @keithh666. I´m NOT SHOUTING. This is only for better navigation throught this node for anybody who only scans the text
Pilight seems to be mighty tool but there are many problemy on Raspberry3 with Hassbian. I didn´t get it to work. Regarding to @hijinx solution. Great job. But I prefer not to run docker or anything other on the same device where I run HA. I want to let as much resources as possible for HA itself. I want to do everything in single device. If this will be not possible I will use RFlink (Arduino+RF) - seems to be cheap and versatile solution with good support. Yes, not cheaper than @hijinx but without docker.
Anyway I just don´t want to accept that is is IMPOSSIBLE to receive dummy data from motion sensor directly to HA via GPIO. Many people talk about how easy it is but nowhere on whole internet you can´t find a receipt how to do it. Really strange.
I’m not really sure what you are expecting. The direct way of using the GPIO with HA is using the GPIO interface.
If this doesn’t work for your sensor, then I have suggested 2 ways of modifying your python script to send data in to HA. There really isn’t much else anyone can offer.
@keithh666 or other Please could you recommend how to read from GPIO using rpi_gpio?
RXB6 433MHz receiver is connected to raspberry´s GPIO. RF sniffing python script is able to read codes from rf devices. How to get it into home assistant using rpi_gpio?
binary_sensor:
- platform: rpi_gpio
ports:
11: PIR Office
12: PIR Bedroom
However as I assume you have figured out your pir is not directly connected it’s using RF433 so you need a program to decode the RF and send a appropriate message to HA, this is usually done with either some other HW such as RF Link, Telldus, RFXTX or some RF receiver and transmitter directly connect to the PI with either pilight or some other SW decoding the RF to send a message to HA. You could use some other software to decode the RF and use it to toggle the GPIO pins directly but that would not be efficient and you only have so many GPIO’s. If you have the Rx’er and Tx’er attached to the PI then pilight is the best option that I know. If you have some other software sniffing the code from your Rx’er then just modify it to send a MQTT message to HA.
Thanks Keith. I´m right now on the way to try both MQTT and Pilight. I would like to have all on single board (raspberry) so we will see what is better solution. I will need MQTT for other switches so I hope this will be better way for me but seems like there is no direct solution for RF2MQTT on Pi. All I checked till now was based on arduino