Received data from CBUS RS232 interface

General HouseBot discussion. Any issues that don't fit into any of the other topics belong here.
Post Reply
John_Paul_128
Member
Posts: 15
Joined: Tue Apr 15, 2003 9:33 am

Received data from CBUS RS232 interface

Post by John_Paul_128 »

All,

I want to execute a task upon receiving data from the CBUS RS232 interface such as:

050B38000220484E

I have noticed some forum posts that relate to scripts to do something similar, but I can't quite work this out!

Any help would be appreciated!


thks, John
Richard Naninck
HouseBot Guru Extraordinaire
Posts: 1121
Joined: Tue Sep 28, 2004 7:49 am
Location: The Netherlands

Re: Received data from CBUS RS232 interface

Post by Richard Naninck »

John_Paul_128 wrote:I want to execute a task upon receiving data from the CBUS RS232 interface such as:

050B38000220484E
The Received Data property of the generic serial device will list this hex string in ascii code and is therefore unreadable. Not sure if you can even compare hex code displayed in ascii in a task comparison with text (new V3 feature). Besides that, you would have to build many tasks or many if statements in a task to handle all of your hex strings. Presuming you want to handle more than the one above.
If that is the case and you are capable of building a script, you can make it as nice as you want.
If you look at the scripts section under "Other Large Scripts" and download it, you will find a script that handles my plasma serial. It is also hex based. In this script (simple vbscript code) you see that the ascii from the received data property is rebuilt to readable hex using the Asc() function. You could basically strip that whole script and use the parsing part from it to get you going. Such a script could be run from a task without the use of a script device (V3 only). You can run the script when the received data property changes, or you can run it in a script device continuously while having the script check the received data property like in my plasma example. Any way works.
John_Paul_128
Member
Posts: 15
Joined: Tue Apr 15, 2003 9:33 am

Post by John_Paul_128 »

I have since upgraded to version 3 and can now compare the received data property using a 'contains' in a task

Eg if data contains "0F1E223345" then...

No need for a script to achieve the outcome I was seeking.

Thanks
Thales
Member
Posts: 46
Joined: Sat Sep 29, 2007 3:52 pm

Received Data

Post by Thales »

Paul,

Please I have the same problem you had.
Please Can you explain me how did you set the received Data to compare.
Did you creat a device?
What did you write on Received Data property?

thank you

Thales
Timoh
Advanced Member
Posts: 260
Joined: Thu Feb 02, 2006 12:56 pm
Location: Montreal - Canada

Post by Timoh »

Likewise I have a Caddx NX-8e alarm panel that talks hex. I trigger a script that parses out the data received from the alarm panel. The hex data is fairly complicated because there is so much data an alarm panel can convey... ready, armed, bypassed, fire, smoke, AC fail, siren, zone name, last alarm zoned, faulted zone, ++++ I've probably only implemented about 1/4 of the hex codes from panel into HB.

I wrote it pre-v3, but probably couldn't have done it with "contains". There are repetitive hex codes which depending where they are in the string, mean different things.

I think it should still be posted in the scripts somewhere.

Tim
Post Reply