HAI serial port ?

vining

New Member
Quick question that unfortunately I can't get from HAI as their answers are usually wrong, useless or they don't respond.
 
Q.  If a serial port in configured as RA2 should I still be able to send my own formatted string out that port?
 
The port is working fine for my defined Units and Scenes (RA2 Phantom Buttons) but I want to activate emergency scenes when appropriate and to do that I need to send a press to start it and a release to end it.  I didn't look that closely but believe HAI only sends the press.  I created messages for the strings needed #DEVICE,1,100,3^M^J for the press and #DEVICE,1,100,4^M^J for the release, each requires sending two messages since the string doesn't fit in one.  I've done that before with no problems but the problem I have is when I trigger either of these strings I get an #OUTPUT,36,0,0^M^J string or very similar which are valid RA2 strings for UNITs associated with RA2 and that serial port. It's coming form the code lines as my flag is being set properly so it is the lines of code executing and not something else happening.  My thinking is that by defining that port as RA2 the strings I'm sending are being routed through the RA2 driver which doesn't know what to make of the command and some how takes the string and equates it to a command slot used to store Unit commands and sends that instead.  Basically turns it into an index pointer that points to a unit command array element.  So I believe it is not possible to send a string directly by writing lines of code in the port is defined as RA2 or probably any other specific driver.  It would be no problem if the port was set up as a Pro-Link but since it's set up as RA2 which works for everything I need other than triggering or the real problem which is terminating the emergency scene, sending the release.  Obviously I could use a regular scene but then lights won't resume to their previous states.
 
I'm fairly convinced this is the case but if anyone knows for sure I'd appreciate confirmation so I can stop wasting time.  If there's any kind of escape sequence that would allow a string to "passthru" the driver that would be cool too.  
 
I was thinking I could install a relay controlled by an HAI output, use the common to go the Lutron's RX, the NC side to the RA2 config'd port's TX and the NO side the TX of a 2nd serial port config'd as pro link.  Then I could just activate that output to pull in the relay prior to sending my string out the Pro Link port.  Convoluted sure but it might work, RS232 taboo but otherwise I'd need a car visor control and use its I/O inputs or I just say f' it and use a plan scene.  Of course I can't flash then either.
 
That's a possibilty, never had a need to use one before and for my intended use and purpose collisions and data corruption would be extremely unlikely. I think if I were to go this route I'd try the relay idea I mentioned earlier to switch the TX line out of each port just to see if it works. It's one of those goofy ideas that makes me curious now that I thought of it, with rs232 electronically it should work, I already have the relay I'd use and it would only take a few minutes to do.
 
Well I set up a relay today to switch just the TX pin of the serial ports so I can send a serial string to the RA2 master to start and stop the emergency scene and it worked alright.  I already figured in a delay after making the switching relay (basic RIB U1C) but ended up having to installed a post send string delay before returned the relay to it's normal, off state.  I think the HAI output buffer but have a little delay which sometimes didn't finish sending before my relay was turned off through my original code.  Goofy but it works.  I made two button macros to manually activate from the touch screens or keypads, used one output to control relay, one RIB U1C relay and the code below.  On the 2nd port I'm only using the TX out so that's all that's being switched between my standard RA2 defined port and my Pro Link defined port which allows me to send the string necessary to start/stop the emergency scene.  Feedback from RA2 is never interrupted. 


22. WHEN BTN EMERGENCY LTS ON
THEN EMERG FLAG ON
23. // Set on then off to force a repeat of off event if already off
24. WHEN BTN EMERGENCY LTS OFF
THEN EMERG FLAG ON FOR 1 SECOND
25. WHEN House BURGLARY ALARM
WHEN House GAS ALARM
WHEN House FIRE ALARM
THEN EMERG FLAG ON
26. WHEN House OFF
AND IF EMERG FLAG ON
THEN EMERG FLAG OFF
27. // When user button or alarm event, prepare to send emergency on
28. WHEN EMERG FLAG ON
WHEN EMERG FLAG OFF
THEN OUT RA2 SW 232 TX ON
THEN RA2 OK Send FLG ON FOR 2 SECONDS
29. // When user button or alarm turned off, prepare to send emergency off
30. WHEN EMERG FLAG OFF
AND IF NEVER
THEN OUT RA2 SW 232 TX ON
THEN RA2 OK Send FLG ON FOR 2 SECONDS
31. // When timer times out, prepare to send emergency off
32. WHEN EMERG LTS TIME OUT FLG OFF
AND IF EMERG FLAG ON
THEN OUT RA2 SW 232 TX ON
THEN RA2 OK Send FLG ON FOR 2 SECONDS
THEN EMERG FLAG OFF
33. // When user button or alarm, send emergency on
34. WHEN RA2 OK Send FLG OFF
AND IF EMERG FLAG ON
THEN SEND RA2 EMERG LTS PRESS OUT SERIAL 2
THEN SEND CRLF OUT SERIAL 2
THEN EMERG LTS TIME OUT FLG ON FOR 30 MINUTES
THEN RA2 TX OFF DLY TMR ON FOR 5 SECONDS
35. // When user button or alarm turned off, send emergency off
36. WHEN RA2 OK Send FLG OFF
AND IF EMERG FLAG OFF
AND IF EMERG LTS TIME OUT FLG CURRENT VALUE IS GREATER THAN 0
THEN SEND RA2 EMERG LTS RELEASE OUT SERIAL 2
THEN SEND CRLF OUT SERIAL 2
THEN EMERG LTS TIME OUT FLG OFF
THEN RA2 TX OFF DLY TMR ON FOR 5 SECONDS
37. // When timer times out, send emergency off
38. WHEN RA2 OK Send FLG OFF
AND IF EMERG FLAG OFF
AND IF EMERG LTS TIME OUT FLG OFF
THEN SEND RA2 EMERG LTS RELEASE OUT SERIAL 2
THEN SEND CRLF OUT SERIAL 2
THEN RA2 TX OFF DLY TMR ON FOR 5 SECONDS
39. WHEN RA2 TX OFF DLY TMR OFF
THEN OUT RA2 SW 232 TX OFF


 
 
Back
Top