View unanswered posts | View active topics It is currently Sun May 19, 2013 5:10 pm



Reply to topic  [ 60 posts ]  Go to page: 1, 2, 3, 4  Next
 Cynical Network: Make (IP) network connections from Indigo 
Author Message

Joined: Apr 07, 2008
Posts: 355
Post Cynical Network: Make (IP) network connections from Indigo
I have written a plugin that lets Indigo make and receive TCP/IP connections and have text conversations over them. Each prospective connection is a separate device. You manage the connection and send text to it using plugin actions. Incoming text is matched against regular expressions defined in plugin events, and pre-planned conversations can be fashioned by strategically enabling and disabling those triggers.

Requires: A Mac with Indigo 5, and something on the network to talk to. :-)

I hope this is a very straight-forward plugin, and easy to use. Download from http://www.cynic.org/indigo/plugins. Use the "About..." menu item for a (preliminary) help page. Let me know if you have any questions.

Cheers
-- perry


Sat Oct 15, 2011 5:54 pm
Profile
Site Admin
User avatar

Joined: Jan 27, 2003
Posts: 11682
Location: Texas
Post Re: Cynical Network: Make (IP) network connections from Indi
Cool. Just tried it out with telnet and it worked.

Are you using this plugin to communicate with networked hardware or web services somehow? I'd like to hear examples of how you (or others) are using this.

_________________
Image


Tue Oct 18, 2011 11:20 am
Profile WWW

Joined: Apr 07, 2008
Posts: 355
Post Re: Cynical Network: Make (IP) network connections from Indi
Are you using this plugin to communicate with networked hardware or web services somehow? I'd like to hear examples of how you (or others) are using this.


For one, a serial port attached to a network server typically shows up as a network port on that server. So you can use a TCP Out device to talk to arbitrary serial hardware behind a GC-100 or iTach box. That will have to do until we find a way to integrate network serial ports.

I'm thinking of Cynical Network primarily as a prototyping tool and tool of last resort, when there's some network-attached device that it's not worth while writing a dedicated plugin for.

From my point of view, the cool part of this isn't the networking as such (it's trivial); it's the way it uses Indigo triggers with regular expressions to parse incoming messages. That could be easily extended to (genuine) serial ports...

Cheers
-- perry


Tue Oct 18, 2011 10:05 pm
Profile

Joined: Nov 20, 2009
Posts: 182
Location: Houston
Post Re: Cynical Network: Make (IP) network connections from Indi
So, is this maybe like the basis (or just a testing tool) for writing a plugin for IP control.

I have a NuVo Grand Concerto that I control with some AppleScript stuff and a serial port, but it's hooked up to the house network, and IP control would be awesome.

(Note: I know NOTHING about IP control, but then I used to know nothing about serial control and Applescript and got that little gizmo running...)

Also, I don't even know if NuVo publishes their IP protocol... All pie in the sky stuff here so far. I'm just excited to see that maybe I'll be able to write myself a nice specific plugin for managing announcements in the house.

_________________
http://nerdhome.jimdo.com


Fri Oct 21, 2011 11:29 am
Profile WWW

Joined: Apr 07, 2008
Posts: 355
Post Re: Cynical Network: Make (IP) network connections from Indi
I have a NuVo Grand Concerto that I control with some AppleScript stuff and a serial port, but it's hooked up to the house network, and IP control would be awesome.

If you can find documentation on the IP protocol, we can probably figure something out. Most of the time, the "IP protocol" of these boxes is just their serial protocol bridged onto a network port. But to discover the network address without documentation is not novice work.

One alternative is of course to buy/beg/borrow a GC-100-6 or iTach-Serial device (they're about $150 or so), plug your NuVo's serial port into that, and use Cynical Network to talk to it - no AppleScript required, and the serial protocol seems well documented on the Net. I can always use another beta tester. :-)

Cheers
-- perry


Tue Oct 25, 2011 9:42 pm
Profile

Joined: Nov 20, 2009
Posts: 182
Location: Houston
Post Re: Cynical Network: Make (IP) network connections from Indi
Well, I pinged NuVo support, and they basically said that they don't share their protocol for IP control.

(Not that it matters, but the main NuVo controller is not actually IP controllable. Serial Only. BUT it connects to their 'music port' which IS IP controllable (i.e. there's an iPhone app that can talk to the music port, and then controls zone info etc on the main controller)

_________________
http://nerdhome.jimdo.com


Wed Oct 26, 2011 7:03 am
Profile WWW
User avatar

Joined: Nov 18, 2008
Posts: 1720
Location: Berkeley, CA
Post Re: Cynical Network: Make (IP) network connections from Indi
Great contribution. But, could you provide a couple of examples of how to use the input received in an embedded script (AppleScript and Python).

A good example would be to just write the input into the log.

Thanks.


Wed Oct 26, 2011 9:17 pm
Profile

Joined: Apr 07, 2008
Posts: 355
Post Re: Cynical Network: Make (IP) network connections from Indi
Great contribution. But, could you provide a couple of examples of how to use the input received in an embedded script (AppleScript and Python).

A good example would be to just write the input into the log.


Sure. Create a TCP In device for port 5555. Fill in the Last line read field to read Fooby. You'll see the device's state is now listening - it's waiting for an incoming connection. Open Indigo's variables window and put it where you can see it.

Open Terminal and type telnet localhost 5555. That will connect to the device you just created, and its state will change to connected.

Type some words into telnet and hit return. Cynical Network reads the line and puts it into the Indigo variable Fooby, as you can see. Type some more; Fooby always contains the last full line read.

Now add a Trigger for the unrecognized input plugin event. Point it at the device you created earlier. Give it an embedded Python script action. The script is
Code: Select all
the_line = indigo.variables["Fooby"].value
indigo.server.log("The line is " + the_line)

Type something more into telnet and watch it work. There's nothing special about the script, of course - you're just picking up an Indigo variable and using it.

Now add another action to the trigger. This time, pick the plugin action send text. Pick the TCP In device and add some text. Type another line into telnet; this time the trigger talks back to you!

That's really it. If you haven't yet, select the "About Cynical Network" menu item in the Plugins menu and read all about it...

Cheers
-- perry


Wed Oct 26, 2011 10:45 pm
Profile
User avatar

Joined: Nov 18, 2008
Posts: 1720
Location: Berkeley, CA
Post Re: Cynical Network: Make (IP) network connections from Indi
Perry, thanks for the fast response. I haven't tried TCPin, but I did try TCPout, to my alarm interface which streams \n deliminated messages. I was unable to display any of that data, including into a variable. any ideas?


Wed Oct 26, 2011 11:10 pm
Profile

Joined: Apr 07, 2008
Posts: 355
Post Re: Cynical Network: Make (IP) network connections from Indi
Perry, thanks for the fast response. I haven't tried TCPin, but I did try TCPout, to my alarm interface which streams \n deliminated messages. I was unable to display any of that data, including into a variable. any ideas?


Does the state of the device actually read connected? In order to complete an outgoing connection, you either need to execute a connect action on the device, or else check the persist checkbox (which continuously tries to connect until you turn it off). If you do neither, it will just passively sit there (the state will be idle).

If you have any trouble, be sure to turn on verbose logging in the plugin preferences.

Cheers
-- perry


Thu Oct 27, 2011 12:08 am
Profile
User avatar

Joined: Nov 18, 2008
Posts: 1720
Location: Berkeley, CA
Post Re: Cynical Network: Make (IP) network connections from Indi
Yes, it says connected. I'll try debugging. BTW, I am getting lot of errors in the log at times, but other times iit does log that it is connected.


Thu Oct 27, 2011 12:22 am
Profile

Joined: Oct 11, 2006
Posts: 23
Location: Netherlands
Post Re: Cynical Network: Make (IP) network connections from Indi
Playing around with this plugin I came across a problem.

I have made a device("MyReceiver") to connect to my receiver, it's connected and receiving info.
Now I want to send it some command. The commands are simple ASCII with a <CR> at the end.
Example: "MUON\r"

I've made an "Action Group":
Type:"Plugin"
Plugin:"Cynical Network"
Action:"Send Text"

And the settings are:
Connection:"MyReceiver"
Text:"MUON"
Partial:False.

The Line Endings: is set to "Carriage Return", but on executing the action nothing happens.

In trying to figure out why, I dug around in the code and found the following in the plugin.py:
Code: Select all
class SendText(cyin.Action):
   text = cyin.PluginProperty("text")
   partial = cyin.PluginProperty("partial", bool)

If I set the Partial: to True and change the following to:
Code: Select all
class SendText(cyin.Action):
   text = "MUON\r"
   partial = cyin.PluginProperty("partial", bool)

I am able to send the mute command to my receiver. And only this combination works.

Any ideas why "cyin.PluginProperty("text")" doesn't work and hard coding "MUON\r" in the script is?


Tue Dec 06, 2011 7:00 am
Profile

Joined: Apr 07, 2008
Posts: 355
Post Re: Cynical Network: Make (IP) network connections from Indi
Any ideas why "cyin.PluginProperty("text")" doesn't work and hard coding "MUON\r" in the script is?


Yes: it's a bug handling line endings. Fixed in version 1.0.1. Get it here: http://www.cynic.org/indigo/plugins/online/network.html

Thanks for reporting the problem.

Cheers
-- perry


Wed Dec 07, 2011 2:44 am
Profile

Joined: Oct 11, 2006
Posts: 23
Location: Netherlands
Post Re: Cynical Network: Make (IP) network connections from Indi
Thnx for the quick response.
The fix did the trick.

I really would like to write my own dedicated plugin for my receiver, but I lack the knowledge to do this. I'm just getting to grips with python, and have converted some of my apple scripts. I have also borrowed the DIRECTV DVR plugin and rebuild it to talk to my Dreambox and HDi Prime, but a realtime socket plugin is a bit out of my league.

Grts,
Bert


Wed Dec 07, 2011 10:13 am
Profile

Joined: Apr 07, 2008
Posts: 355
Post Re: Cynical Network: Make (IP) network connections from Indi
I really would like to write my own dedicated plugin for my receiver, but I lack the knowledge to do this. I'm just getting to grips with python, and have converted some of my apple scripts. I have also borrowed the DIRECTV DVR plugin and rebuild it to talk to my Dreambox and HDi Prime, but a realtime socket plugin is a bit out of my league.

In a better Indigo future, it ought to be possible to "plug" plugins together, so you can only deal with the device-specific parts and let other plugins deal with the transport, hook-up, and backhaul parts. Perhaps even a "paint by the numbers" plugin-maker for the simple cases. Keep in mind that Indigo plugins are a shiny new feature, barely out of the crib, with a bright shiny future ahead of them. I hope. :-)

Cheers
-- perry


Wed Dec 07, 2011 10:33 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 60 posts ]  Go to page: 1, 2, 3, 4  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.