Rfxcom unable to re-send undecoded data

Tags: #<Tag:0x00007f2fc8e966b0> #<Tag:0x00007f2fc8e94720> #<Tag:0x00007f2fc8ea5d90>

I have set up RFXCom on my openhab2 (openhabian) installation and its working perfectly, I mean, it send successfully commands to my equipments (ex: my Somfy RTS roller shutter, chacon plugs…).
I want now to manage my Novy hood with OH2. I dont find any binding for that but I’m able to observe undecoded messages in log when i press a button on the remote.

Is it possible to replay those undecoded messages (like the rfxcom manager on windows) ?
Generally speaking, how to send rawmessage with rfxcom ?

Here is my things configuration :

Bridge rfxcom:bridge:rfxcom433 [ serialPort="/dev/ttyUSB0", ignoreConfig=true, enableUndecoded=true]
    Thing rfy RS_Kitchen [ deviceId="45ED7F.3", subType="RFY" ]
    ... lot of things ...
    Thing undecoded UndecodedRfxcom433

My items

Switch FF_Kitchen_Hood "Hood"
String UndecodedMessage "Undecoded message" {channel="rfxcom:rfy:rfxcom433:UndecodedRfxcom433:rawPayload" }

My rules

rule "FF_Kitchen_Hood"
    Item FF_Kitchen_Hood received command
    UndecodedMessage.sendCommand('507F001201016D0 ... a lot of HEX DATA ... 1901430000')

But nothing happen, I think no commands are send because not even the rfxcom leds are blinking.

Thanks for you help !

I didn’t manage to send hex data directly to RFXCom using the RFXCom binding (configured with serialPort). After reading this post Share Z-wave dongle over IP (USB over IP using ser2net / socat ) guide and this page https://www.openhab.org/addons/bindings/rfxcom/ I decided to share my usb device over the network with a TCP connexion.

What I have done

  • For connecting RFXCom with openhab :

RFXCom (/dev/ttyUSB0) <-> ser2net (TCP server) <-> socat (TCP client) <-> /dev/VirtualRfxCom (virtual serial port) <-> OpenHab2

  • For sending hex data to RFXCom (for example replay undecoded data)

RFXCom (/dev/ttyUSB0) <-> ser2net (TCP server) <-> Script which send TCP data using netcat

  • For managing RFXCom, test purposes…

RFXCom (/dev/ttyUSB0) <-> ser2net (TCP server) <-> RFXManager on Windows

The problems I encountered

>> Openhabian and ser2net

The apt repository in openhabian do not get the latest version of ser2net which allow multiple connexions (the parameter max-connexions). I had to install Raspbian and Openhab with the package repository procedure https://www.openhab.org/docs/installation/linux.html#package-repository-installation. Another solution (simpler) would be to update the repo definition in openhabian.

ser2net configuration

# /etc/ser2net.conf
10001:raw:0:/dev/USBrfxcom:38400 8DATABITS NONE 1STOPBIT max-connections=3

This link is useful for the configuring the serial port : https://www.openhab.org/docs/administration/serial.html

>> RFXCom and TCP/IP binding

The TCP connexion is not stable (systematically released after some time), the serial connexion works better, that’s why I use of socat which map a virtual serial port with a TCP client.

socat configuration

 # /etc/default/socat.conf
OPTIONS="pty,link=/dev/VirtualRfxCom,raw,user=openhab,group=dialout,mode=777 tcp:,forever,interval=1"

forever and interval parameters are important because on reboot if ser2net is not ready ( = the port is not opened), socat will fail to establish the connexion

Openhab thing configuration

Bridge rfxcom:bridge:rfxcom433 [ serialPort="/dev/VirtualRfxCom", ignoreConfig=false, enableUndecoded=false, enableARC=true, enableAC=true]

>> The format of the data to send

I start with the undecoded messages I can observe with RFXManager, I re-send it with netcat and printf using the \x commutator. I also have to use sleep between commands because they are sent to quickly.

The shell commands I use (in a script) :

printf "\x54\x7F [ … some hex data separated with \x … ] \x00\x00" | nc -N 10001
sleep 0.3

And the code in the rules

executeCommandLine("bash /etc/openhab2/scripts/HoodManager.sh")

Overall I must admit it is not a simple solution but It works like a charm.

I hope it can help, I am listening to all the good ideas / advices on this configuration.

1 Like