Rasperry PI RTL_SDR SUPPORT

cd ~

sudo apt-get install -y git git-core cmake libusb-1.0-0-dev
sudo apt update
sudo apt install -y build-essential
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr/ && mkdir build && cd build/
cmake ../ -DINSTALL_UDEV_RULES=ON
sudo make
sudo make install
sudo ldconfig
cd ~
sudo cp ./rtl-sdr/rtl-sdr.rules /etc/udev/rules.d/


# create file
no-rtl.conf

sudo nano /etc/modprobe.d/no-rtl.conf


# add these three
lines

blacklist
dvb_usb_rtl28xxublacklist rtl2832blacklist rtl2830

sudo reboot
lsusb
rtl_test -t


Build and install
rtl_433

sudo apt-get install -y libtool libusb-1.0.0-dev librtlsdr-dev rtl-sdr doxygen
git clone https://github.com/merbanan/rtl_433.git
cd rtl_433/
mkdir build
cd build
cmake ../
make
sudo make install
rtl_433 -f 344975000 -R 70

https://www.rtl-sdr.com/

Honeywell 5800RPS Door Sensor With Home Assistant

These are commonly installed by ADT Home security Systems and are for the most part great. They have a long battery life, a reasonable range, work on RF technology. If your subscription has run out or you wish to repurpose, how do you interface these great little sensors with Home Assistant ? Read on..

https://github.com/merbanan/rtl_433


def rtl_433_probe():
"""Run a rtl_433 UDP listener."""
global exitFlag
global doorVolume

time.sleep(4) # put this here incase any code could crash the pi


jq.setVolume(doorVolume)

try:
# Create listener for incoming json string packets.
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
sock.bind((UDP_IP, UDP_PORT))

## Connect to MQTT
mqttc = mqtt.Client()
mqttc.on_connect = mqtt_connect
mqttc.on_disconnect = mqtt_disconnect
mqttc.on_message=on_message #attach function to callback
mqttc.on_connect_fail=connect_fail_callback
mqttc.username_pw_set(MQTT_USERNAME, password=MQTT_PASSWORD)
LogEvent("connecting to " + MQTT_HOST)
mqttc.connect(MQTT_HOST, MQTT_PORT, 60)
mqttc.loop_start()


except Exception as e:
LogEvent("main loop exception %s" % (e))
time.sleep(5)
exit(1)


## Receive UDP datagrams, extract json, and publish.
while not exitFlag:
line, addr = sock.recvfrom(1024)
try:
line = parse_syslog(line)
data = json.loads(line)
publish_sensor_to_mqtt(mqttc, data, line)

except ValueError:
LogEvent("issue with json")
pass



def run():
"""Run main or daemon."""
# with daemon.DaemonContext(files_preserve=[sock]):
# detach_process=True
# uid
# gid
# working_directory
rtl_433_probe()


if __name__ == "__main__":
run()

Supervisor



pi@doorrf:/etc/supervisor/conf.d $ cat doorrf.conf
[program:doorrf]
command=python /home/pi/doorrf.py
user=pi
autostart=yes
autorestart=yes
startretries=100


pi@doorrf:/etc/supervisor/conf.d $ cat rtl_433.conf
[program:rtl_433]
command=/home/pi/rtl_433/build/src/rtl_433 -f 344975000 -R 70 -F syslog:127.0.0.1:1433
user=pi
autostart=yes
autorestart=yes
startretries=100


pi@doorrf:/etc/supervisor/conf.d $ cat squeeze.conf
[program:squeezebox]
command=/usr/bin/squeezelite-armv6hf -o sysdefault:CARD=sndrpihifiberry -s 10.0.0.36 -n doorrf
user=pi
autostart=yes
autorestart=yes
startretries=100







Install
supervisord

sudo apt-get install -y supervisor

Supervisor Commands


sudo service supervisor start

sudo
service supervisor status

sudo
service supervisor stop

sudo
service supervisor restart

Zigbee firmware flashing for CC2531


https://www.youtube.com/watch?v=RguRQUXWLCY

If you are using a CC2530 or CC2531; it is a common issue for this adapter to crash (due to its outdated hardware). Reflashing the firmware should fix the problem. If it happens often consider flashing the source routing firmware or upgrade to a more powerful adapter.

wget https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_Home_1.2/bin/source_routing/CC2531_SOURCE_ROUTING_20211116.zip


so login to pi

Check if WiringPi is installed (should be) by running gpio -v if you don’t see the version in the output

sudo apt install wiringpi

Navigate to the folder

cd flash_cc2531

and see if the USB device is wired correctly running:

./cc_chipid

You should see ID = b524. if any other outcome is given, check your wires.

md flash

cd flash

wget https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_3.0.x/bin/CC2531_20190425.zip

or use the alternative above....

unzip file

cd ..

Clear the flash with 

./cc_erase 

Upload new firmware using 

./cc_write /home/pi/flash_cc2531/flash/CC2531ZNP-Prod.hex 

this will take about 3 min.