### Configure rtl_433 Settings in a Configuration File Source: https://github.com/merbanan/rtl_433/wiki/How-to-integrate-rtl_433-sensors-into-openHAB-via-MQTT Place configuration directives in a file (e.g., rtl_433.conf) for better readability and management. This example shows MQTT output, protocol reporting, and a flex decoder setup. ```ini # to get the "protocol"-token available in output and set the time output to ISO report_meta protocol report_meta time:iso # specify MQTT output and formatting output mqtt://localhost:1883,retain=0,devices=sensors/rtl_433/P[protocol:255]/C[channel:0] # enable the needed protocol (25 in our example) protocol 25 # GT-WT-02 Sensor # create the flex decoder specification decoder { n=EV1527-PIR, m=OOK_PWM, s=400, l=1200, g=1500, r=12000, repeats>=4, rows=25, get=@0:{25}:channel:[1234567:10 2345678:20], get=@0:{1}:command:[0:OPEN 1:OPEN], unique } ``` -------------------------------- ### Install Pkgconfig Files Source: https://github.com/merbanan/rtl_433/blob/master/CMakeLists.txt This command installs the generated pkgconfig files to the 'lib/pkgconfig' directory, allowing other projects to easily find and link against the installed RTL-SDR library. ```cmake INSTALL( FILES DESTINATION lib/pkgconfig ) ``` -------------------------------- ### Home Assistant MQTT Auto Discovery Setup Source: https://context7.com/merbanan/rtl_433/llms.txt Automatically configure Home Assistant sensors via MQTT discovery using a Python script. Start rtl_433 with MQTT output and then run the discovery script in a separate terminal. Custom MQTT settings, device filtering, and MQTT retain can be configured. ```bash # Start rtl_433 with MQTT output rtl_433 -C si -M time:unix:usec:utc -F mqtt://localhost:1883 ``` ```bash # Run the Home Assistant discovery script (separate terminal) python3 examples/rtl_433_mqtt_hass.py ``` ```bash # With custom MQTT settings python3 examples/rtl_433_mqtt_hass.py -H 192.168.1.100 -u myuser -P mypassword ``` ```bash # With device filtering (allow list) python3 examples/rtl_433_mqtt_hass.py --ids 12345,67890 ``` ```bash # Enable MQTT retain for persistent discovery python3 examples/rtl_433_mqtt_hass.py -r ``` -------------------------------- ### Define Installation Paths Source: https://github.com/merbanan/rtl_433/blob/master/CMakeLists.txt This sets up variables for installation paths, defining 'prefix', 'exec_prefix', 'libdir', and 'includedir' based on the CMAKE_INSTALL_PREFIX. ```cmake set(prefix ${CMAKE_INSTALL_PREFIX}) set(exec_prefix ${prefix}) set(libdir ${exec_prefix}/lib) set(includedir ${prefix}/include) ``` -------------------------------- ### Install rtl_433 to Global Prefix with sudo Source: https://github.com/merbanan/rtl_433/blob/master/docs/BUILDING.md Install rtl_433 to a global prefix (e.g., /usr/local) using sudo with CMake and Make. ```bash sudo cmake --build build --target install ``` -------------------------------- ### Example MQTT Output Topics Source: https://github.com/merbanan/rtl_433/wiki/How-to-integrate-rtl_433-sensors-into-openHAB-via-MQTT These are example topics and values published to the MQTT broker after configuring rtl_433 for prettified output. ```mqtt sensors/rtl_433/P25/C3/time 2019-08-30T14:23:25 sensors/rtl_433/P25/C3/protocol 25 sensors/rtl_433/P25/C3/id 20 sensors/rtl_433/P25/C3/channel 3 sensors/rtl_433/P25/C3/battery_ok 1 sensors/rtl_433/P25/C3/button 0 sensors/rtl_433/P25/C3/temperature_C 28.400000 sensors/rtl_433/P25/C3/humidity 38.000000 sensors/rtl_433/P25/C3/mic CHECKSUM sensors/rtl_433/P255/C0/time 2019-08-30T14:23:25 sensors/rtl_433/P255/C0/count 25 sensors/rtl_433/P255/C0/num_rows 25 sensors/rtl_433/P255/C0/len 1 sensors/rtl_433/P255/C0/data 8 sensors/rtl_433/P255/C0/time 2019-08-30T14:23:26 sensors/rtl_433/P255/C0/count 25 sensors/rtl_433/P255/C0/num_rows 25 sensors/rtl_433/P255/C0/len 25 sensors/rtl_433/P255/C0/data 1234567 ``` -------------------------------- ### Install Dependencies on Debian/Ubuntu (with tools) Source: https://github.com/merbanan/rtl_433/blob/master/docs/BINARY_BUILDS.md Installs rtl-sdr, openssl, and SoapySDR tools using apt for Debian-based systems. ```bash sudo apt-get install -y rtl-sdr openssl soapysdr-tools ``` -------------------------------- ### Flex Decoder Example with Match and Repeats Source: https://github.com/merbanan/rtl_433/blob/master/docs/OPERATION.md This example specifies a doorbell decoder with OOK_PWM modulation, timing parameters, a required data match, and a minimum repeat count. ```bash -X "n=doorbell,m=OOK_PWM,s=400,l=800,r=7000,g=1000,match={24}0xa9878c,repeats>=3" ``` -------------------------------- ### Install Dependencies on HomeBrew Source: https://github.com/merbanan/rtl_433/blob/master/docs/BINARY_BUILDS.md Installs essential libraries for rtl_433 using Homebrew. SoapySDR is optional. ```bash brew install libusb ``` ```bash brew install openssl@3 ``` ```bash brew install librtlsdr ``` ```bash brew install soapysdr ``` -------------------------------- ### Install RTL_433 Configuration Files Source: https://github.com/merbanan/rtl_433/blob/master/conf/CMakeLists.txt Installs all found .conf files into the system's configuration directory for rtl_433. It uses CMake variables to determine the correct installation path, with specific notes on handling absolute paths for /etc. ```cmake file(GLOB RTL433_CONF_FILES "*.conf") # Note that apparently bare `etc` or relative CMAKE_INSTALL_SYSCONFDIR # always gets CMAKE_INSTALL_PREFIX prepended. # Use absolute CMAKE_INSTALL_FULL_SYSCONFDIR to get /etc for /usr prefix. # Note that CMAKE_STAGING_PREFIX should contain CMAKE_INSTALL_PREFIX but # that component is not stripped here. Breaks cross-compile SYSCONFDIR. install( FILES ${RTL433_CONF_FILES} DESTINATION ${CMAKE_STAGING_PREFIX}${CMAKE_INSTALL_FULL_SYSCONFDIR}/rtl_433 ) ``` -------------------------------- ### Enable and Start rtl_433 Systemd Service Source: https://github.com/merbanan/rtl_433/wiki/How-to-integrate-rtl_433-sensors-into-openHAB-via-MQTT Enable the rtl_433 service to start on system boot and then start the service immediately. These commands manage the systemd service lifecycle. ```bash #systemctl enable rtl_433-mqtt.service #systemctl start rtl_433-mqtt.service ``` -------------------------------- ### Build and Install rtl_433 with CMake and Ninja Source: https://github.com/merbanan/rtl_433/blob/master/docs/BUILDING.md Build and install rtl_433 using CMake with the Ninja generator for potentially faster builds. Enables colored output. ```bash cd rtl_433/ cmake -DFORCE_COLORED_BUILD:BOOL=ON -GNinja -B build cmake --build build -j 4 cmake --build build --target install ``` -------------------------------- ### Install rtl_433 Source: https://github.com/merbanan/rtl_433/wiki/View-a-saved-cu8-file Installs the rtl_433 application after compilation. This ensures that the 'sigrok-open.sh' script can find and execute rtl_433. ```bash make install ``` -------------------------------- ### Setup Named Pipe for RTL-433 Input Source: https://github.com/merbanan/rtl_433/wiki/Signal-Preprocessing This Python snippet sets up a named pipe for RTL-433 to read from. It removes any existing file, creates a new named pipe, and starts the rtl_433 process in the background, directing its output to the pipe. ```python # Remove the file GNU Radio creates initially. os.system("rm " + self.file_sink_output) # Create the named pipe that we will output to. os.system("mkfifo " + self.output_file_name) # Start the RTL_433 program to read from our FIFO in the background os.system("rtl_433 -r " + self.output_file_name + " -Y autolevel -M time:iso\n -M level -M protocol &") # Set the file sink output to use our named pipe. self.set_file_sink_output(self.output_file_name) ``` -------------------------------- ### Install Git Source: https://github.com/merbanan/rtl_433/wiki/Adding-a-new-remote-device-and-writing-the-decoder-C-code Installs the git version control system on Debian-based systems. ```bash sudo apt-get git ``` -------------------------------- ### Install Dependencies for Building on Debian/Ubuntu Source: https://context7.com/merbanan/rtl_433/llms.txt Installs necessary development libraries and tools for compiling rtl_433 from source on Debian-based systems. ```bash # Install dependencies (Debian/Ubuntu) sudo apt-get install libtool libusb-1.0-0-dev librtlsdr-dev rtl-sdr \ build-essential cmake pkg-config ``` -------------------------------- ### Example: Select RTL-SDR by Index Source: https://github.com/merbanan/rtl_433/blob/master/docs/OPERATION.md Explicitly select the first available RTL-SDR device using index 0. ```bash rtl_433 -d 0 ``` -------------------------------- ### Copy Example Configuration File Source: https://github.com/merbanan/rtl_433/wiki/How-to-integrate-rtl_433-sensors-into-openHAB-via-MQTT Copy the sample configuration file to a desired location. This is a prerequisite for customizing rtl_433 settings via a config file. ```bash cp conf/rtl_433.example.conf /etc/rtl_433/rtl_433.conf ``` -------------------------------- ### Example: Connect to Specific rtl_tcp Source Source: https://github.com/merbanan/rtl_433/blob/master/docs/OPERATION.md Connect to a specific rtl_tcp source by providing the host and optionally the port. ```bash rtl_433 -d rtl_tcp:192.168.2.1:2143 ``` -------------------------------- ### Build and Install rtl_433 with CMake and Make Source: https://github.com/merbanan/rtl_433/blob/master/docs/BUILDING.md Build and install rtl_433 using CMake and Make. This is a common method for building on Linux and macOS. ```bash cd rtl_433/ cmake -B build cmake --build build --target install ``` -------------------------------- ### Install Debian Dependencies for rtl_433 Source: https://github.com/merbanan/rtl_433/blob/master/docs/BUILDING.md Install necessary libraries and build tools for rtl_433 on Debian-based systems. Install libssl-dev if TLS connections are required. ```bash sudo apt-get install libtool libusb-1.0-0-dev librtlsdr-dev rtl-sdr build-essential cmake pkg-config ``` -------------------------------- ### Install Fedora/CentOS/RHEL Dependencies for rtl_433 Source: https://github.com/merbanan/rtl_433/blob/master/docs/BUILDING.md Install required development libraries for rtl_433 on Fedora, CentOS, or RHEL systems using dnf or yum. Install openssl-devel for TLS support. ```bash sudo dnf install libtool libusb1-devel rtl-sdr-devel rtl-sdr cmake ``` -------------------------------- ### Example: Apply SoapySDR Settings for Antenna and Bandwidth Source: https://github.com/merbanan/rtl_433/blob/master/docs/OPERATION.md Configure the antenna to 'A' and set the bandwidth to 4.5 MHz for a SoapySDR device. ```bash rtl_433 -t "antenna=A,bandwidth=4.5M,rfnotch_ctrl=false" ``` -------------------------------- ### Example: Set Multiple Frequencies for Hopping Source: https://github.com/merbanan/rtl_433/blob/master/docs/OPERATION.md Configure rtl_433 to hop between multiple specified frequencies. ```bash -f 433.92M -f 868M -f 315M -f 345M -f 915M ``` -------------------------------- ### Install Man Pages Source: https://github.com/merbanan/rtl_433/blob/master/CMakeLists.txt This command installs the man pages from the 'man' directory to the 'share/man' destination, excluding any files with the '.md' extension. ```cmake install(DIRECTORY man DESTINATION share PATTERN ".md" EXCLUDE) ``` -------------------------------- ### Install Dependencies on Debian/Ubuntu (OpenSSL 3) Source: https://github.com/merbanan/rtl_433/blob/master/docs/BINARY_BUILDS.md Installs minimal libraries for rtl_433 on newer Debian/Ubuntu systems using OpenSSL 3. ```bash sudo apt-get install -y librtlsdr0 libssl3 libsoapysdr0.8 ``` -------------------------------- ### Install Dependencies on Debian/Ubuntu (OpenSSL 1.1) Source: https://github.com/merbanan/rtl_433/blob/master/docs/BINARY_BUILDS.md Installs minimal libraries for rtl_433 on older Debian/Ubuntu systems using OpenSSL 1.1. ```bash sudo apt-get install -y librtlsdr0 libssl1.1 libsoapysdr0.7 ``` -------------------------------- ### Install Dependencies for TLS Support Source: https://context7.com/merbanan/rtl_433/llms.txt Installs the OpenSSL development library required for building rtl_433 with TLS support for MQTT and InfluxDB. ```bash # For TLS support (MQTT/InfluxDB over TLS) sudo apt-get install libssl-dev ``` -------------------------------- ### Install Homebrew Dependencies for rtl_433 Source: https://github.com/merbanan/rtl_433/blob/master/docs/BUILDING.md Install rtl-sdr, cmake, and pkg-config using Homebrew on macOS. ```bash brew install rtl-sdr cmake pkg-config ``` -------------------------------- ### Example: Use RTL-SDR via SoapySDR Source: https://github.com/merbanan/rtl_433/blob/master/docs/OPERATION.md Specify the RTL-SDR driver string to use RTL-SDR through SoapySDR. ```bash rtl_433 -d "driver=rtlsdr" ``` -------------------------------- ### Install Dependencies on MacPorts Source: https://github.com/merbanan/rtl_433/blob/master/docs/BINARY_BUILDS.md Installs essential libraries for rtl_433 using MacPorts. SoapySDR is optional. ```bash sudo port install libusb openssl3 rtl-sdr ``` ```bash sudo port install SoapySDR ``` -------------------------------- ### Example: Open Default SoapySDR Device Source: https://github.com/merbanan/rtl_433/blob/master/docs/OPERATION.md Open the default SoapySDR device when SoapySDR support is compiled in and RTL-SDR is not the default. ```bash rtl_433 -d "" ``` -------------------------------- ### Build rtl_433 on macOS with Homebrew Source: https://context7.com/merbanan/rtl_433/llms.txt Installs dependencies using Homebrew and builds rtl_433 from source on macOS. ```bash # macOS with Homebrew brew install rtl-sdr cmake pkg-config git clone https://github.com/merbanan/rtl_433.git && cd rtl_433 cmake -B build && cmake --build build ``` -------------------------------- ### RTL-433 Flex Decoder Output Example Source: https://github.com/merbanan/rtl_433/wiki/Decipher-a-new-device-and-write-a-decoder Example output from the rtl_433 flex decoder when successfully decoding a transmission. This format provides details about the detected signal. ```text Disabling all device decoders. Registered 1 out of 120 device decoding protocols [ ] Test mode active. Reading samples from file: ../../../rtl_433_tests/tests/XC-0324/01/gfile001.cu8 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Tag : gfile001.cu8 time : @0.046920s model : MYFIRSTTEST count : 1 num_rows : 1 rows : len : 149 data : 2fd177c040090bf45df0100242fd177c040090 codes : {149}2fd177c040090bf45df0100242fd177c040090 ``` -------------------------------- ### Example: Set Frequency with k Suffix Source: https://github.com/merbanan/rtl_433/blob/master/docs/OPERATION.md Set the receive frequency using the k suffix for kilohertz. ```bash -f 433920k ``` -------------------------------- ### Extracting Bits with Mapping and Format Specifier Source: https://github.com/merbanan/rtl_433/blob/master/docs/OPERATION.md Example demonstrating how to extract specific bits, apply a mapping for values, and use a format specifier for the output. ```bash get=battery:@4:{1}:[0:Ok 1:Empty] ``` -------------------------------- ### Example: Set LimeSDR Gain Elements Source: https://github.com/merbanan/rtl_433/blob/master/docs/OPERATION.md Individually set the gain for LNA, TIA, and PGA stages on a LimeSDR device. ```bash rtl_433 -g "LNA=20,TIA=8,PGA=2" ``` -------------------------------- ### Create Systemd Service File for rtl_433 Source: https://github.com/merbanan/rtl_433/wiki/How-to-integrate-rtl_433-sensors-into-openHAB-via-MQTT Define a systemd service unit to manage the rtl_433 MQTT publisher. This ensures it starts automatically on boot and restarts if it fails. ```systemd # more /etc/systemd/system/rtl_433-mqtt.service [Unit] Description=rtl_433 to MQTT publisher After=network.target [Service] ExecStart=/usr/local/bin/rtl_433 Restart=always RestartSec=5 [Install] WantedBy=multi-user.target ``` -------------------------------- ### Example: Select RTL-SDR by Serial Number Source: https://github.com/merbanan/rtl_433/blob/master/docs/OPERATION.md Select an RTL-SDR device using its unique serial number, prefixed with a colon. ```bash rtl_433 -d :NESDRSMA ``` -------------------------------- ### RTL-433 Flex Decoder Usage Example (Live Transmission) Source: https://github.com/merbanan/rtl_433/wiki/Decipher-a-new-device-and-write-a-decoder Tests demodulation parameters using the flex decoder with live radio transmissions on a specified frequency. ```bash ./rtl_433 -R 0 -X "n=LIVETEST,m=OOK_PPM,s=520,l=1000,r=3000" -f 433920000 ``` -------------------------------- ### Install Public Header Files with CMake Source: https://github.com/merbanan/rtl_433/blob/master/include/CMakeLists.txt Use this CMake command to install public header files into the 'include' directory. Ensure the header files exist in the project's root directory. ```cmake install(FILES rtl_433.h rtl_433_devices.h DESTINATION include ) ``` -------------------------------- ### Example: Set Frequency in Hz Source: https://github.com/merbanan/rtl_433/blob/master/docs/OPERATION.md Specify the receive frequency directly in Hertz. ```bash -f 433920000 ``` -------------------------------- ### Create Uninstall Target Source: https://github.com/merbanan/rtl_433/blob/master/CMakeLists.txt This configuration sets up a custom 'uninstall' target. It uses a CMake script generated from a template to handle the removal of installed files. ```cmake configure_file( ${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake @ONLY) add_custom_target(uninstall ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake ) ``` -------------------------------- ### Build rtl_433 with Explicit CMake Options Source: https://github.com/merbanan/rtl_433/blob/master/docs/BUILDING.md Configure and build rtl_433 using CMake with explicit settings for RTL-SDR, SoapySDR, OpenSSL, documentation, build type, and generator. Installs to a specified DESTDIR. ```bash cmake -DENABLE_RTLSDR=ON -DENABLE_SOAPYSDR=ON -DENABLE_OPENSSL=ON -DBUILD_DOCUMENTATION=OFF -DCMAKE_BUILD_TYPE=Release -GNinja -B build cmake --build build -j 10 DESTDIR=/tmp/destdir cmake --build build --target install ``` -------------------------------- ### Example: Set Default Frequency Source: https://github.com/merbanan/rtl_433/blob/master/docs/OPERATION.md Set the receive frequency to the default 433.92 MHz using the M suffix. ```bash -f 433.92M ``` -------------------------------- ### RTL-433 Flex Decoder Usage Example (File Input) Source: https://github.com/merbanan/rtl_433/wiki/Decipher-a-new-device-and-write-a-decoder Tests demodulation parameters using the flex decoder with a specified file containing recorded samples. Ensure to replace with the actual path. ```bash ./rtl_433 -R 0 -X "n=MYFIRSTTEST,m=OOK_PPM,s=520,l=1000,r=3000" -r /g*.cu8 ``` -------------------------------- ### File Header Copyright Notice Source: https://github.com/merbanan/rtl_433/blob/master/docs/CONTRIBUTING.md All files must start with a copyright notice, including the software name, copyright holder, and license information. Indent the entire block by 4 spaces. ```c /** @file Bresser Weather Center 5-in-1. Copyright (C) 2019 Christian W. Zuckschwerdt This program is free software; you redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. */ ``` -------------------------------- ### Configure HTTP API Server Source: https://github.com/merbanan/rtl_433/blob/master/README.md Start an HTTP API server with the -F option. The default bind address is '0.0.0.0' and the port is '8433'. A UI is accessible at e.g. http://localhost:8433/. ```bash -F http:0.0.0.0:8433 ``` -------------------------------- ### Extracting Bits with Format Specifier Source: https://github.com/merbanan/rtl_433/blob/master/docs/OPERATION.md Example showing how to extract specific bits and apply a format specifier for the output, without value mapping. ```bash get=battery:@4:{1}:%x ``` -------------------------------- ### Example rtl_433 pipe command Source: https://github.com/merbanan/rtl_433/blob/master/examples/README.md Demonstrates how to pipe JSON output from rtl_433 to a processing script like rtl_433_statsd_pipe.py. This method requires the rtl_433 process and the processing script to be started and stopped together. ```bash rtl_433 -F json ... | rtl_433_statsd_pipe.py ``` -------------------------------- ### Bash script for HTTP command API Source: https://github.com/merbanan/rtl_433/blob/master/examples/README.md An example bash script, rtl_433_http_cmd.sh, demonstrating custom hop controller logic for rtl_433's HTTP command API. ```bash # rtl_433_http_cmd.sh: Custom hop controller example for rtl_433's HTTP cmd API ``` -------------------------------- ### HTTP API Server for rtl_433 Source: https://context7.com/merbanan/rtl_433/llms.txt Enable the built-in HTTP server for web access to sensor data and streaming. Default port is 8433, can be customized. Examples show starting the server and accessing data via curl. ```bash # Start HTTP API server on default port 8433 rtl_433 -F http ``` ```bash # Bind to all interfaces on custom port rtl_433 -F http://0.0.0.0:8080 ``` ```text # Access the web UI # Browser: http://localhost:8433/ ``` ```text # Stream events via HTTP (chunked JSON) # curl http://localhost:8433/events ``` ```text # Get current state snapshot # curl http://localhost:8433/states ``` -------------------------------- ### Build Documentation with Doxygen Source: https://github.com/merbanan/rtl_433/blob/master/CMakeLists.txt This section configures the build to optionally generate API documentation using Doxygen. It checks if Doxygen is installed and enabled, configures the Doxyfile, and adds a custom target 'doc_doxygen' to build the documentation. ```cmake option(BUILD_DOCUMENTATION "Create and install the HTML based API documentation (requires Doxygen)" OFF) find_package(Doxygen) if(BUILD_DOCUMENTATION) if(NOT DOXYGEN_FOUND) message(FATAL_ERROR "Doxygen is needed to build the documentation.") endif() set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in) set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) if(DOXYGEN_DOT_FOUND) set(HAVE_DOT "YES") else() set(HAVE_DOT "NO") endif() configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) message(STATUS "Doxygen build started") # note the option ALL which allows to build the docs together with the application add_custom_target(doc_doxygen ALL COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating API documentation with Doxygen" VERBATIM) # install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html DESTINATION share/doc) endif() ``` -------------------------------- ### Setup Network Libraries for Windows Source: https://github.com/merbanan/rtl_433/blob/master/CMakeLists.txt This snippet conditionally appends network libraries (ws2_32, mswsock, netapi32) to the build configuration when cross-compiling for MinGW or MSVC environments on Windows. ```cmake if(MINGW OR MSVC) list(APPEND NET_LIBRARIES ws2_32 mswsock netapi32) endif() ``` -------------------------------- ### Install MacPorts Dependencies for rtl_433 Source: https://github.com/merbanan/rtl_433/blob/master/docs/BUILDING.md Install rtl-sdr and cmake using MacPorts on macOS. Install openssl if TLS support is needed. ```bash sudo port install rtl-sdr cmake ``` -------------------------------- ### Install PulseView on Debian/Raspbian Source: https://github.com/merbanan/rtl_433/wiki/View-a-saved-cu8-file Installs PulseView using the apt-get package manager. Note that this may install an older version of PulseView. ```bash sudo apt-get update apt-get install pulseview ``` -------------------------------- ### MQTT Output Integration for rtl_433 Source: https://context7.com/merbanan/rtl_433/llms.txt Publish decoded sensor data to an MQTT broker. Configure host, port, authentication, topic structure, and TLS encryption. Example shows SI units and precise timestamps. ```bash # Basic MQTT output to localhost rtl_433 -F mqtt ``` ```bash # MQTT with custom host and port rtl_433 -F mqtt://192.168.1.100:1883 ``` ```bash # MQTT with authentication rtl_433 -F "mqtt://localhost:1883,user=myuser,pass=mypassword" ``` ```bash # MQTT with custom topic structure and retain disabled rtl_433 -F "mqtt://localhost:1883,retain=0,devices=rtl_433[/id]" ``` ```bash # MQTT with TLS encryption rtl_433 -F "mqtts://host,tls_cert=/path/cert.pem,tls_key=/path/key.pem,tls_ca_cert=/path/ca.pem" ``` ```bash # Full MQTT example with SI units rtl_433 -C si -M time:unix:usec:utc -F mqtt://localhost:1883 ``` ```text # Example MQTT topics published: # rtl_433/hostname/devices/Acurite-609TXC/A/123/temperature_C 22.5 # rtl_433/hostname/devices/Acurite-609TXC/A/123/humidity 45 # rtl_433/hostname/devices/Acurite-609TXC/A/123/battery_ok 1 ``` -------------------------------- ### Configure rtl_433 with a Configuration File Source: https://context7.com/merbanan/rtl_433/llms.txt Use a configuration file for persistent settings instead of command-line options. Place the file in ~/.config/rtl_433/ or /usr/local/etc/rtl_433/. You can explicitly load a configuration file or override settings with command-line options. ```ini # rtl_433.conf - place in ~/.config/rtl_433/ or /usr/local/etc/rtl_433/ # Tuner settings frequency 433.92M sample_rate 250k gain 40 # FSK pulse detection pulse_detect autolevel pulse_detect squelch pulse_detect magest # Output format output json convert si # Metadata report_meta level report_meta noise report_meta stats report_meta time:usec report_meta protocol # Enable specific protocols protocol 40 # Acurite sensors protocol 78 # Fine Offset WH25/WH32 protocol 119 # Bresser 5-in-1 # Disable protocols # protocol -8 # Disable LaCrosse TX # Custom flex decoder decoder n=mydoorbell,m=OOK_PWM,s=400,l=800,r=7000,g=1000,bits=24 ``` ```bash # Load configuration file explicitly rtl_433 -c /path/to/rtl_433.conf ``` ```bash # Override config settings with command line rtl_433 -c rtl_433.conf -f 868M ``` -------------------------------- ### Convert Sample File Format Source: https://github.com/merbanan/rtl_433/blob/master/docs/IQ_FORMATS.md This command converts a sample file from one I/Q format to another. The first file is the output, and the second is the input. ```bash rtl_433 -w FILE.cu8 FILE.cs16 ``` -------------------------------- ### Configure MQTT Output with Topic Formatting Source: https://github.com/merbanan/rtl_433/wiki/How-to-integrate-rtl_433-sensors-into-openHAB-via-MQTT Use the -F flag with MQTT details and -M flags to format topics. Placeholders like [protocol:255] and [channel:0] can be used for dynamic topic generation. ```bash -F mqtt://localhost:1883,retain=0,devices=sensors/rtl_433/P[protocol:255]/C[channel:0] -M newmodel -M protocol -M time:iso ``` -------------------------------- ### Write Received Data to Sample File Source: https://github.com/merbanan/rtl_433/blob/master/docs/IQ_FORMATS.md Use this command to write received I/Q sample data to a file in the specified format. Ensure the file extension matches the desired format (e.g., .cu8). ```bash rtl_433 -w FILE.cu8 ``` -------------------------------- ### Rubicson Temperature Sensor Configuration Example Source: https://github.com/merbanan/rtl_433/wiki/Adding-a-new-remote-device-and-writing-the-decoder-C-code Example configuration for a Rubicson Temperature Sensor, specifying modulation, pulse limits, and callback function. ```c .name = "Rubicson Temperature Sensor", .modulation = OOK_PULSE_PPM_RAW, .short_limit = 488+970, // Gaps: Short 976µs, Long 1940µs, Sync 4000µs .long_limit = 970+2000, // Pulse: 500µs (Initial pulse in each package is 388µs) .reset_limit = 4800, // Two initial pulses and a gap of 9120µs is filtered out .json_callback = &rubicson_callback, .disabled = 0, .demod_arg = 0, .fields = output_fields, ``` -------------------------------- ### Configure rtl_433 for Home Assistant MQTT Source: https://github.com/merbanan/rtl_433/blob/master/docs/INTEGRATION.md Start rtl_433 with MQTT output enabled and specific formatting for Home Assistant integration. The `-C si` flag is for SI units, and `-M time:unix:usec:utc` adds timestamp information. ```bash rtl_433 -C si -M time:unix:usec:utc -F mqtt ``` -------------------------------- ### Basic rtl_433 Command Line Usage Source: https://context7.com/merbanan/rtl_433/llms.txt Run rtl_433 with default settings or specify frequency, sample rate, and gain. Use -R to enable/disable specific decoders. -C si converts units to SI. -T sets runtime in seconds. -H hops between frequencies. ```bash # Default receive mode - listen at 433.92 MHz rtl_433 ``` ```bash # Listen at 868 MHz with 1024k sample rate rtl_433 -f 868M -s 1024k ``` ```bash # Listen at 315 MHz with specific gain rtl_433 -f 315M -g 40 ``` ```bash # Enable only specific decoders (protocol numbers) rtl_433 -R 1 -R 8 -R 43 ``` ```bash # Disable specific decoders rtl_433 -R -8 -R -19 ``` ```bash # Convert units to SI (Celsius, km/h, mm) rtl_433 -C si ``` ```bash # Run for 120 seconds then exit rtl_433 -T 120 ``` ```bash # Hop between multiple frequencies every 15 seconds rtl_433 -f 433.53M -f 434.02M -H 15 ``` -------------------------------- ### Python script for receiving syslog packets Source: https://github.com/merbanan/rtl_433/blob/master/examples/README.md This Python script, rtl_433_custom.py, is an example of how to receive JSON syslog packets from rtl_433. ```python # rtl_433_custom.py: Receive json syslog packets in python ``` -------------------------------- ### Example rtl_433 UDP syslog command Source: https://github.com/merbanan/rtl_433/blob/master/examples/README.md Shows how to configure rtl_433 to send data via UDP syslog and run a relay script like rtl_433_mqtt_relay.py as a separate process. This allows for multiple rtl_433 instances to send data to the same relay. ```bash rtl_433_mqtt_relay.py & rtl_433 -F syslog:127.0.0.1:1433 ``` -------------------------------- ### PHP script for receiving syslog packets Source: https://github.com/merbanan/rtl_433/blob/master/examples/README.md This PHP script, rtl_433_custom.php, is an example of how to receive JSON syslog packets from rtl_433. ```php # rtl_433_custom.php: Receive json syslog packets in php ``` -------------------------------- ### Example: Set RTL-SDR Gain to Auto Source: https://github.com/merbanan/rtl_433/blob/master/docs/OPERATION.md Set the RTL-SDR gain to automatic (AGC enabled) by using '0' for the -g option. ```bash rtl_433 -g 0 ``` -------------------------------- ### Periodic Status Output Source: https://github.com/merbanan/rtl_433/blob/master/docs/STARTING.md Get periodic status updates instead of waiting for data reception. Specify the level and interval for the status output. ```bash -M level -M noise -M stats:2:30 ``` -------------------------------- ### Replay File Inputs Source: https://github.com/merbanan/rtl_433/blob/master/README.md Use the 'replay' meta option to replay file inputs at N-times realtime. Specify the replay factor N. ```bash -M replay:N ``` -------------------------------- ### Convert Sample File to OOK Format Source: https://github.com/merbanan/rtl_433/blob/master/docs/IQ_FORMATS.md This command converts I/Q sample data from a file into the OOK pulse data format. The first file is the output, and the second is the input. ```bash rtl_433 -w FILE.ook FILE.cu8 ``` -------------------------------- ### Configure MQTT Output Source: https://github.com/merbanan/rtl_433/blob/master/README.md Use the -F option to specify MQTT output. Ensure each instance has a distinct driver selection as the MQTT Client-ID is computed from it. TLS can be configured using 'mqtts://' with certificate paths. ```bash -F "mqtts://host,tls_cert=,tls_key=,tls_ca_cert=" ``` -------------------------------- ### PHP script for HTTP TCP client Source: https://github.com/merbanan/rtl_433/blob/master/examples/README.md A short PHP example, rtl_433_http_stream.php, demonstrating a TCP client for rtl_433's HTTP streaming API. ```php # rtl_433_http_stream.php: Short example of an TCP client written in PHP for rtl_433 ``` -------------------------------- ### Python script for MQTT client test Source: https://github.com/merbanan/rtl_433/blob/master/examples/README.md An example Python script, mqtt_rtl_433_test_client.py, that connects to an MQTT broker and prints data received from rtl_433 topics. ```python # mqtt_rtl_433_test_client.py: Connect to broker and print data from rtl topics ``` -------------------------------- ### Record and Replay Raw I/Q Samples Source: https://context7.com/merbanan/rtl_433/llms.txt Record raw I/Q samples for later analysis or replay captured signals. Use -S to save signals, -r to read from a sample file, and -w to write a continuous data stream. ```bash # Save all received signals to files (one per transmission) rtl_433 -S all -T 120 ``` ```bash # Save only unknown/unrecognized signals rtl_433 -S unknown ``` ```bash # Read and decode from a sample file rtl_433 -r g001_433.92M_250k.cu8 ``` ```bash # Read with format override rtl_433 -r cs16:/path/to/samples.raw ``` ```bash # Write continuous data stream to file rtl_433 -w output_433.92M_250k.cu8 ``` ```bash # Analyze pulses in a sample file rtl_433 -A -r sample.cu8 ``` ```bash # Convert and dump as OOK pulse data rtl_433 -w OOK:- -r sample.cu8 ``` -------------------------------- ### Start rtl_433 MQTT relay script Source: https://github.com/merbanan/rtl_433/blob/master/docs/INTEGRATION.md Execute the rtl_433 MQTT relay script in the background. This script typically consumes MQTT messages and forwards them elsewhere. ```bash rtl_433_mqtt_relay.py & ``` -------------------------------- ### Replay File Inputs with -M replay Source: https://github.com/merbanan/rtl_433/blob/master/docs/STARTING.md When reading from files, use '-M replay[:N]' to process data at N-times real-time speed. ```bash -M replay[:N] ``` -------------------------------- ### Make rtl2mqtt.sh script executable Source: https://github.com/merbanan/rtl_433/wiki/Useful-commands Grant execute permissions to the rtl2mqtt.sh script using chmod. This is necessary before you can run the script to start forwarding sensor data. ```bash chmod 755 rtl2mqtt.sh ``` -------------------------------- ### Project Initialization Source: https://github.com/merbanan/rtl_433/blob/master/CMakeLists.txt Initializes the project with the name 'rtl433' and specifies C as the primary language. This is a fundamental step in CMake configuration. ```cmake project(rtl433 C) ``` -------------------------------- ### Configure rtl_433 for Custom Device Source: https://github.com/merbanan/rtl_433/wiki/Custom-Protocol-with-HA Use this configuration in a .conf.template file to set up rtl_433 for a specific device. Replace placeholders with your actual network and device details. ```conf output kv output mqtt://192.168.1.100:1883,user=,pass= frequency 433875000 analyze_pulses true ``` -------------------------------- ### Add Device File to CMakeLists.txt Source: https://github.com/merbanan/rtl_433/wiki/Decipher-a-new-device-and-write-a-decoder Instruction on how to include the new device decoder file, 'digitech_xc0324.c', in the build system by adding it to the list of device files in 'src/CMakeLists.txt'. The list is maintained in alphabetical order. ```CMake ... devices/danfoss.c devices/digitech_xc0324.c devices/dish_remote_6_3.c ... ```