New binding for RFXCOM transceiver (RFXtrx433)

2,108 views
Skip to first unread message

daka

unread,
Sep 30, 2012, 9:37:30 AM9/30/12
to ope...@googlegroups.com
Found out about openHAB a few weeks ago. I like it very much. Especially the nice interfaces it has (iOS, browser). I have a SheevaPlug, openHAB runs very well on this.
Just updated the iOS app from the apple store.

I'm planning to build a new binding for the RFXtrx433 from RFXCOM (http://www.rfxcom.com/transceivers.htm#12103).
This is a rf transceiver for many rf 433 Mhz products. It is connected using a serial port (USB), so I'll try the serial binding first.
Trying to implement the following binding first:
Switch Light_GF_Kitchen_Table         "Table"         (GF_Kitchen, Lights)     {rfx="ON:0B1100030040D2B202010F70,OFF:0B1100040040D2B202000070"}

I also have some configuration that I like to put in the openhab.cfg. How can I get the values from the config file into the binding? I see some other bindings that implements ManagedService. Then the updated(Dictionary config) method can set the properties. But this is not available in the serial binding.

Regards,
David

khome

unread,
Sep 30, 2012, 11:00:12 AM9/30/12
to ope...@googlegroups.com
Right, you need to add "implements ManagedService" to you *Binding class declaration. This will make you implement "updated" method whitch will allow you reading from .config file. See oeg.osgi.service.cm.ManagedService for more details. Also don't forget to put

      <provide interface="org.osgi.service.cm.ManagedService"/>

to your osgi xml definition file. You can use VDR binding as an example

Thanks
Dmitry

воскресенье, 30 сентября 2012 г., 17:37:30 UTC+4 пользователь daka написал:

Pali

unread,
Dec 14, 2012, 3:31:46 PM12/14/12
to ope...@googlegroups.com
Hi David,

have you started the RFXtrx433 binding? Or is there anyone else who have started or even completed the binding already?

I just buy RFXtrx433 transceiver, so I will start the binding development if there are no activities on going.

-Pali

daka

unread,
Dec 15, 2012, 10:42:02 AM12/15/12
to ope...@googlegroups.com

Hi Pali,

Good to know there are more people interested in the rfxcom in combination with openHAB.
Yes, I started with some work for the rfxcom binding. But, it was more experimenting with both openHAB and rfxcom. I took the serial binding as a start. The binding works ok, but you need rules to actually switch items. I also want openHAB to react on signals from the (KAKU) remote control. Then openHAB knows the item status has been changed.

The biggest problem I’m facing is the fact that rfxcom has a lot of options/configuration. I hardcoded some stuff for KAKU & X10 switches, but it would be better to store settings in a properties file. There are probably too many setting for openhab.cfg

I will upload what I have now. You can use the binding by adding an item like this
String SRFX              "SRFX"            (Multimedia)    { simplerfx="COM4" }
to your items file.

I also did some work on a binding that implements ManagedService, but got stuck in loading this binding.

Cheers,
David


daka

unread,
Dec 15, 2012, 10:44:15 AM12/15/12
to ope...@googlegroups.com
Here is a zip file with the code for the simplerfx binding.


org.openhab.binding.simplerfx.zip

Kai Kreuzer

unread,
Dec 15, 2012, 11:55:53 AM12/15/12
to ope...@googlegroups.com
Hi,

Thanks for your work on this binding, rfx is definitely interesting for many people.
Could you create a repository clone (see http://code.google.com/p/openhab/source/createClone) and push your code to it?
This makes it easier to discuss, update and contribute code as it is then directly available online in a Mercurial repo.

Cheers,
Kai


Am Dec 15, 2012 um 4:44 PM schrieb daka <david...@gmail.com>:

Here is a zip file with the code for the simplerfx binding.



--
You received this message because you are subscribed to the Google Groups "openhab" group.
To view this discussion on the web visit https://groups.google.com/d/msg/openhab/-/KMtEToibciUJ.
To post to this group, send email to ope...@googlegroups.com.
To unsubscribe from this group, send email to openhab+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/openhab?hl=en.
<org.openhab.binding.simplerfx.zip>

Pali

unread,
Dec 18, 2012, 2:38:22 PM12/18/12
to ope...@googlegroups.com, k...@openhab.org

Hi


and thanks for the information David. 


Meanwhile I started RFXCOM binding development. I tried to make frame work as modular as possible. 


Current "proto" type situation:

 - only receiving is supported

 - only Lighting2 (0x11) and Temperature/Humidity (0x52) messages are supported.

 - no RFXCOM controller configuration support


Binding configuration examples:


Switch rfxcomBtn1 { rfxcom="<636602.1:Command" }

Number rfxcomBtn1SignalLevel { rfxcom="<636602.1:SignalLevel" }

Dimmer rfxcomBtn1DimLevel { rfxcom="<636602.1:DimLevel" }


Number TemperaturTest { rfxcom="<2561:Temperature" }

Number HumidityTest { rfxcom="<2561:Humidity" }

String HumidityStatusTest { rfxcom="<2561:HumidityStatus" }


Debug data:


2012-12-18 21:32:30.372:  0B1100000009B6BA01000070

21:32:30.373 DEBUG o.o.b.r.i.RFXComConnection[:113] - packetReceived:

Packet type = LIGHTING2

 - Seq number = 0

 - Sub type = AC

 - Id = 636602

 - Unit code = 1

 - Command = ON

 - Dim level = LEVEL0

 - Signal level = 7

2012-12-18 21:32:30.373:  0B1100000009B6BA01000070

21:32:30.374 INFO  runtime.busevents[:46] - rfxcomBtn1 state updated to ON

21:32:30.376 INFO  runtime.busevents[:46] - rfxcomBtn1SignalLevel state updated to 7

21:32:30.377 INFO  runtime.busevents[:46] - rfxcomBtn1DimLevel state updated to 0


21:32:31.172 DEBUG o.o.b.r.i.RFXComConnection[:113] - packetReceived:

Packet type = LIGHTING2

 - Seq number = 0

 - Sub type = AC

 - Id = 636602

 - Unit code = 1

 - Command = OFF

 - Dim level = LEVEL100

 - Signal level = 7

21:32:31.173 INFO  runtime.busevents[:46] - rfxcomBtn1 state updated to OFF

21:32:31.175 INFO  runtime.busevents[:46] - rfxcomBtn1SignalLevel state updated to 7

21:32:31.176 INFO  runtime.busevents[:46] - rfxcomBtn1DimLevel state updated to 100


2012-12-18 21:27:03.257:  0A5201000A0100FB200269

21:27:03.257 DEBUG o.o.b.r.i.RFXComConnection[:113] - packetReceived:

Packet type = TEMPERATURE_HUMIDITY

 - Seq number = 0

 - Sub type = THGN800_THGR810

 - Id = 2561

 - Temperature = 25.1

 - Humidity = 32

 - Humidity status = NORMAL

 - Signal level = 6

 - Battery level = 9

21:27:03.259 INFO  runtime.busevents[:46] - HumidityTest state updated to 32

21:27:03.261 INFO  runtime.busevents[:46] - TemperatureTest state updated to 25.1

21:27:03.262 INFO  runtime.busevents[:46] - HumidityStatusTest state updated to NORMAL


Curently only serial device is supported, but TCP (RFXLAN) device support should be easy to add. Also new message support should be easy, just new class for every message type which handles message encoding/decoding and then converter for Openhab data types. 


Prototype is on my clone repo: http://code.google.com/r/paulianttila-ihc-binding/source/browse


I only have Oregon temperature/humidity sensors and some Lightning2 power sockets/remote, so I'm not able to test any other devices. 


-Pali 

Evert van Es

unread,
Apr 3, 2013, 2:33:46 AM4/3/13
to ope...@googlegroups.com, k...@openhab.org
Pali,

I have made some additions to your rfxcom code for lighting1 devices.

Can I commit to your code? Is that possible?
This Mercurial is all new to me...

Thanks 

Evert

Thomas Eichstädt-Engelen

unread,
Apr 3, 2013, 2:36:59 AM4/3/13
to ope...@googlegroups.com
Hi Evert,

best practice is to check in your code to your own clone. All others can then pull your changes into their clone.

Regards,

Thomas E.-E.


--
You received this message because you are subscribed to the Google Groups "openhab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhab+u...@googlegroups.com.

To post to this group, send email to ope...@googlegroups.com.

Evert van Es

unread,
Apr 3, 2013, 8:51:33 AM4/3/13
to ope...@googlegroups.com
Thomas, thanks. But that seems rather silly, this distributed development is new to me. So I will follow your advice nonetheless..

I have added X10 lighting support and my Harrison curtains can now be controlled through openhab. Excellent!

Something puzzles me though and I need some advice from experienced openhab developers.

I have a RF remote (kaku) with on/off buttons. I also have an RF actuator (kaku) for dimming or switching a light on and off.
Using the rfxcom binding I can now define a switch to receive the RF remote signal. This shows as a light in openhab. It works fine, pressing the remote now displays in openhab.

I can also program the RF actuator to react on a RF signal with a certain identification. I can then define another Switch in Openhab to send the correct RF signal. This also works fine, I can toggle the light on and off when I press the new switch.

My question is: What is the best way to link the remote to the light?  If I directly program the light to react to the remote, the openhab userinterface will show the remote to the correct on / off switch but not the lamp itself. And if I press the remote button on openhab, no signal is sent (based on the current rfxcom binding code).

Should I make a binding rule to allow for receiving and sending using 1 item in openhab?
Or should I use rules to react to remote and light changes?

thanks Evert 

Kai Kreuzer

unread,
Apr 3, 2013, 3:50:04 PM4/3/13
to ope...@googlegroups.com
Hi Evert,

Thomas, thanks. But that seems rather silly, this distributed development is new to me. So I will follow your advice nonetheless..

That's a very common DVCS concept that you have to get used to, see https://help.github.com/articles/using-pull-requests.
I personally think that it is really useful.

I have added X10 lighting support and my Harrison curtains can now be controlled through openhab. Excellent!

Great! If you like, you could create a YouTube video how you operate your curtains and I'll add it to the openHAB playlist - I could imagine that's a nice showcase :-)

I have a RF remote (kaku) with on/off buttons. I also have an RF actuator (kaku) for dimming or switching a light on and off.
My question is: What is the best way to link the remote to the light?  If I directly program the light to react to the remote, the openhab userinterface will show the remote to the correct on / off switch but not the lamp itself. And if I press the remote button on openhab, no signal is sent (based on the current rfxcom binding code).
Should I make a binding rule to allow for receiving and sending using 1 item in openhab?
Or should I use rules to react to remote and light changes?

Imho the cleanest way to do this is to enhance the rfxcom binding configuration possibilities. You should only have to define a single item - after all, it is the lamp that you want to visualize and not the remote control. So it should be possible to bind both devices to this one item. If you have programmed the devices to directly react to each other, you would only want to have the remote control for status updates in openHAB (as the protocol is not bi-directional and you do not receive a status update from the lamp when it changes). In KNX, we have a syntax like "1/2/3+4/5/6", where 4/5/6 is a so-called "listening" address, i.e. whatever comes in on this is only used to update the status (but never to send out any commands). This would correspond to your remote control.
The other option would be that you do NOT have the devices talk directly to each other. Then you should be able to bind the remote in a way that you actually receive commands for the item and by binding the lamp to the same item these received commands should then directly be sent out to the lamp again - the autoupdate in openHAB will make sure that the commands will be mapped to a new item status, so that the UI is always up-to-date.
Both options make sense and could be supported by the rfxcom binding configuration syntax. Probably best to enter a feature request for Pali in the issue tracker - or go for it yourself :-)

Best regards,
Kai

Evert van Es

unread,
Apr 3, 2013, 7:12:32 PM4/3/13
to ope...@googlegroups.com
Okay, 

 
Thanks 

Evert

Pali

unread,
Apr 6, 2013, 6:52:02 AM4/6/13
to ope...@googlegroups.com
Hi Evert,

I just pulled your changes from your clone and my wireless devices seems to work fine as well. 

So changes definitely should be taken in to main repo.

Thanks,
Pali

Evert van Es

unread,
Apr 6, 2013, 1:28:17 PM4/6/13
to ope...@googlegroups.com
Super. Do I need to do anything?

Verstuurd vanaf mijn iPhone
--
You received this message because you are subscribed to a topic in the Google Groups "openhab" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openhab/caRDCmvNdbE/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to openhab+u...@googlegroups.com.

Kai Kreuzer

unread,
Apr 6, 2013, 1:35:12 PM4/6/13
to ope...@googlegroups.com
Nope, I will pull the code to the main repo.

Cheers,
Kai

You received this message because you are subscribed to the Google Groups "openhab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhab+u...@googlegroups.com.

Evert van Es

unread,
Apr 6, 2013, 1:47:52 PM4/6/13
to ope...@googlegroups.com
Pali,

I Will send you some info to add to the wiki concerning the curtains.

The next few days are busy for me so hope to send you some info in a weeks time.

Thanks Evert


Verstuurd vanaf mijn iPhone

Kai Kreuzer

unread,
Apr 7, 2013, 4:35:50 AM4/7/13
to ope...@googlegroups.com
I have pulled the changes to the main repo - thanks for the contribution, Evert!

Best regards,
Kai


Evert van Es

unread,
Apr 8, 2013, 2:49:02 AM4/8/13
to ope...@googlegroups.com
Can I update the wiki on rfxcom myself?

I cannot find an edit button on the page...

Kai Kreuzer

unread,
Apr 8, 2013, 3:38:02 AM4/8/13
to ope...@googlegroups.com
Try again :-)

Am Apr 8, 2013 um 8:49 AM schrieb Evert van Es <evert...@gmail.com>:

Can I update the wiki on rfxcom myself?

I cannot find an edit button on the page...

daka

unread,
Apr 9, 2013, 6:32:27 PM4/9/13
to ope...@googlegroups.com
I added a message handler for RFXCom Security1 messages in my clone http://code.google.com/r/davidkalff-openhab/
The Security1 message handles X10 Security (motion detectors, door sensors, etc), Visonic, KD101 and Meiantech protocols.
This message provides a (device)id, status, battery- and signal level. The STATUS field is can contain many values (i.e. NORMAL, NORMAL_DELAYED, ALARM, ALARM_DELAYED, MOTION, NO_MOTION, PANIC, END_PANIC, IR, ARM_AWAY, ARM_AWAY_DELAYED, etc.). This makes it a bit difficult to pick a proper OH Item for this field. String, Switch and Contact are all applicable, depending on the device. So I mapped the STATUS field to a StringItem for now. With rules the StringItem could be used to update Switches and Contacts.

Cheers,
David

Op maandag 8 april 2013 09:38:02 UTC+2 schreef Kai het volgende:

Evert van Es

unread,
Apr 10, 2013, 1:42:24 PM4/10/13
to ope...@googlegroups.com
Today I received a package from Bert of RFXCOM with a much improved antenna. I can now (again) receive signals from my neighbors.  They must have an Oregon device as I can now see Oregon messages coming by.

Therefore I just updated my rfxcom project to support Oregon WIND messages! Thanks Bert!

David, I am not at all familiar with hg and do not know who should integrate your changes.... Kai can you give me some guidance please?

My java knowlegde is also pretty basic. What I do not like about the current RFXCOM sources is the way that you need to modify 4 source files in order to support a new message.

I have already moved quite a bit of code from utility classes to the individual message classes. David, this will mean that you need to adjust your message as well. You can look into my clone for the details.

There are many protocols in RFXCOM hardware that we need to support. We can expect many more additions and we need to find a way to add these with as little modifications as possible.

thanks to you all, 

Evert

Pauli Anttila

unread,
Apr 10, 2013, 2:37:20 PM4/10/13
to ope...@googlegroups.com
Hi Evert,

one design principle was that RFXCOM code (connector and messages) should be reusable, meaning that they should be independent from openhab. You have now moved openhab specific code to message classes, which obviously make new message implementation easier, but broke independency.

Br,
Pali



2013/4/10 Evert van Es <evert...@gmail.com>

--

Evert van Es

unread,
Apr 10, 2013, 3:31:19 PM4/10/13
to ope...@googlegroups.com
Pali,

Hmm, I was unaware of that principle.

What route do you find preferable for now and the future?

Thanks Evert

Verstuurd vanaf mijn iPhone
You received this message because you are subscribed to a topic in the Google Groups "openhab" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openhab/caRDCmvNdbE/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to openhab+u...@googlegroups.com.

Pali

unread,
Apr 12, 2013, 3:43:00 AM4/12/13
to ope...@googlegroups.com
Hi Evert,

code reuse should be more generic principle. I can confess, that I forgot that principle very often too :)

But for the problem itself, currently I don't have any good proposal. When amount of supported messages is raising, data converter class will be very ugly for sure.

Regards,
Pali

Evert van Es

unread,
Apr 12, 2013, 4:09:14 AM4/12/13
to ope...@googlegroups.com
Pali,

Reusable RFXcom code should go into the messageutil class.

All message specific code into each message class.

And I would like to make the calls to the individual message classes as generic as possible. Having limited java knowledge, how can we instantiate a message implementation class just based on its packet type?  Can this be done using reflection perhaps?

Thanks Evert

Verstuurd vanaf mijn iPhone

Evert van Es

unread,
Apr 18, 2013, 2:02:28 AM4/18/13
to ope...@googlegroups.com
Ok, I updated my clone to the official 1.2 version.
Made some small tweaks.

Daka, did you get the Security1 working?

There is some great code to be found from the Micasaverde platform. Please take a look at the following file:

David

unread,
Apr 21, 2013, 5:43:22 PM4/21/13
to ope...@googlegroups.com
Hi Evert,

Yes, the Security1 message is working. I updated my clone. I added MOTION and CONTACT to the enums. Depending on the status, the motion and contact are set. I couldn't test the CONTACT, my X10 door sensor broke down.
Is anybody working on the combination of the binding configuration strings (input and output for one item)? I'll try to work on that.

Regards,
David

Op donderdag 18 april 2013 08:02:28 UTC+2 schreef Evert van Es het volgende:

Colin Glover

unread,
Feb 6, 2015, 11:31:37 AM2/6/15
to ope...@googlegroups.com
Hi David, I want to add my Visonic PowerMax to my OpenHab configuration using an RFXCOM receiver that I have.  Would your clone work in my situation?

Thanks
Colin
Reply all
Reply to author
Forward
0 new messages