Author Topic: TCP Plugin  (Read 30281 times)

0 Members and 1 Guest are viewing this topic.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
TCP Plugin
« on: May 04, 2013, 10:46:54 AM »
This plugin will open up a whole new world of possibilities.  With it you can control IP enabled devices such as GlobalCache products, network amps and TVs etc.

You can also use it to create a TCP or HTTP server which can be used to send commands to VoxCommando.  Until now this was only really possible with UDP.

the plugin works well in my testing but be advised that it may undergo some design changes as we move forward, which means that future updates of the plugin may break your commands that use TCP plugin actions.

Unzip the TCP folder into your VoxCommando\plugins folder so that you have 2 files as follows:

[Attachments deleted. The TCP plugin and actions now come standard in VC. Any updates to the plugin will be included in each new release.]

« Last Edit: October 14, 2014, 04:24:09 PM by nime5ter »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: TCP Plugin
« Reply #1 on: May 04, 2013, 10:47:11 AM »
reserved for sample and/or info

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: TCP Plugin
« Reply #2 on: May 04, 2013, 12:57:44 PM »
Here is the simplest command example I can show you, that uses the iTach to lower the volume on my Sceptre LCD TV:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="620" name="sceptre vol down" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>TCP.Single.WriteLn</cmdType>
    <cmdString>sendir,1:3,1,39808,2,1,96,24,48,24,48,24,24,24,24,24,48,24,24,24,24,24,48,24,24,24,24,24,24,24,24,3980&amp;&amp;192.168.0.134&amp;&amp;4998</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>sceptre vol down</phrase>
</command>

This command uses the TCP.Single.WriteLn action which opens a connection, sends the data, appends a carriage return, and then closes the connection.

There are other methods that may be preferable that keep a connection open and can get feedback from the device...

Mace

  • $upporter
  • Contributor
  • *****
  • Posts: 77
  • Karma: 1
    • View Profile
Re: TCP Plugin
« Reply #3 on: May 04, 2013, 02:19:09 PM »
Awesome!

Testing as soon as I finish work.

Mace

  • $upporter
  • Contributor
  • *****
  • Posts: 77
  • Karma: 1
    • View Profile
Re: TCP Plugin
« Reply #4 on: May 04, 2013, 06:54:33 PM »
Initial testing on TCP Single Write and WriteLn, works beautifully.

Note:
Building a payload XML Value,Phase is a great way to load all Ir Code's.
After that Place payload 1 {1} in the command parameter for TCP.Single.Write or TCP.Single.WriteLn then say the phrase and watch the magic.

Excellent work Mr jitterjames.

Future additions:
Somehow listen for received information and display as an event eg:    completeir,1:1,1.

Reference for building payload XML:  http://www.youtube.com/watch?v=lPyfxpXRr9Q
« Last Edit: May 04, 2013, 09:15:19 PM by Mace »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: TCP Plugin
« Reply #5 on: May 04, 2013, 10:14:45 PM »
Good job.  OK I'll talk about the received event tomorrow. 

I'm not sure how useful it would be in this situation but it's still a good exercise to see how to do it.

;D

Mace

  • $upporter
  • Contributor
  • *****
  • Posts: 77
  • Karma: 1
    • View Profile
Re: TCP Plugin
« Reply #6 on: May 05, 2013, 09:45:25 AM »
Is there a way to have a say a XML of all codes for a device:
Amplifier.xml
Projector.xml
Dvdplayer.xml

Then use them in different commands.
For example:
I know one command can access the XML via 2 phrases as normal with the TCP plugin:
command: Amplifier Controlls
Macro phase "Amplifier"
Payload xml phase "Power On"
= "Amplifier Power On" = Turns amplifier on.

What I'd like is a command that runs multiple payloads from a single phase:
Command: Movies
Macro phase: "Watch DvD"
# part I'm missing
Result: send 'power on' code from Amplifier.xml + ''power on' from Projector.xml  + ''power on' from Dvdplayer.xml

I know I can turn multiple things on by putting the actual IR code in the  TCP.Single.Write parameter.
But if I have 6 devices and setup multiple combinations for the devices it's too easy to loose track of commands. If I was to change a device it would take forever to update all the codes.
Much easier to use one XML file then a single code change can populate throughout the program.

Any ideas how I can achieve this?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: TCP Plugin
« Reply #7 on: May 05, 2013, 10:51:12 AM »
Hi Mace,

I'm a bit confused by some of the terminology you are using.  You keep using the word "phase".  Do you mean "phrase"?

What is a "macro phase", or "macro phrase"?

Quote
What I'd like is a command that runs multiple payloads from a single phase:

This doesn't really make much sense to me, in that if it were possible, it would not really be a payload anymore.  I think what you want is a way to maintain a dictionary of key-value pairs so that you can, look up the value of a key at any time.  There is no direct support for this in VoxCommando at this point.  There are of course ways to go about it though.  No matter how you do it, you will need to make sure that you key is spelled correctly or it won't work.

One possible method would be to use python.  If you do that, pretty much anything is possible.  You could create a dictionary of all your codes and then pull out the value of a given key.  This value could then be sent to the iTach somehow.

I am thinking about ways to integrate this concept into VoxCommando in the most flexible way possible, so that it can be applied to as many scenarios as possible.  It is coming, but it will take some time for me to get around to it, figure out the best way, and actually implement and test it.  I already have many tasks of varying complexity that need attention.

« Last Edit: May 05, 2013, 11:30:45 AM by jitterjames »

Mace

  • $upporter
  • Contributor
  • *****
  • Posts: 77
  • Karma: 1
    • View Profile
Re: TCP Plugin
« Reply #8 on: May 05, 2013, 12:11:39 PM »
Yes sorry phrase.

And yes you hit the nail on the head with dictionary, exactly what I was thinking.

Macro I'm thinking of with EG. Need to learn VC terminology more. lol

Naturally to implement this ability is big job, specially to offer maximum versatility and funcunality.
Add it to the list.

In the mean time ill play with Python for the complex stuff and if I have some success ill post up for everyone.
Thanks for the great response.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: TCP Plugin
« Reply #9 on: May 05, 2013, 12:24:32 PM »
I'm working on something in Python now that should get you started.  Stay tuned.

Mace

  • $upporter
  • Contributor
  • *****
  • Posts: 77
  • Karma: 1
    • View Profile
Re: TCP Plugin
« Reply #10 on: May 05, 2013, 12:27:39 PM »
Sweet!
Just made my day.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: TCP Plugin
« Reply #11 on: May 05, 2013, 12:44:18 PM »

Crunchie

  • $upporter
  • Jr. Member
  • *****
  • Posts: 33
  • Karma: 0
    • View Profile
Re: TCP Plugin
« Reply #12 on: September 13, 2013, 01:48:47 PM »
Good morning,

I have a lighting controller that is able to accept telnet commands over port 23 on Ethernet. Here is an excerpt from the published integrations protocol for third party integration:


Single Ethernet Port
• IEEER 802.3 Auto-Sensing 10BaseT / 100BaseTX
• Supports MDI/MDIX auto-crossover (no crossover cable needed).
• F emale 8P8C “Computer RJ-45” socket
• Green "Connect" LED, Amber "Activity" LED
• Use Cat 5 cabling or better
TCP / IP Settings
• DHCP (dynamic) or static configuration <factory default = DHCP>
• IP Address: <static default = 192.168.1.50 or dynamic configuration>
• Subnet Mask: < static default = 255.255.255.0 or dynamic configuration >
• Gateway: <static default = 0.0.0.0 or dynamic configuration>


Protocols Used for Integration
• TELNET
Telnet Server
• Up to 4 telnet sessions can be had simultaneously
• Used by software and/or third party equipment (i.e. touch screen)
• Limited to transferring ASCII characters
• Telnet Port number is 23, can be changed using the software
• Login: admin
• Password: integration
Notes:
-Only one connection per login / password is allowed at a time.


The system allows for control and monitoring of status of devices such as dimmers, switches, time clocks, keypads etc.

here is a snap shot of an example Device Command structure:

https://www.dropbox.com/s/ldfnddbf6lldnuw/Example%20Device%20Commands.jpg

Please let me know if I understand the capabilties of the TCP plugin.... it seems to me that this could work, but I am not sure.

Appreciate any input whatseover.

thanks.



« Last Edit: September 13, 2013, 02:15:53 PM by lootrondealer »

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: TCP Plugin
« Reply #13 on: September 13, 2013, 03:40:11 PM »
As James will be less available over the next few days, I'll just say that the answer--from what I understand--is that thus far we don't know of anyone who's tried using the TCP plugin to pass telnet data, but that doesn't mean one can't.

Until James has time to look into this himself, one suggestion would be that you install the plugin and try to create some basic commands for your device, since the only cost is time. :)

If you haven't found it yet, here is the documentation on the plugin: http://voxcommando.com/mediawiki/index.php?title=Plugin_TCP

As people here will no doubt confirm, James is generally very open to improving his software, so if you can't get the plugin to work out of the box, he will likely be willing to update the plugin to overcome the problem.

(Full disclosure: I'm his wife and we just had a quick exchange in which he asked me to convey the message, "You can tell him it might work, but if not I'd be willing to try to make it possible.")

TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Crunchie

  • $upporter
  • Jr. Member
  • *****
  • Posts: 33
  • Karma: 0
    • View Profile
Re: TCP Plugin
« Reply #14 on: September 13, 2013, 03:56:13 PM »
Thanks! I have to install the system in question to test it so will do so this weekend. It is a scalable system so i can start by simply installing a couple of devices and getting the main brain onto my network set up with a static IP address...

I will let you know by Monday if I have had any success and if so to what degree.

Have a great weekend.


L.
« Last Edit: December 21, 2014, 06:18:04 PM by nime5ter »