TPI help please: netcat + bash script + tasker oh my!

Information and support for EnvisaLink modules.

Moderators: EyezOnRich, GrandWizard

Post Reply
SimCom
Posts: 2
Joined: Thu May 01, 2014 2:11 pm

TPI help please: netcat + bash script + tasker oh my!

Post by SimCom »

Ok, I wanted to post for help here since this isn't really a question about the TPI documentation, as it is a plea for help on understanding it (Please forgive my ignorance). I've been working in the IT industry for most of my life (professional and non-professional) but programming has never been my forte, so I have a few questions, or maybe I can state what I'm trying to do and someone can help me. (FYI, I just installed a DSC system)

Basically, what I'm wanting to do is, on my phone, tasker (a wonderful automation utility for android phones) will fire up an SSH session to my home computer (using a widget or a shortcut or automatically) run a script and using netcat, login, get status information/arm system/disarm/etc, then capture the output into a variable, split that variable until I get the info I need then update a widget/icon on my phone depending on what the status is.

I have managed to get login and system status working (001), but only by using another android app and doing packet captures from the device to the envisalink to see what the checksums are for the commands I need to run)

for example, here is my script for linux:

Code: Select all

#!/bin/bash
sleep 1
echo -e -n '005password+checksum\r\n'
sleep 1
echo -e -n '00191\r\n'
and my command line is

Code: Select all

./test.sh | nc IPADDRESS 4025
I've found that works great for getting status, problem is, I'm having difficulty understanding the command syntax, specifically, the checksums. I don't quite understand how those are calculated. Looking at the example in the documentation, I don't quite understand the formula. Under 3.1 on the documentation, it says 36 + 35 + 34 +33 = D2 (or 44 32 in ascii), and I can look at the ASCII table and see that 44=D. I can even understand why the command 001 has a checksum of 91 ( ascii codes 30 30 31=91) If someone could give me an example on how to get that info, or is there something I'm missing? I'm assuming it has to do with the "nibble" thing, but I'm not sure how to do the conversion, even after googling a "nibble"
GrandWizard
Posts: 2375
Joined: Tue Nov 16, 2010 4:08 pm

Re: TPI help please: netcat + bash script + tasker oh my!

Post by GrandWizard »

The numbers are in HEX, not decimal. Maybe that is what you're missing.

30 + 30 + 31 = 91 in both decimal and HEX. but

30 + 30 + 31 + 10 = A1 in HEX, but 101 in decimal.
SimCom
Posts: 2
Joined: Thu May 01, 2014 2:11 pm

Re: TPI help please: netcat + bash script + tasker oh my!

Post by SimCom »

Thank you for the response, it took a while, but it finally hit me. I was trying to add up the ASCII hex THEN convert the decimal into hex (ie. 101 = 65 in hex). Instead now, I use an actual hex calculator that gives me the correct results :) Now I know why I didn't go into programming :D
Post Reply