Skip to main content

A Python package for processing RFXtrx data with MQTT support and automation integration.

Project description

RFXtrx-mqtt - Process & Automate RFXtrx Data with MQTT

PyPI License Python

rfxtrx-mqtt is a Python package that processes and decodes RFXtrx data from a serial device, converting it into JSON. It supports MQTT for seamless integration with home automation platforms like OpenHAB and Home Assistant.

🔧 Features

Decodes RFXtrx data into JSON format
Supports multiple device types (Lighting, Temperature, Humidity, Security, Blinds, etc.)
Command-line interface (rfxtrx CLI)
Flexible callback functions for real-time data processing
Configurable serial device parameters
Built-in MQTT support for automation platforms


📦 Installation

Install via PyPI

pip install -r requirements.txt

Install from GitHub (Development Version)

git clone https://github.com/FredrikBlix/rfxtrx-mqtt.git
cd rfxtrx-mqtt
pip install -r requirements.txt

🚀 Usage

🔹 Running the rfx-dump Command

rfx-dump --help

Example: Read from /dev/ttyUSB0 (default settings)

rfx-dump

Example: Specify device and baud rate

rfx-dump --device /dev/ttyUSB1 --baudrate 115200

Example: Publish RFXtrx data to MQTT

rfx-mqtt --device /dev/ttyUSB0 --mqtt-host localhost --mqtt-port 1883 --mqtt-topic rfxtrx

Example: Subscribe to MQTT topic

rfx-mqtt-sub --mqtt-host localhost --mqtt-topic rfxtrx/#

Example: Manually publish MQTT message

rfx-mqtt-pub --mqtt-host localhost --mqtt-topic rfxtrx --data '{"device_id": "1a41", "unit_code": 1, "command": "On"}'

🏠 Home Automation Integration

Home Assistant

To integrate rfx-mqtt with Home Assistant, configure an MQTT sensor in configuration.yaml:

mqtt:
    sensor:
        - name: "RFXtrx Lighting Sensor"
          state_topic: "rfxtrx/Lighting1"
          value_template: "{{ value_json.command }}"

Restart Home Assistant after adding this configuration.

OpenHAB

To integrate rfx-mqtt with OpenHAB, use the MQTT binding and add the following to mqtt.things:

Thing mqtt:topic:rfxtrx "RFXtrx" {
    Channels:
        Type string : lighting1 "Lighting1 Command" [ stateTopic="rfxtrx/Lighting1" ]
}

Then, define an Item in mqtt.items:

String RFXtrx_Lighting "RFXtrx Light" {channel="mqtt:topic:rfxtrx:lighting1"}

Restart OpenHAB after making these changes.


📜 License

This project is licensed under the MIT License. See the LICENSE file for details.


🤝 Contributing

We welcome contributions! To get started:

  1. Fork the repository on GitHub
  2. Clone your forked repo
    git clone https://github.com/YOUR_USERNAME/rfx-mqtt.git
    cd rfx-mqtt
    
  3. Create a feature branch
    git checkout -b feature-name
    
  4. Make your changes, commit, and push
    git add .
    git commit -m "Added new feature"
    git push origin feature-name
    
  5. Submit a pull request! 🎉

🚀 Thank you for using rfx-mqtt! If you find this project useful, give it a ⭐ on GitHub!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rfxtrx_mqtt-0.0.post1.dev1.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rfxtrx_mqtt-0.0.post1.dev1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file rfxtrx_mqtt-0.0.post1.dev1.tar.gz.

File metadata

  • Download URL: rfxtrx_mqtt-0.0.post1.dev1.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for rfxtrx_mqtt-0.0.post1.dev1.tar.gz
Algorithm Hash digest
SHA256 367e7cae34b568fe06a6b667e1d1e791b06fd5ced412948d3ef5eda9897d4a03
MD5 654070cee5e4640809baf6bfd70e13f5
BLAKE2b-256 5f91436bc332a02c2b9d72f6a16647cd5434bad5704d71dbec5d29b19693f876

See more details on using hashes here.

Provenance

The following attestation bundles were made for rfxtrx_mqtt-0.0.post1.dev1.tar.gz:

Publisher: publish-to-pypi.yml on FredrikBlix/rfxtrx-mqtt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rfxtrx_mqtt-0.0.post1.dev1-py3-none-any.whl.

File metadata

File hashes

Hashes for rfxtrx_mqtt-0.0.post1.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 7e88bb4a750c2b95d4ac5090de94d7a1f28db2532f779230225847c14aae7f36
MD5 63853b47fd871d2da4eebe9cb2a0d3d2
BLAKE2b-256 ae7b2c5a9d7561ac83a744ba8619d1938910bbe460f816d5e2702c05be8de408

See more details on using hashes here.

Provenance

The following attestation bundles were made for rfxtrx_mqtt-0.0.post1.dev1-py3-none-any.whl:

Publisher: publish-to-pypi.yml on FredrikBlix/rfxtrx-mqtt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page