RFLink binding

Hey David, Im using your enhanced version of RFLinkGateway … but in the original as well as in your version I have trouble with temperature readings… example:

RFLINK/Digitech/00ba/R/BAT OK
RFLINK/Digitech/00ba/R/TEMP 38.3
RFLINK/Digitech/00ba/R/message 20;04;Digitech;ID=00ba;TEMP=017f;BAT=OK;

RFLINK/Prologue/9742/R/TEMP 3277.1
RFLINK/Prologue/9742/R/message 20;05;Prologue;ID=9742;TEMP=8003;

Why is the value that is sent to the controller changed (corrupted?)?
In the first example I would have wanted “017f” to be the value to get to the controller… and “8003” in the second example… Am I missing something?


Edit:
Well I think I understand now… the hex value is translated to decimal… that seems to work as long as we have positive degrees (Celcius)… but when the temperature drops below 0 C it should have calculated 3276.8 (8000h) - 3277.1 (8003h) = -0.3 (my second example)…

@Johan_F Can you try the fix I’ve committed?

hm I get

RFLinkGW.SerialProcessing - run - ERROR - Receive error: name 'signedhex2dec' is not defined

Ok, sorry about that. I’ll investigate later today and fix this.

@Johan_F : should be fixed now. Let me know if something is still wrong

1 Like

works like a charm now! Thanks a lot man :slight_smile:

a question about this:

im new in OH2 (OHian). How can i add this binding
to OH2?

i see here different solution to bind a rflink device, eg

works they all with the last OH2 revision?

rflink-page shows a link to cyrilcc/org.openhab.binding.rflink

regard

Another one is described earlier in this thread, you don’t have to install a special binding.

1 Like

ok, how can i log my devices? if i copy your code, i get a error

==> /var/log/openhab2/openhab.log <==

2018-01-04 17:38:42.185 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'home.rules'

2018-01-04 17:38:42.204 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'home.rules' is either empty or cannot be parsed correctly!

2018-01-04 17:38:42.300 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'home.rules' has errors, therefore ignoring it: [12,1]: missing EOF at 'val'

im new in OH. can anyone help, that on my system rflink runs?

at the moment i ve a clean openhabian installed. only samba and ssh works.

how must i install the script or the addon?

nobody want or can help me?
is it so difficult to add rflink?

I am using https://github.com/dmartinpro/RFLinkGateway and it’s working just fine

thx for your fast answer. im new, so i dont know, in which folder i must put the files.
can you help`?

It is a standalone application to transfer the information from rflink to a mqtt server. Openhab has to be connected to the mqtt server as well.

thx

if i try to start via ssh, i get this error

[14:26:09] openhabian@openHABianPi:~$ ls
README.txt  RFLinkGateway
[14:26:10] openhabian@openHABianPi:~$ cd RFLinkGateway/
[14:26:16] openhabian@openHABianPi:~/RFLinkGateway$ ls
config.json  MQTTClient.py  readme.md  RFLinkGateway.py  SerialProcess.py
[14:26:17] openhabian@openHABianPi:~/RFLinkGateway$ sudo chmod +x *.*
[sudo] password for openhabian:
[14:26:32] openhabian@openHABianPi:~/RFLinkGateway$ ./MQTTClient.py &
[1] 30376
[14:27:38] openhabian@openHABianPi:~/RFLinkGateway$ ./MQTTClient.py: line 1: import: command not found
./MQTTClient.py: line 2: import: command not found
./MQTTClient.py: line 3: import: command not found
./MQTTClient.py: line 5: import: command not found
./MQTTClient.py: line 6: import: command not found
./MQTTClient.py: line 9: syntax error near unexpected token `('
./MQTTClient.py: line 9: `class MQTTClient(multiprocessing.Process):'
^C
[1]+  Exit 2                  ./MQTTClient.py
[14:27:42] openhabian@openHABianPi:~/RFLinkGateway$ ./RFLinkGateway.py &
[1] 30387
[14:27:54] openhabian@openHABianPi:~/RFLinkGateway$ ./RFLinkGateway.py: line 1: import: command not found
./RFLinkGateway.py: line 2: import: command not found
./RFLinkGateway.py: line 3: import: command not found
./RFLinkGateway.py: line 4: import: command not found
./RFLinkGateway.py: line 5: import: command not found
./RFLinkGateway.py: line 7: import: command not found
./RFLinkGateway.py: line 8: import: command not found
./RFLinkGateway.py: line 9: import: command not found
from: can't read /var/mail/tornado.options
./RFLinkGateway.py: line 12: import: command not found
./RFLinkGateway.py: line 13: import: command not found
./RFLinkGateway.py: line 15: syntax error near unexpected token `('
./RFLinkGateway.py: line 15: `log_level = os.getenv('RFLINK_LOG_LEVEL', 'INFO')'
^C
[1]+  Exit 2                  ./RFLinkGateway.py
[14:28:03] openhabian@openHABianPi:~/RFLinkGateway$ ./SerialProcess.py &
[1] 30405
[14:28:10] openhabian@openHABianPi:~/RFLinkGateway$ ./SerialProcess.py: line 1: import: command not found
./SerialProcess.py: line 2: import: command not found
./SerialProcess.py: line 3: import: command not found
./SerialProcess.py: line 5: import: command not found
./SerialProcess.py: line 7: syntax error near unexpected token `('
./SerialProcess.py: line 7: `class SerialProcess(multiprocessing.Process):'
[14:28:10] openhabian@openHABianPi:~/RFLinkGateway$

i had installed this 3 here:
sudo pip install serial
sudo pip install tornado
sudo pip install tornado-mqtt

it seems that
MQTTClient.py
and
SerialProcess.py
runs now.
but not
RFLinkGateway.py

[18:14:50] openhabian@openHABianPi:~/RFLinkGateway$ ./RFLinkGateway.py
Traceback (most recent call last):
  File "./RFLinkGateway.py", line 37, in <module>
    fh = logging.FileHandler(os.getenv('RFLINK_LOG_FILE', '/var/log/RFLinkGateway.log'))
  File "/usr/lib/python2.7/logging/__init__.py", line 913, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib/python2.7/logging/__init__.py", line 943, in _open
    stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/var/log/RFLinkGateway.log'

any idea?

start the gateway with python RFLinkGateway.py

make sure to adjust the config file accordingly to your needs. The error you are seeing means you don’t have the rights to write the logfile in the /var/log directory

thx. i try it with sudo

 sudo python RFLinkGateway.py
2018-01-08 21:16:01,184 - RFLinkGW.SerialProcessing - __init__ - INFO - Starting...
Traceback (most recent call last):
  File "RFLinkGateway.py", line 78, in <module>
    main()
  File "RFLinkGateway.py", line 61, in main
    sp = SerialProcess.SerialProcess(messageQ, commandQ, config)
  File "/home/openhabian/RFLinkGateway/SerialProcess.py", line 19, in __init__
    self.sp = serial.Serial()
AttributeError: 'module' object has no attribute 'Serial'

next error

i tink it runs now…
i had installed
sudo python -m pip install pyserial

now i get

[22:44:20] openhabian@openHABianPi:~/RFLinkGateway$ sudo python RFLinkGateway.py
2018-01-08 22:44:32,511 - RFLinkGW.SerialProcessing - __init__ - INFO - Starting...
2018-01-08 22:44:32,513 - RFLinkGW.SerialProcessing - connect - INFO - Connecting to serial
2018-01-08 22:44:32,515 - RFLinkGW.SerialProcessing - __init__ - INFO - Ignoring devices: [u'Friedland', u'Oregon Temp/FD10', u'BL999', u'RTS']
2018-01-08 22:44:32,522 - RFLinkGW.MQTTClient - __init__ - INFO - Starting...
2018-01-08 22:44:32,527 - RFLinkGW.MQTTClient - __init__ - INFO - Connection with credentials (user: user).
2018-01-08 22:44:32,566 - RFLinkGW.MQTTClient - _on_connect - INFO - Connected to broker. Return code: Connection Accepted.
2018-01-08 22:44:33,449 - RFLinkGW.SerialProcessing - prepare_output - INFO - Nodo RadioFrequencyLink - RFLink Gateway V1.1 - R47

can i see in the RFLinkGateway.log which devices rflink has found?

hello

the LOG show now (only) this:

2018-01-09 07:03:20,508 - RFLinkGW.SerialProcessing - __init__ - INFO - Starting...
2018-01-09 07:03:20,511 - RFLinkGW.SerialProcessing - connect - INFO - Connecting to serial
2018-01-09 07:03:20,519 - RFLinkGW.SerialProcessing - __init__ - INFO - Ignoring devices: [u'Friedland', u'Oregon Temp/FD10', u'BL999', u'RTS']
2018-01-09 07:03:20,526 - RFLinkGW.MQTTClient - __init__ - INFO - Starting...
2018-01-09 07:03:20,534 - RFLinkGW.MQTTClient - __init__ - INFO - Connection with credentials (user: user).
2018-01-09 07:03:20,574 - RFLinkGW.MQTTClient - _on_connect - INFO - Connected to broker. Return code: Connection Accepted.
2018-01-09 07:03:21,445 - RFLinkGW.SerialProcessing - prepare_output - INFO - Nodo RadioFrequencyLink - RFLink Gateway V1.1 - R47
2018-01-09 07:51:42,394 - RFLinkGW.SerialProcessing - prepare_output - INFO - Cresta

in the mosquitto.log i see this:

....
1515481682: New connection from 192.168.1.208 on port 1883.
1515481682: New client connected from 192.168.1.208 as b1d8c5bf-21ea-4c40-aa7b-6273051a891a (c1, k60, u'user').
1515481682: Client b1d8c5bf-21ea-4c40-aa7b-6273051a891a disconnected.
1515481682: New connection from 192.168.1.208 on port 1883.
1515481682: New client connected from 192.168.1.208 as 6ad2499a-aab4-44f3-836f-d7d391a6c55f (c1, k60, u'user').
1515481682: Client 6ad2499a-aab4-44f3-836f-d7d391a6c55f disconnected.
1515481682: New connection from 192.168.1.208 on port 1883.
1515481682: New client connected from 192.168.1.208 as e91f9d12-0410-4df6-935b-0551e1ee4e64 (c1, k60, u'user').
1515481682: Client e91f9d12-0410-4df6-935b-0551e1ee4e64 disconnected.
1515481684: Socket error on client RFLinkGateway, disconnecting.
1515482591: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1515484392: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1515486193: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1515487994: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1515489795: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1515491596: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1515493397: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1515495198: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1515496999: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1515498801: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1515500602: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1515502403: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1515504204: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1515506005: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1515507806: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1515509607: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1515510726: Client DVES_862B6C has exceeded timeout, disconnecting.
1515510726: Socket error on client DVES_862B6C, disconnecting.
1515510746: New connection from 192.168.1.71 on port 1883.
1515510746: New client connected from 192.168.1.71 as DVES_862B6C (c1, k15, u'openhabian').
1515511408: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
  1. i think somewhere is a error, or?
  2. where can i find my devices that rflink has found?

in other tool i find with rflink every few seconds devices infos (e.g. FHEM, Pimatic, Home Assistant)

regard and thx for help

EDIT

here is something:

 mosquitto_sub -t "rflink/#"
aa
20;17;Cresta;ID=3D01;TEMP=0456;HUM=aa;BAT=OK;

OK
111.0
86
20;18;Cresta;ID=AB04;TEMP=0016;HUM=86;BAT=OK;

OK
2.2
2.1
OK
1.7
4.0
-0.2
20;19;Cresta;ID=8201;WINDIR=0015;WINSP=0028;WINGS=002c;WINTMP=0011;WINCHL=8002;BAT=OK;

4.4
93
20;1A;Cresta;ID=6703;TEMP=0015;HUM=93;BAT=OK;

OK
2.1
aa
20;1B;Cresta;ID=3D01;TEMP=0456;HUM=aa;BAT=OK;

OK
111.0
0.0
OK
1.8
4.0
-0.2
20;1C;Cresta;ID=8201;WINDIR=0000;WINSP=0028;WINGS=002c;WINTMP=0012;WINCHL=8002;BAT=OK;

4.4
86
20;1D;Cresta;ID=AB04;TEMP=0017;HUM=86;BAT=OK;

OK
2.3
93
20;1E;Cresta;ID=6703;TEMP=0015;HUM=93;BAT=OK;