I wrote a new MQTT driver for the RFXCOM rfxtrx433 (USB version). This driver lets you connect your RFXCOM to HA using MQTT. The RFXCOM RF modem does not need to be connected to your HA system directly, it can be located anywhere as long as it can reach the network and your MQTT broker. The driver runs on NodeJS and is based on the Node-RFXCOM library.
I wrote this driver because I was very unhappy with the HA built-in RFXCOM integration, which it completely replaces. This new driver does not use any form of awkward and unintuitive UI for configuration. All settings are in a YAML file. It’s as simple as it gets.
Right now the driver is still rather basic, but fully functional. It already supports a lot of temperature, humidity, rain, wind and integrated weather station sensors (including Oregon Scientific). Also lighting2 protocol switches, remotes and relays (DIO, CHACON, KlikAanKlikUit, HomeEasy, etc) and lighting5 protocol (OTIO, Conrad RSL), because those are the devices I have and can test. PRs for support of additional devices are definitely welcome !
Installation
The driver runs on NodeJS, do you need to make sure you have that one installed. Here is a quick install guide for Raspberry Pi and other Debian based systems. It can also be installed manually for ARMv6 systems like the Rpi0. NodeJS v16 minimum is required.
Next, run npm install
to automatically install the dependencies.
Take a look at the supplied configuration.yaml file and enter the serial port your RFXCOM is connected to, as well as your MQTT broker:
serial:
port: '/dev/ttyUSB0'
mqtt:
server: 'mqtt://192.168.4.100:1883'
username: 'user'
password: 'password'
The username and password are both optional.
Scanning for RF devices
Now run the driver in scanning mode:
node ./rfxcom.js --scan
This will show a list of devices the driver recognizes as they come in, with their device ID and protocol (and subtype for lighting / switch devices). You can use this information to fill your device section in the configuration.yaml for the next step.
You can also run a the driver in realtime stream mode. This will show all incoming data for all supported devices in realtime, with RSSI and command codes. This is more for debugging or if you’re interested in how frequently devices send data around you.
node ./rfxcom.js --stream
Adding devices to the configuration.yaml
Once you know your device IDs and protocols, you can simply fill them into the YAML. Use the provided sample config as an example:
temperaturehumidity1:
topic: temp # optional, topic name for devices using this protocol
devices:
'0xF501': 'bedroom'
lighting2:
topic: 'switch' # optional, topic name for devices using this protocol
subtype: 'AC' # The subtype of the protocol used for the transmitter (see the results of device scan)
devices:
0x01A8D1EA/1: 'bedroom'
Once you have your configuration setup, run the driver in normal operation mode:
node ./rfxcom.js
You can now view the MQTT topics come in using MQTT explorer, for example.
Adding as HA MQTT entities
For the example above, the MQTT entities in the HA configuration.yaml would look like this:
mqtt:
sensor:
- name: "Bedroom temperature"
state_topic: "rfxcom/temp/bedroom/temperature"
unit_of_measurement: "°C"
- name: 'Bedroom humidity'
state_topic: 'rfxcom/temp/bedroom/humidity'
unit_of_measurement: '%'
switch:
- name: 'Bedroom light'
state_topic: 'rfxcom/switch/bedroom/state'
command_topic: 'rfxcom/switch/bedroom/set'
payload_on: 'On'
payload_off: 'Off'
optimistic: true
Base topic names, the topic names for each protocol and of course the topic name for each entity / device can be freely configured. See the configuration.yaml example on the github repo.
Feedback welcome !