RFLink binding

rfxcom
433
binding
Tags: #<Tag:0x00007f015683b3d8> #<Tag:0x00007f015683b248> #<Tag:0x00007f015683b0b8>

(bbubble62) #8

Hopefully it will !


(Frank Zirrone) #9

Very nice!
How can we help with getting the binding fully functional?
Anything you need?

Stuntteam (RFLink developers)


(Curlyel) #10

@Stuntteam: Excellent! I’m very happy that you became aware of this thread.
I just considered to give you a notice about it. But I just wanted to try out the new RFLink binding myself before asking you for the right help you can provide. Unfortunately, I didn’t had the time to do it yet…

Although, I had a quick look at @cyrilcc’s repo. I guess, some help of implementing the other protocols/devices which are not yet covered could help much.

I’m looking forward to see the RFLink binding becoming another awesome extension of openHAB!


(Cyril Cauchois) #11

Thank you for your interest :slight_smile:
My implementation is used in a PoC/Demo which doesn’t need more development at the moment, so I’m not sure to get more time to work on it anymore.
Anyway, you can fork the repo or contribute. :wink:
I think that it needs first a code review from openHAB experts, and the development of discovery service.
Adding devices is quite easy, but I think that it requires to have real devices to perform some tests in real conditions.


(David) #12

I’m quite surprised not to see a more complete binding for this project. The number of supported items is huge to say the least and the overall cost of the controller hardware is low, especially if home made. And when looking at other Smarthome open source projects, let’s mention Jeedom for instance from where I’m coming, the support is pretty good yet.

Is there an official will to support it later or is an effort as a side project is welcome?


(bbubble62) #13

Hi,

I decided not to wait for the binding and coded everything in python and openhab (RPI3 and OH2 as platform):

  • Made a python script that reads/writes data from RFLINK (USB) to/from MQTT (also on RPI3) ;
    This merely a s/w gateway that reads data from rflink and sends it (unmodified) to MQTT and vice versa ;
  • In openhab2 I defined two items : rflinkTX and rflinkRX
String rfLinkRx "rfRx: [%s]" {mqtt="<[mybroker:rflink/rx:state:default]"}
String rfLinkTx "[%s]" {mqtt=">[mybroker:rflink/tx:command:*:default]"}
  • In a rule I parse the incoming string and take action :
rule "rfLinkRX"
    when
        Item rfLinkRx received update
    then
        //parse data here...
        //pushover("rfLink: " + rfLink.state) //test 
    end
  • For sending commands also a rule is created (per item):
rule "Lamp1Button"     // lamp on/off button
    when
        Item lamp1Button changed
    then
        rfLinkTx.sendCommand("10;Kaku;00004b;2;" + lamp1Button.state)
    end 

I know this is not as convienent as having a binding but it is a ‘good’ workaround to get the gateway going.

-ben


(Thomas Oeding) #14

Made a python script that reads/writes data from RFLINK (USB) to/from MQTT (also on RPI3) ;
This merely a s/w gateway that reads data from rflink and sends it (unmodified) to MQTT and vice versa ;

Could you post this script?


(bbubble62) #15

Sure:

#!/usr/bin/env python

import serial
import paho.mqtt.client as mqtt

serialdev = '/dev/ttyUSB0'
broker = 'localhost'

ser = serial.Serial(
        port=serialdev,
        baudrate = 57600,
        parity=serial.PARITY_NONE,
        stopbits=serial.STOPBITS_ONE,
        bytesize=serial.EIGHTBITS,
        timeout=None
)

ser.flushInput()
ser.flushOutput()

def on_connect(client, userdata, flags, rc):
        client.subscribe("rflink/tx",0)

def on_message(client, userdata, message):
        ser.write( str(message.payload.decode("utf-8"))+"\r\n")

client = mqtt.Client()
client.connect(broker, 1883)
client.on_connect = on_connect
client.on_message = on_message
client.loop_start()

while True:
        x=ser.readline()
        x = x.strip("\r\n")
        client.publish("rflink/rx", x, 0)

Probably there is room for improvement but for me it does the job!
To load this at boot time, I used the script as shown at http://tinyurl.com/j482qn9

Cu, Ben


(Enc-X) #16

Here is my Homie based rflink to mqtt bridge: https://github.com/enc-X/mqtt-rflink-bridge
It is one day old, I’ve just starded testing. Communication works well - I can recevie in OH messages and send to RF. Only some advanced features (like debug, device creation) have problem because of MQTT message size limit.


(Rene Vogel) #17

Hello,

Is it possible to use an nanoCUL with the CC1101 for RFLink?


(Enc-X) #18

I don’t think so, CC1101 have SPI interface, RFLink use simple data in / out line.


(Rene Vogel) #19

Hello,

Is it possible te receive the raw data fron an rflink device in Openhab?
I tried to receive the data from an rflink-arduiono on USB0 with the follow item:

String MySerialDevice “MySerialDevice [%s]” { serial="/dev/ttyUSB0@57600" }

In this rule i put it in the logging:

rule rflinktest

when
    Item CurrTime changed
then
     var rflinktest = MySerialDevice.state// as StringListType	
	logInfo("rflinkcom0","MySerialDevice " + rflinktest)

end

I get data, but not the same like in the “minicom”.

Data in openhab-logging:

2016-12-23 10:36:56.075 [DEBUG] [binding.serial.internal.SerialDevice] - Received message ‘��h`�’ on serial port /dev/ttyUSB0

data in minicom:
20;03;Baldr;ID=6a03;TEMP=00a6;HUM=39;BAT=OK;


(Rene Vogel) #20

I have a problem with the RFLink-Binding in Exclypse IDE in creating the binding-jar-file.
I do it like in the description(In Eclipse IDE, right click on the pom.xml file, then “Run As”, and “Maven Install”) and egt the follow error:

[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: org.openhab.binding.rflink 2.0.0.qualifier
[ERROR] Missing requirement: org.openhab.binding.rflink 2.0.0.qualifier requires ‘package gnu.io 0.0.0’ but it could not be found
[ERROR]
[ERROR] See http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help.
[ERROR] Cannot resolve dependencies of MavenProject: org.openhab.binding:org.openhab.binding.rflink:2.0.0-SNAPSHOT @ C:\Users\vogel.C05500NBVOGEL2\git\org.openhab.binding.rflink\pom.xml: See log for details -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException

How can i solve this error? I tried this with the binding i downloaded form github without any changes.

BR Rene


(Martin) #21

Hi
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:


(vita) #22

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


(Nikita K) #23

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


(Andrew) #24

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:
Items:

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

Rules:

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

rule "RFLink"
when
    Item RFLinkRaw received update
then
	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)
		}
end

Split Item value in rule
(Martin) #25

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.


(Nikita K) #26

Ok, got it. Thank you.


(Rene Vogel) #27

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