RFLink binding

As others I created my own gateway for RFLink - to communicate with MQTT. However I took another approach - every part of message is translated into separate topics, so it allows easier rule contruction, without Json parsing etc.

you can find it here:

1 Like

Hello @re-vo-lution,
propably you don’t build org.openhab.io.transport.serial package. Build them as others first(over pom.xml -> RunAs -> Maven install).

P.S.The package org.openhab.io.transport.serial is located in Runtime folder

Could somebody help me how to install Iture/RFLinkGateway binding. I see only python scripts, cannot find where they need to be placed in OH2

After upgrade to 2.1.0-SNAPSHOT Build #839 I’ve got Serial binding working again and I want to share my quite simple setup.

Currently I’m interested only in temperature readings from my outdoor LaCrosse sensor. Other devices like neighbor’s doorbells could be added easily :wink:

String RFLinkRaw	"RFLink raw data [%s]" <text> { serial="/dev/ttyUSB0@57600" }
Number TemperatureOut "Outside temperature (RFLink) [%.1f °C]" <temperature>


// Lambda to convert temperature readings
val Functions$Function1<Number, BigDecimal> convertTemp = [ tempData |
	if (tempData < 32768) { tempData/10 }
	else { (32768 - tempData)/10 }

rule "RFLink"
    Item RFLinkRaw received update
	logInfo("RFLink", "raw data received: " + RFLinkRaw.state)
	val RFbuffer = RFLinkRaw.state.toString.split(";")
//	val RFprefix = RFbuffer.get(0)
//	val RFstamp = RFbuffer.get(1)
	val RFvendor = RFbuffer.get(2)
	val RFidLong = RFbuffer.get(3)
	val RFdata = RFbuffer.get(4)
	val RFidHex = transform("REGEX", "ID=([0-9a-fA-F]*)", RFidLong)

	switch (RFvendor + " " + RFidHex) {
  		case "LaCrosse 0400" : {
			var String tempHex = transform("REGEX", "TEMP=([0-9a-f]{4})", RFdata)
			var int tempDec = Integer::parseInt(tempHex, 16)
			TemperatureOut.postUpdate(convertTemp.apply(tempDec)) }
		case "SomeDevice 0000" : {
			logInfo("RFLink", "some data received from " + RFvendor) }
  		default : logInfo("RFLink", "completely irrelevant data received from " + RFvendor)

This is not a Openhab binding, you can use it completely separately from Openhab. Basically it is a gateway, between RFLink and MQTT broker. After you set it up, you can use Openhab with MQTT binding.
How to run? put all files into one directory, edit config.json file and run RFLinkGateway.py.
after that you can publish to specific topic command for particular device, or you can subscribe to see messages.

Ok, got it. Thank you.

Can you please explain it in detail.
I have never worked before with MQTT und a pathons script.
I have the MQTT server running and can send and receive per shell data. But i dont know wich folder is the best choice for your files and how i can run the RFLinkGateway.py and how i can setup to start automatically this script at booting my rasperry pi.

BR Rene

Is there anybody that can help me with MQTT and the python script?

I’ve fixed a few problems with lture RFLinkGateway and initiated a fork based on his work.
I didn’t propose any pull request right now.
If some of you want to test my updated version, feel free, it’s on github: https://github.com/dmartinpro/RFLinkGateway

Among the differences:

  • Added a real “ignored devices” property in order to mute some devices
  • Fixed a configuration issue related to the previous property

I’m currently using it in a Docker container, running side by side with my other components (OH2, Mosquitto, Nodered, Grafana, InfluxDB, …) each running also in containers.

1 Like

hello, tested your python script a real pleasure to see my doorbell into mqtt logs.
thanks you.

nb: to start this script in boot, (what’s ? RPI is not a one boot-only device ?) add his path in "


",I think it can help newbies such like me.(exemple "

sudo python /etc/openhab2/oh2-scripts/RFLinkGateway.py &


I’ve been using this post to help me communicate between RFLink for OpenHAB using Serial and MQTT. I’ve done so using NodeJS which happened to be pretty straight forward. I initially wrote something in C using sockets but found this solution much easier to write and debug. Anyway, this code is based on bbubble62’s python code. :smiley: So big thanks to him!

On the Pi first install node, then install the mqtt and serialport modules. I have installed node v6.11.0 which gave me npm v3.10.10. Once Node was installed I ran

npm install mqtt
npm install serialport

Try this for installing node on PI.

Here is my code for NodeJS SerialPort to MQTT bridge (error handling removed to keep it simple). Save the text as bridge.js and run using: sudo node bridge.js

'use strict'

var SerialPort = require('serialport');
var mqtt = require('mqtt');

var serialDevice = "/dev/ttyUSB0";
var serialBaud = 57600;

var client = mqtt.connect("mqtt://");

var port = new SerialPort(serialDevice, {
        baudrate: serialBaud,
        dataBits: 8,
        stopBits: 1,
        parity: 'none',
        parser: SerialPort.parsers.readline('\r\n')

client.on('connect', function () {

        console.log("--- MQTT connected ---");

client.on("message", function (topic, message) {
        SerialPort.write(message.toString() + "\r\n");

port.on("data", function(data) {
        client.publish("rflink/rx", data.toString());

port.on("open", function() {
        console.log("Serial port opened: " + serialDevice);

got this script working. Thanks!
Recognized two things:

  1. Temperature is missing the number after decimal sign. Example message: 20;9E;LaCrosse;ID=0c07;TEMP=00e1; Temp is parsed as 22 instead of 22.5
  2. Minus temperatures are not handled at all.

Any chance to get this supported? Maybe you can activate the issues module for your GIT repo? I am to lousy in python to fix my self.

@biobier No need to use script, python, etc.
You can use serial binding as described earlier.

1 Like

The advantage to get RFlink to MQTT is that several systems could get/send the messages (like Nodered) That is more complicated with Openhab maybe…
Found now best solution for me is the NODE RED addon:

You can try the latest version. I’ve fixed it.

Looks like this thread started out as an RfLink binding thread.

As an FYI to those still interested, I’ve added initial support for outbound messages, switches/contacts (Tested with X10 equipment) Oregon Temp sensor and RTS/Somfy blinds.

As my Java skills leave a lot to be desired, its not a pretty implementation, but its working for me. A test / dev version of the jar file can be downloaded from dropbox,
https://www.dropbox.com/s/n1tfm9asi9btpgg/org.openhab.binding.rflink_2.0.0.jar?dl=0 or compile from git, https://github.com/cyrilcc/org.openhab.binding.rflink



Great! I will have a look at the new code after I am done moving to my new house. I am planning to do some development on this binding once I am fully settled. Would be nice to support several of the many protocols RFLink supports.

1 Like

Hi Martin! I tried your gatway… very nice !

I have a problem though…
I have some cheap wall socket switches I try to control…the switching on/off works without any problems with openhab…

But I also use the original remote…and I want the state of the object to be updated in openhab when using the original remote…

So the mqtt-output is this when I use the remote:


The problem here is that the lines with the CMD-part is identical for all the switches…so I dont have any uniqe string to connect to the item in openhab…
Can I solve this somehow ?

Why don’t you only use the SWITCH message in order to control what you want instead of CMD since they are all the same?
If you do also have CMD OFF, you can use Nodered to consume everything under /RFLINK/Kaku/41/R/ and merge messages arriving in a short period. That way, you end with a message containing both SWITCH information and CMD information.

Thanks for your advice… I have no experience with node red…but I’ll look into it !