Remote Screen for AC3 (WIN/MAC/*NIX) ::WIP::

So when you telnet to port 8766 on 127.0.0.1 - you get the ACjr login ? is there even a login on the JR ?

what happens when you issue a 'c' commend? can you please provide a screenshot, or copy & paste in a "[ code ] [ / code ]" (minus the spaces)

If you get output like some of us have posted here, do the following .. to test it out:


go & download the free trial of Macro Scheduler
-> http://www.mjtnet.com/dldfile.htm?file=f1&name=Macro Scheduler Std

Download & install, give me a minute & let me change the port in the script.
 
here is Joe's script - i changed the telnet port# from 23 (default) to 8766 as you specified.


Code:
'Set up Variables

Let>WDIR=SCRIPT_DIR
'Let>WDIR=C:\test
Let>ErrMsg=Error Unknown

Let>log=%WDIR%\ACGD.log
Let>ACini=%WDIR%\ACGD.ini
Let>LCDini=%WDIR%\ACtank.txt
Del>%log%
GetDate>date
GetTime>time
WriteLn>%log%,result,%date% %Time% ***log file started***
IfFileExists>%ACini%
  GetTime>time
  WriteLn>%log%,result,%date% %Time% ini file found.
  goto>Start
Else
Let>ErrMsg=ini file does not exist
Goto>ErrorOut
Endif
Label>Start

Let>k=0
Let>N=1
ReadIniFile>%ACini%,CONFIG,AC,AC
ReadIniFile>%ACini%,CONFIG,NAME,ID
ReadIniFile>%ACini%,CONFIG,PASS,PS
ReadIniFile>%ACini%,CONFIG,ALARM,AL
ReadIniFile>%ACini%,CONFIG,PX1000,PXN

'Telnet to Aquacontroller
Label>TelnetAC
TelnetConnect>%AC%,8766,hTN
If>HTN=0
 If>N=2
  GetTime>time
  WriteLn>%log%,result,%date% %Time% Unable to attach to AC at IP %AC%
  goto>ErrorOut
 Else
  Let>N=N+1
  Wait>5
  Goto>TelnetAC
 Endif
endif
GetTime>time
WriteLn>%log%,result,%date% %Time% Logging into AC at IP %AC%
TelnetWaitFor>hTN,login:,5,r
TelnetSend>hTN,%ID%%CR%
TelnetWaitFor>hTN,password:,5,r
TelnetSend>hTN,%PS%%CR%
TelnetWaitFor>hTN,AquaController>,5,r
If>r=TIMEOUT
  Let>ErrMsg=Username or password not accepted. Aborting.
  goto>ErrorOut
Endif
GetTime>time
WriteLn>%log%,result,%date% %time% Successfully logged into AquaController.
GetTime>time
WriteLn>%log%,result,%date% %time% Polling AquaController.
TelnetSend>hTN,c%CR%
TelnetWaitFor>hTN,AquaController>,5,r
GetTime>time
WriteLn>%log%,result,%date% %time% Successfully Polled AquaController.
TelnetClose>hTN
GetTime>time
WriteLn>%log%,result,%date% %time% Successfully terminated connection to Aquacontroller.
//END TELNET TO ac3

Label>CheckIt
//CHECK FILE FOR DATA
GetTime>time
WriteLn>%log%,result,%date% %time% Checking AC data for consistancy.
Length>r,ln
if>ln<50
Let>ErrMsg=Data Failed Consitancy check
Goto>ErrorOut
endif
//END CHECK

//START GET STATS
Let>lx=7
GetTime>time
WriteLn>%log%,result,%date% %time% Parsing data
Separate>r,CR,Lines
Let>ln=Lines_%lx%
Separate>ln, ,vl

Let>T=vl_1
Let>H=vl_2
Let>O=vl_3

Length>vl_5,ln
if>ln<2
  Let>C=--.-
 else
  Let>C=vl_5
endif
//END GET STATS

//GET PX1000 DATA
If>PXN>0
 goto>FPX1000
else
 goto>FALRM
endif

Label>FPX1000
Let>PXNUM=1
Label>FindV
Let>lx=lx+2
Separate>r,CR,Lines
Let>ln=Lines_%lx%
Separate>ln, ,vl
Let>vllast=vl_Count-1
Let>vln=1
Label>BreakOut1
Length>vl_%vln%,ln
if>ln<2
  If>vln=1
   GetTime>time
   WriteLn>%log%,result,%date% %time% PX1000 value set wrong, please lower.
   goto>FALRM
  EndIf
  Let>S=---
  EditIniFile>%LCDIni%,PX1000,PX%PXNUM%_%vln%,%S%
 else
  Let>S=vl_%vln%
  EditIniFile>%LCDIni%,PX1000,PX%PXNUM%_%vln%,%S%
endif

If>vln=vllast
 If>PXNUM=PXN
  goto>FALRM
 else
  Let>PXNUM=PXNUM+1
  goto>FindV
 Endif
Else
Let>vln=vln+1
goto>BreakOut1
EndIf



//END GET PX1000 DATA

//FIND ALARM VALUE
Label>FALRM
Position>%AL%,%r%,1,x
Let>X=X+7
MidStr>%r%,%X%,2,S
If>S=ON
 Let>S=ALARM
EndIf
If>S=OF
 Let>S=NORMAL
EndIf
//END FIND ALARM VALUE

GetTime>time
WriteLn>%log%,result,%date% %time% Finished Parsing data. Writing results.

//WRITE RESULTS
EditIniFile>%LCDIni%,READINGS,STAT,%S%
EditIniFile>%LCDIni%,READINGS,TEMP,%T%
EditIniFile>%LCDIni%,READINGS,PH,%H%
EditIniFile>%LCDIni%,READINGS,ORP,%O%
EditIniFile>%LCDIni%,READINGS,COND,%C%
//END WRITE RESULTS


Goto>Fin

Label>ErrorOut
WriteLn>%log%,result,%date% %Time% %ErrMsg%.
//WRITE RESULTS
EditIniFile>%LCDIni%,READINGS,STAT,OFFLINE
EditIniFile>%LCDIni%,READINGS,TEMP,-.--
EditIniFile>%LCDIni%,READINGS,PH,-.-
EditIniFile>%LCDIni%,READINGS,ORP,-.-
//END WRITE RESULTS

Label>Fin
GetTime>time
WriteLn>%log%,result,%date% %time% ***Log file closed***
 
I've not had good luck with software based com->IP programs. Which is why I shy away from them. Of course, I can't remember what program I used, so that one might work fine.

If there is a need to use alternate ports for telnet it's not a big deal to just add a Port section to the ini file and use that, rather than hard coding it.

Note about the code. I don;lt have a problem with people using it, or making modifications. I would ask two things. 1) do not charge any money for it. 2) If you make modifications or improvements please share.

Also, regardless of what it looks like. I am not a programmer at all. So there are probably many ways to do the same thing better. This way just works for the way I do things at my house.

So if anything doesn't make sense, please ask and I will tell you why I chose to do it a certain way.
 
Joe
I am still trying to work with the HTML file. I am able to load it ,to get the "full match" on the screen but i cannot bypass the "<HTML><HEAD><TITLE>401 Unauthorized</TITLE></HEAD><BODY>401 Unauthorized</BODY></HTML> I set up like in the Yahoo Widgets.
Can you please let me know how to get it? Thanks
 
Joe
I am still trying to work with the HTML file. I am able to load it ,to get the "full match" on the screen but i cannot bypass the "-HTMLâ€"HEADâ€"TITLE-401 Unauthorizedâ€"TITLE---HEADâ€"BODY-401 Unauthorizedâ€"BODY---HTML- I set up like in the Yahoo Widgets.
Can you please let me know how to get it? Thanks
 
Joe,

as far as CrystlaControl2 reading from the file, is the
Code:
[PX1000]
line in the ACTank.txt causing the issue?

Could we just take out the
Code:
[PX1000]
line from the file ?
 
Joe,

2 more questions.


1. What is the "COND" refer to in the ACTank.txt? mine displays --.-
2. How do you have the MAINTENANCE setup? I have a breakout box, and plan on puttinga flip switch that will cause a timer name "MAI" - when timer is on, skimmer, skimmer feed, return, CA RX, CO2, CHiller will all be off until i reset the switch.
 
<a href=showthread.php?s=&postid=10901281#post10901281 target=_blank>Originally posted</a> by elahav
Joe
I am still trying to work with the HTML file. I am able to load it ,to get the "full match" on the screen but i cannot bypass the "-HTMLâ€"HEADâ€"TITLE-401 Unauthorizedâ€"TITLE---HEADâ€"BODY-401 Unauthorizedâ€"BODY---HTML- I set up like in the Yahoo Widgets.
Can you please let me know how to get it? Thanks

You need to be able to handle a login and a redirect from the controller. I will see if I have my old syntax from the CURL script I used to use.
 
<a href=showthread.php?s=&postid=10901285#post10901285 target=_blank>Originally posted</a> by wizsmaster
Joe,

as far as CrystlaControl2 reading from the file, is the
Code:
[PX1000]
line in the ACTank.txt causing the issue?

Could we just take out the
Code:
[PX1000]
line from the file ?

The code I use only works for the first section of an ini file. If we split up the PX1000 to be in a seperate file then it would work too. I'd rather find how to read different sections of the ini file. You could always make the change yourself with the code you have.
 
Joe,

have you posted over @ the CrystalControl forum? If not, i was thinking of posting the question up over there.
 
<a href=showthread.php?s=&postid=10901345#post10901345 target=_blank>Originally posted</a> by JB NY
You need to be able to handle a login and a redirect from the controller. I will see if I have my old syntax from the CURL script I used to use.

Download curl

http://curl.haxx.se/


Here is the syntax to have curl save the html page to a file. change the username/password and IP addy for you controller. It should save a file called aqhtml.txt with the contents of the AC web page.

Code:
curl -o aqhtml.txt -u admin:1234 [url]http://192.168.0.0/cgi-bin/status.cgi[/url]
 
<a href=showthread.php?s=&postid=10901285#post10901285 target=_blank>Originally posted</a> by wizsmaster
Joe,

as far as CrystlaControl2 reading from the file, is the
Code:
[PX1000]
line in the ACTank.txt causing the issue?

Could we just take out the
Code:
[PX1000]
line from the file ?

OK I got it to work with your ini file.

try this

(?<=[\r\n])([^=\r\n]+)=([^\r\n]*)

Then change the value of the match number. I was able to selectively choose all the values in the ini file using numbers 1-7.
 
awesome. thank you. I will have to wait till tonight to make it work .. my VPN link to home is not functioning again ... I can access from home to office, but not office to home. :-(
 
<a href=showthread.php?s=&postid=10901183#post10901183 target=_blank>Originally posted</a> by JB NY

So if anything doesn't make sense, please ask and I will tell you why I chose to do it a certain way.

Code:
Position>%AL%,%r%,1,x
Let>X=X+7
MidStr>%r%,%X%,2,S

Joe,

How do you determine the position, and the midstring? I'm trying to not have to ask you for everything, but don't quiet get how this program works.
I'm a network guy.

Thanks,

marco
 
<a href=showthread.php?s=&postid=10913907#post10913907 target=_blank>Originally posted</a> by wizsmaster
Code:
Position>%AL%,%r%,1,x
Let>X=X+7
MidStr>%r%,%X%,2,S

Joe,

How do you determine the position, and the midstring? I'm trying to not have to ask you for everything, but don't quiet get how this program works.
I'm a network guy.

Thanks,

marco

I was a Network Guy too, that's no excuse! :D

Check the help file it explains those two commands fully
Postion just finds the postion of the alarm timer in the string variable.

Midstr just take the starts at point in the string and pulls out however many character you tell it to.

So all I'm doing is finding the alarm timer, moving over 7 spaces and finding out what the next two characters are. Those characters will either be ON or OF. So that's how it knows if the alarm is on or off.
 
Back
Top