React on specific string
bia@jdm.dk
Posts: 20
Hi guys
I got feedback strings from Lutron to my Netlinx controller - reporting about keypads LED status.
These status feedbacks, I would like to translate to channel feedback - to my 8400i panel.
The strings look like this:
KLS, [01:05:XX], YYYYYYYYYYYYYYYYYYYYYYY
"XX" are the adress of the keypad, and YYYYYYYYYYYYYYYYYYYYYYY are LED stauts (1 or 0)
Now I need to channel react (TP2,821 = 1) if keypad adress 40 - LED number 1 is ON
(KLS, [01:05:40], 100000000000000000000)
How do I pick out adress 40 - and then sniff out LED status characters - and upon that make my channel feedback....?
Regards
Brian Andersen
I got feedback strings from Lutron to my Netlinx controller - reporting about keypads LED status.
These status feedbacks, I would like to translate to channel feedback - to my 8400i panel.
The strings look like this:
KLS, [01:05:XX], YYYYYYYYYYYYYYYYYYYYYYY
"XX" are the adress of the keypad, and YYYYYYYYYYYYYYYYYYYYYYY are LED stauts (1 or 0)
Now I need to channel react (TP2,821 = 1) if keypad adress 40 - LED number 1 is ON
(KLS, [01:05:40], 100000000000000000000)
How do I pick out adress 40 - and then sniff out LED status characters - and upon that make my channel feedback....?
Regards
Brian Andersen
0
Comments
You might want to do some searching using the keywords "parsing". There are several ways to accomplish what you're doing. This thread: http://www.amxforums.com/showthread.php?4406-how-do-you-use-IP_CLIENT_OPEN-to-get-info-from-a-website has some pretty good info stuffed in there somewhere about parsing.
-John
Brian,
a couple things...
firstly, a simple way to do this is create a cell-by-cell conditional (something like a quick for loop will do) and examine each digit.
But, secondly..
The AMX Lutron module that's been around since dinosaurs roamed the earth works very well and will do a lot of this heavy lifting for you.
So, I'd not try and reinvent the wheel unless you're just bursting with curiosity and plenty of time to play around.
IMHO..
e
Assuming you don't care about the processor or link you can do this which is about as simple a way to do it as possible. No loops or structure but it will require alot of lines of code.
Note: the "atoi" function will ignore the non numeric ascii characters and covert only the ascii "40" to and interger.
It won't work at all if he does that :P