Page 1 of 1

Unable to Send Commands to RFLink

Posted: 09 May 2023, 18:15
by RichieRogers1972
Hi,
I've got an RFLink that can successfully send and receive signals for various 433MHz items in RFLinkLoader.
However, trying to use Python (a library python-rflink, I think) or pySerial I can receive signals, but send doesn't do anything (no error, but device not triggered - tried with blinds and a remote that sends to a different RF433 device plugged into my OpenHab system).
I've also tried on a Raspberry Pi running Ubuntu and get the same; working receive, not working send.
Can anyone suggest what I'm missing in trying to send direct to the "com" port?
I'm presuming some sort of formatting or CR/LF is missing, although I have tried adding various combinations of \n \r without success.

Thanks in advance for any help.

Richie

Re: Unable to Send Commands to RFLink

Posted: 09 May 2023, 19:20
by Stuntteam
It for sure needs cr/lf on commands..

Re: Unable to Send Commands to RFLink

Posted: 09 May 2023, 21:20
by RichieRogers1972
Hi,
Yeah, I thought as much, but not found a way to make it work in Python.
Have just had some success with miniterm:
miniterm [/dev/ttyUSB0] 57600 -e --eol CRLF
Pasting in any of these does work for one of my blinds:
10;BofuMotor;e20202;03;DOWN;
10;BofuMotor;e20202;03;UP;
10;BofuMotor;e20202;03;STOP;

So, I just need to work out how to get pySerial to do it.

Code: Select all

import serial
ser = serial.Serial("/dev/ttyUSB0",57600,timeout=2)
# none of these work
ser.write(b'10;BofuMotor;e20202;03;DOWN;')
ser.write(b'10;BofuMotor;e20202;03;DOWN;\n')
ser.write(b'10;BofuMotor;e20202;03;DOWN;\r\n')

ser.flush()
ser.close()
Any idea what else I can try?

Thanks,
Richie

Re: Unable to Send Commands to RFLink

Posted: 09 May 2023, 21:34
by RichieRogers1972
Hi,
After some "playing around" I've got it to work, but is a bit strange.
This works:

Code: Select all

import serial
ser = serial.Serial("/dev/ttyUSB0",57600,timeout=2)
ser.readline() # this just before the "write" makes it work
ser.write(b'10;BofuMotor;e20202;03;DOWN;\r\n')

ser.flush()
ser.close()
Is this how it's supposed to work?

Thanks,
Richie