COCO Commandline Interface (CLi) for TPC-200/300

Forum about Click On Click Off (KAKU), Home Easy and related hardware.
Post Reply
Phoenix
Starting Member
Starting Member
Posts: 48
Joined: Sun Apr 28, 2013 9:40 pm
Location: Netherlands (Deventer)
Contact:

COCO Commandline Interface (CLi) for TPC-200/300

Post by Phoenix »

Hello people,

I have put together a program for switching from the command line of click to click off (COCO) products with both TPC-200 and TPC-300, thus you can use your own programs (eg. Excel, PHPScript or Homeseer) and use a "shell" command to turn COCO stuff on or off without additional DLL knowledge needed :D

Image

Update SEP 2012 # 1
A PHP script to put on your web server, so you can switch COCO stuff anywhere in the world via a simple PHP script. The script is nothing more or less than a parameterportal to KAKUcli, only now operates over the internet, and can therefore be used on a PAD, tablet or mobile phone.

Update SEP 2012 # 2
New version added: KAKUcli v1.1ng (NO GUI), it is faster to turn, need to load, no GUI and CRC32 check works with message boxes!

DOWNLOAD (SOFTWARE=DUTCH!):
http://domoticx.nl/klikaanklikuit-tpc-2 ... interface/

* Tested and working on:
- Windows XP 32-bit
- Windows Vista 32/64-bit
- Windows 7 32/64-bit

- Does not work on Windows 95/98/ME due to unicode compile.
- Does not work on Windows Server 2000 (crash)

Using this program is as follows:
KAKUcli.exe [channel] [action] [option]

Used over the Internet is as follows (example):

Code: Select all

http://www.website.nl/schakelen.php?kanaal=100&actie=17&optie=0
When used with the PHP script:
Place the PHP file in your web directory and make sure that KAKUcli and DLL files in the same directory are:

[Channel] = A1 / m P16 (code discs) / 1 t/m 256 (automatic code system)
[Action] = 17 or (enable) / off or 0 (off) / 1 t/m 16 (dimming automatic code system)
[Option] = tpc200 (forces the use of the TPC-200 as well as the TPC-300 is connected to the same system, this option only works with code discs recipients)

EXAMPLES:
KAKUcli.exe c7 aan> switch a code slices receiver on channel c7 on.
KAKUcli.exe k13 0> switches a code slices receiver on channel k13 off.
KAKUcli.exe 25 17> switch an automatic code system receiver channel 25 on.
KAKUcli.exe 63 uit> switch an automatic code system receiver channel 63 off.
KAKUcli.exe 215 11> switch an automatic code system receiver channel 215 on in dimming mode 11.

Via the Internet (examples):
kanaal=c7&actie=aan> switch a code slices receiver on channel c7 on.
kanaal=k13&actie=0> switches a code slices receiver on channel k13 off.
kanaal=25&actie=17> switch an automatic code system receiver channel 25 on.
kanaal=63&actie=uit> switch an automatic code system receiver channel 63 off.
kanaal=215&actie=11> switch an automatic code system receiver channel 215 on in dimming mode 11.

NOTES:
* This program works with both the TPC-200 and the TPC-300, this also needs the supplied DLL
files TPC200L10.dll & TPC300A.dll, they belong to stand with "KAKUcli.exe in the same folder.
* If both devices are connected and using the code slices command, the TPC-300 as
be accessed first, if the 'tpc200' option is given, only the TPC-200 approached.
* To program an automatic code system receiver converts the receiver optionally partly in
learning mode and enter an "on" command to the receiver to learn this channel.
* The dimmer function only works on receivers that support it, stop and this
the separate manual.
* The TPC-200 can NOT dimming functions and automatic code control system receivers!
* For contact, reporting bugs or improvement ideas etc. please send an email to the following address:
KAKUcli by Sebastiaan Ebeltjes (phoenixinteractive@hotmail.com)

DISCLAIMER:
* The use of this program is at your own risk, the author is not responsible
for any damage to COCO devices and computer by using this program!
* COCO has nothing to do with 'KAKUcli.exe' and will not accept any responsibility.
* The COCO logo is and remains the property of http://www.klikaanklikuit.nl

PHP SCRIPT 'schakelen.php'

Code: Select all

<?php
//Info: PHP schakelscript v1.0.0.0 voor KAKUcli
//Datum: 2012-09-15
//Door: Sebastiaan Ebeltjes
//Voorbeeld: http://www.website.nl/schakelen.php?kanaal=100&actie=17&optie=0

$kanaal = $actie = $optie = 0;
if(isset($_GET['kanaal'])) $kanaal = $_GET['kanaal'];
if(isset($_GET['actie'])) $actie = $_GET['actie'];
if(isset($_GET['optie'])) $optie = $_GET['optie'];
 
if(!file_exists("KAKUcli.exe")) {
die("ERROR1: Het bestand KAKUcli.exe is niet gevonden!");
}
 
if(!file_exists("TPC200L10.dll")) {
die("ERROR2: Het bestand TPC200L10.dll is niet gevonden!");
}
 
if(!file_exists("TPC300A.dll")) {
die("ERROR3: Het bestand TPC300A.dll is niet gevonden!");
}
 
if(checkArrayForEmpty(Array($kanaal, $actie))) {
die("ERROR4: Een belangrijke parameter is niet opgegeven!");
}
 
exec("KAKUcli.exe ".$kanaal." ".$actie." ".$optie);
print("KAKUcli.exe ".$kanaal." ".$actie." ".$optie." uitgevoerd!");
 
function checkArrayForEmpty($array) {
                foreach($array AS $value) {
                               if(!$value) {
                                               return 1;
                               }
                }
                return 0;
}
?>
SAMPLE SCRIPT "buttons / JAVA"

Code: Select all

<html>
<head>
<script language="javascript">
 if(window.XMLHttpRequest)
 {
 var MyHttpRequest = new XMLHttpRequest();
 }
 else
 {
 var MyHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
 }
 function loadKeukenAan()
 { 
 MyHttpRequest.open('POST', 'schakelen.php?kanaal=105&actie=aan&optie=0');
 MyHttpRequest.send(null);
 }

 function loadKeukenUit()
 { 
 MyHttpRequest.open('POST', 'schakelen.php?kanaal=105&actie=uit&optie=0');
 MyHttpRequest.send(null);
 }
 </script>
</head>
<title>KAKU</title>
<a href="javascript:void(loadKeukenAan());">Keuken Aan</a>
<a href="javascript:void(loadKeukenUit());">Keuken Uit</a>
</html>
Have fun with it!, Any feedback is welcome!

Regards,
Sebastiaan

@Tweakers.net: http://gathering.tweakers.net/forum/lis ... es/1464592
Huisautomatisering - Domotica - Elektronica - IT consulting - Software ontwikkeling - 3D printing - Maatwerk
Website: domoticx.nl / Webshop: domoticx.nl/webwinkel / Knowledge Center: http://domoticx.com
Post Reply

Return to “Click On Click Off & Home Easy”