Binding for 868MHz Transceiver?

Hello
I am complete out of knowledge, how would be a binding to a Transceiver card been done?
For example if I want to use such RF Interface


How can it be used in openHAB?
Does it need a selfmade binding ?
thx

I think It would be difficult to create a ‘general purpose’ binding for RF transceivers as different RF devices communicate with different protocols.

What device are you trying to communicate with ? It might be better to see if the manufacturers have any libraries/scripts for the Raspberry Pi or if anyone else has produced one. If they have you could execute the script within a rule instead using a binding.

Hi Daniel
OK, I want to connect a Pi with an other hardware via 868Mhz. The other HW (Slave) is getting and transmitting data to switch all kinds of need in the garden (Pool, Water, Temp, Humidy…).
The Pi is the master and should regulate and vialize via openHAB.
If the transmitter can onyl be accessed by Python on the Pi, would it be possible to get the infos into openHAB. (sorry for stupid questions, I am a startup)
thx

Yes. There are two relatively simple approaches. If your python scripts poll the slave for data then you can use the Exec binding to call your Python scripts and parse the output from that script to populate the openHAB Items.

The other approach is to install an MQTT broker (Mosquitto is popular) and the Paho Python library to communicate with MQTT and publish/subscribe data MQTT topics that openHAB subscribes/publishes to. This latter approach is what I use and you can see my example python code here.

I’m actively updating this script to support LWT and make the sensors more generic so I can use the same script for multiple data types so check back in a week or so if you need those features. At the least you can use it as an example for how to do the MQTT.

I’ve published a full example of the openHAB config here.

Hi Rich
Thanks a lot !
I will have a look at your code of course, hopefully I can understand it.
What would be your decission to my project?
Project: full automated Garden
Pi(Master) with openHab communicates to Slave-HW(Arduino?) via RF 433/868 Mhz Transceiver.
openHab automates my full garden by getting infos from Temp., Humidy,… and switches on Pool Waterpump, Watervalves, lights…
Looking for the hardware/software for the RF communication.
thx

Ask questions if you don’t. The vast majority of the code is dealing with signals (e.g. <ctrl>-c) so the script will behave nicely as a service (i.e. doesn’t hang when I run sudo system mqttReporter stop). The MQTT code is really only about a dozen lines of code in that 300+ line script (I’m breaking it up in my in progress updates for readability).

I personally would probably go the Python script with MQTT route, but I’m biased. I’ve already built my system up this way so it would be less work for me, though this does appear to be a common design pattern used in these forums. Also, because my openHAB server is a standard computer and all of the slave devices (thus far, and soon I’ll have a gateway and RFM69 network) are remote so having a standard messaging bus makes sense. If openHAB is on the same machine as the wireless transceiver other options become available.

For clarity, my current system consists of:

  • An old laptop running openHAB and Mosquitto (among other services) and a copy of the above linked script with the Sensor class replaced with one that scans for the presence of Bluetooth devices and reports their presence via MQTT
  • A Raspberry Pi in the garage with the above linked script to reports whether the garage doors are open of closed via MQTT, and activate relays to open the garage doors via a REST API controlled by a REST interface implemented by WebIOPi. This one also has the Bluetooth version of the presence checking script described above.
  • A Raspberry Pi in the basement wired to a bunch of reed switches on the exterior doors with the script linked to above reporting the open/closed status via MQTT. It also has the Bluetooth version of the script.

I plan on expanding my system by wiring an RFM69 transceiver to the garage Raspberry Pi (Gateway) and deploying a bunch of Arduinos with sensors throughout the house with their own RFM69 transceivers. I’ll have a script on the Gateway to publish the sensor readings from the RFM69 to openHAB via MQTT. I have the parts, just not the time right now.

Hi Rich
Great, what do you think of the RFM12B.
Heard of that 433Mhz would be better, more powerful.
You are doing the connection I would like to have!
Maybe we could do it together, of course I have to learn a lot, but I realy would like to.
I am actually learning Python, Pi and openHAB.
thx

Honestly, I found this Instructable which used the RFM69 which uses the RFM69. I did a little looking and discovered there is a Raspberry Pi library to support it through the GPIOs so decided to just order the parts and jump in. I did no trade or research into other transceivers.

I would be up for that but right now my time is very limited. I’ve had the parts to build the sensors in a drawer for over a month. With a toddler at home he gets priority for my time so a rarely have a free evening or weekend to work on it. Add to that that HA is one of many hobbies, and not even my favorite hobby, and things take a long time to get done.

I already had a good foundation in Linux so learning the Pi wasn’t much for me but I to am learning Python and continuing to learn openHAB. That is one reason I contribute on this forum so frequently. By helping others solve problems I learn more and more.

That looks pretty cool and is nearly what I want to to!
A view changes, other sensors and fine!!!
He is using a Arduino board to start the RF communication, not possible to do it right from Pi?
Would be a thing to think about.
Next step would be a step back to yC, but this will be an other thing :wink:
First I will try to get that project to run.
Would like to have a nice com with you !
thx

When he wrote the instructable there wasn’t a library for the Raspberry Pi to support RFM69. One has been written/is in the process of being written so the need for an Arduino Gateway (he actually has two gateways because he didn’t know you could have the wireless and IP shield on the same board) goes away. That is my hope anyway and it will be my first attempt.

Funnily enough that instructable got my into HA and my first proper Arduino project was a wireless RF (RFM69HW) thermometer. In the end I discovered ESP8266s and made it WIFI instead which opened my eyes to MQTT and the like.

Hi Daniel
Wifi is not the right thing for my project, it needs RF for a stronger an longer signal through walls.
But could you help us a bit with your knowledge ?!
thx

Daniel what is your experience with the power consumtion and range of the wlan.
I think in the garden this would not work.

Using MQTT, would it work with multi-slaves ? I mean that one Master (Pi with openHAB in the house) can talk to all Slaves (in the garden), the Slaves can talk direkt to the Master or if the Slave does not reach the Master because of the distance they communicate over the next Slave.
Master
----- Slave ----- Slave
----- Slave
----- Slave ----- Slave ---- Slave

Or isnt it a thing of MQTT and more of the used hardware?

I went through the doc of the DYI home automation and found a forum, there I found this
https://github.com/computourist/RFM69-MQTT-client/blob/master/Gateway_2.1/MQTT_gateway_schema.jpg

I am right, that MQTT runs like WLan/Lan and the RFM69 is only a transmitting device ?
I also read about 130mA only for the RFM69 ? that would be too much for a solar use, but on a sending unit and sleep mode I could work.
http://www.hoperf.com/rf/fsk_module/RFM69HW.htm

also found that:
http://lowpowerlab.com/moteino/
looks like a finished Slave-board ! just connect Sensors/Actors (change the voltage level) … finished
or am I wrong??

@Richard_Nussdorfer I try to help and share my experiences where I can but that doesn’t necessarily mean I have a solution for you :slight_smile:

In regards to range, I guess it depends where your router or nearest repeater is to your garden and how long your garden is. My garden is quite small, probably only 10-15 metres long so I wouldn’t have a problem with range. However I’d agree that if the device is only sending/receiving data occasionally (and sleeping for the rest of the time) then RF is probably more suitable as your batteries will last longer.

There are two separate things here. Communication protocols and transport mechanisms.

MQTT is a communication protocol, your 868MHz transceivers are transport mechanisms. This means your transceivers have no idea what communication protocol is being used, it’s just bits of data to the transceivers. As an example, two devices could transmit their data using 868MHz transceivers but unless they’re using the same communication protocol they won’t be able to understand each other.

In those links and I guess Rich’s project, the slave RF nodes communicate with the master RF node using some known communication protocol, obviously transmitting over RF. There needs some device in the middle that can physically receive and understand the data sent over RF and is network enabled in order to send it over to openHAB.

@Richard_Nussdorfer, you can also try out my library https://github.com/eschava/rf-protocols-java . It already supports several RF protocols for 433 MHz. I didn’t test it on Raspberry PI but it should work
It uses MQTT for communication with OpenHAB

Thank you !!
I think in a view week I can get to this part.