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:
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.
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.
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
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
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.
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.
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.
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. 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
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://192.168.1.80");
var port = new SerialPort(serialDevice, {
baudrate: serialBaud,
dataBits: 8,
stopBits: 1,
parity: 'none',
parser: SerialPort.parsers.readline('\r\n')
});
client.on('connect', function () {
client.subscribe('rflink/tx');
console.log("--- MQTT connected ---");
});
client.on("message", function (topic, message) {
SerialPort.write(message.toString() + "\r\n");
})
port.on("data", function(data) {
console.log(data.toString());
client.publish("rflink/rx", data.toString());
});
port.on("open", function() {
console.log("Serial port opened: " + serialDevice);
port.flush();
});
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:
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.
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.
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:
/RFLINK/Kaku/41/R/SWITCH 1
/RFLINK/Kaku/41/R/CMD ON
/RFLINK/Kaku/41/R/SWITCH 2
/RFLINK/Kaku/41/R/CMD ON
/RFLINK/Kaku/41/R/SWITCH 3
/RFLINK/Kaku/41/R/CMD ON
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 ?