Haiku using HAI serial port

cestor

Active Member
Hello, I want to send RS485 messages through the OP2 but they are 20 characters long and are 8O1 rather than 8N1 so the Prolink protocol does not help. Is there a way of sending the messages using HH?
 
Not using the HAI serial port. HaikuHelper can send serial port messages itself though, but the device would have to be connected to the Mac running HaikuHelper.
 
Sorry if I'm curious but why RS485 with that protocol?
I believe this can be done with something between OPII and your receiving system. I successfully connected an arduino to OPII via serial and I believe that it can do the translation and send out the RS485 messages as needed.
 
My guess would be distance. Then again, it's easy enough to convert 485 back to serial via a 3rd party, but I would've used a dedicated media converter before using an arduino.
 
If that's the only point you're certainly right. The arduino solution could fit if more flexibility is needed.
 
The reason why I am using RS485 is for Somfy blind control- I am using their RS485 transmitter. 
 
The Somfy Universal RTS Interface works fine connected to an Omni Pro II serial port.  Commands are only 9 characters long, so a 15 character limit shouldn't be much of a problem.  I've even chained two messages together with the Somfy interface and that works fine as well.  Make sure you set the serial type to ProLink and NOT Somfy.
 
The Universal RTS interface has very limited set of commands, which is why it can afford simpler protocol.
 
"A single RS485RTS transmitter manages 16 groups of up to 10 motorised shading devices each. Supported functions include: open, close, stop, go/record/delete a preset position, sun protection and tilting (specially suitable for venetian blinds)." In addition, the RS485 transmitter can query and receive the shade's status.
 
I was looking into possibility to replace my URTS with this transmitter to expand control functionality, but only found it sold in UK and for a very high price...
 
 
picta said:
I was looking into possibility to replace my URTS with this transmitter to expand control functionality, but only found it sold in UK and for a very high price...
Stupid question but Somfy says that this transmitter is not licensed to work in the US. Are you sure it would even work with shades sold in the US? 
 
I think that it's extremely unlikely that the Somfy RS485 transmitter will work with US motors. I am using it with European motors and the RS485 generates hex frames that are in a completely different format to the command strings expected by the US motors. At some point I will do a write-up of how to integrate the OP2 with European Somfy blinds...
 
ano said:
Stupid question but Somfy says that this transmitter is not licensed to work in the US. Are you sure it would even work with shades sold in the US? 
I did not look that far after seeing the price tag of ~$600 :)
 
I am now using HH to send messages through the serial port on the mac instead but have run into difficulties- I need to send 13 bytes in hex whereas the port.write method expects an ascii string. I have tried using a hex to ascii function to convert each byte and then send the ascii through one byte at a time but HH throws the following exception: "onButtonActivate":write(): -[AMSerialPort writeString:usingEncoding:error:]: unrecognised selector sent to instance 0x7fdf1c379ad0.
 
My test code is below:
 
 
var port=helper.openSerialPort(controller,'/dev/cu.Repleo-CH341-00001004');
var code=hex2a('7f');
var code2=hex2a('2f');
var code3=hex2a('fa');
var code4=hex2a('01');
var code5=hex2a('00');
var code6=hex2a('00');
var code7=hex2a('49');
var code8=hex2a('55');
var code9=hex2a('fa');
var code10=hex2a('fb');
var code11=hex2a('fd');
var code12=hex2a('05');
var code13=hex2a('fc');
port.setSpeed(4800);
port.setParity(1);
port.write (code);
port.write (code2);
port.write (code3);
port.write (code4);
port.write (code5);
port.write (code6);
port.write (code7);
port.write (code8);
port.write (code9);
port.write (code10);
port.write (code11);
port.write (code12);
port.write (code13);
port.close();
}
function hex2a(hexx) {
    var hex = hexx.toString();//force conversion
    var str = '';
    for (var i = 0; i < hex.length; i += 2)
        str += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
    return str;
}
 
Try making the entire command string by concatenating all ascii "codes". Then send the string
 
This is what I do in VB and it works:
 
dim cmd
cmd = Chr(&hF3) & Chr(&hF4) & Chr(&hFD) & Chr(&hFE) & Chr(&hFF) & Chr(&hFF) & Chr(&h8D) & Chr(&hC7) & Chr(&hF9) & Chr(&h08) & Chr(&h2D) // makes a char string out of hex bytes
send CStr(cmd) // sends cmd as C string
 
Back
Top