Automogator - Perl client for Indigo (and more)

Posted on
Mon Sep 20, 2010 10:32 am
seanadams offline
Posts: 489
Joined: Mar 19, 2008
Location: Saratoga, CA

Re: Automogator - Perl client for Indigo (and more)

Get the whole thing, or at least organize the files the same way. The directory structure corresponds to the name of the library that it is looking for, i.e POE::Component::Indigo => POE/Component/Indigo.pm

Posted on
Mon Sep 20, 2010 12:03 pm
jashaffner offline
Posts: 59
Joined: Jan 14, 2007

Re: Automogator - Perl client for Indigo (and more)

Downloaded the whole thing, unzipped, cd into automogator_20100304/ and ran perl indigo_example.pl before I got this new error, "Can't locate POE/Component/Server/HTTP.pm" Sorry, I am a perl newbie. :(

Posted on
Mon Sep 20, 2010 1:05 pm
seanadams offline
Posts: 489
Joined: Mar 19, 2008
Location: Saratoga, CA

Re: Automogator - Perl client for Indigo (and more)

If you are new to perl I'd say you're better off learning python instead (so you can use the future Indigo API) than trying to get up to speed on this. I'm probably going to abandon this project eventually, since plugins will be a better solution.

Posted on
Mon Sep 20, 2010 1:22 pm
jashaffner offline
Posts: 59
Joined: Jan 14, 2007

Re: Automogator - Perl client for Indigo (and more)

I was experimenting with ruby script against the control port, 1176 (default). I wanted to take a closer look at your server_input, basically, uncommenting the #warn lines. In my script, sometimes I get partial packet which means that I need to append the rest of the packet on next socket read.

How is plugins better solution if you have a client that needs to interact with Indigo in different language than python?

Cheers.

Posted on
Mon Sep 20, 2010 1:39 pm
seanadams offline
Posts: 489
Joined: Mar 19, 2008
Location: Saratoga, CA

Re: Automogator - Perl client for Indigo (and more)

jashaffner wrote:
I was experimenting with ruby script against the control port, 1176 (default). I wanted to take a closer look at your server_input, basically, uncommenting the #warn lines. In my script, sometimes I get partial packet which means that I need to append the rest of the packet on next socket read.


This is a very general issue in socket programming. You must NEVER assume that TCP will packetize your data any particular way, or that a read will happen to span the exact amount of data you were hoping to get. You must always view the data as a stream and then parse out the records.

You will note that I don't actually implement this in my script, because it is a facility provided by "POE::Filter::Line" which scans for the null characters and then passes full XML frames to my code. If you want to do the same thing in Ruby, I would likewise suggest looking for an asynchronous event framework that can do this kind of grunt work for you.

How is plugins better solution if you have a client that needs to interact with Indigo in different language than python?


I can't answer that question since you haven't said what you're doing.... I was just suggesting an alternate avenue to think about since that will be a better solution for many of the things I am presently doing with automogator.

Posted on
Tue Sep 21, 2010 9:14 am
jashaffner offline
Posts: 59
Joined: Jan 14, 2007

Re: Automogator - Perl client for Indigo (and more)

Suppose that you want a client to listen to events coming from indigo like when someone rings a doorbell? Not sure how plugins help here?

Posted on
Tue Sep 21, 2010 10:35 am
seanadams offline
Posts: 489
Joined: Mar 19, 2008
Location: Saratoga, CA

Re: Automogator - Perl client for Indigo (and more)

Are you able to tell me what this client actually does? Certainly plugins can receive events, but I still have no idea what you want to do!

Posted on
Tue Sep 21, 2010 10:47 am
jashaffner offline
Posts: 59
Joined: Jan 14, 2007

Re: Automogator - Perl client for Indigo (and more)

A client could be umm... a command line client on my laptop for example or perhaps a client on some remote machine that can talk Jabber/XMPP and would like to interact with Indigo server as well as reacting to some Indigo events. RESTful API is good for one way communication only.

Posted on
Tue Sep 21, 2010 11:10 am
seanadams offline
Posts: 489
Joined: Mar 19, 2008
Location: Saratoga, CA

Re: Automogator - Perl client for Indigo (and more)

jashaffner wrote:
A client could be umm... a command line client on my laptop for example or perhaps a client on some remote machine that can talk Jabber/XMPP and would like to interact with Indigo server as well as reacting to some Indigo events. RESTful API is good for one way communication only.


You are being obtuse. I would love to answer your question but I will ask only one more time: what is the **end result** that you want to accomplish? not the particular mechanism that you have decided must exist. And I'm not suggesting the RESTful interface, I'm talking about the forthcoming plugin API that will be in Indigo 5. It hasn't been disclosed yet in detail but there have been some discussions about it here, and proper event handling is largely the point of it.

Posted on
Tue Sep 21, 2010 11:41 am
jashaffner offline
Posts: 59
Joined: Jan 14, 2007

Re: Automogator - Perl client for Indigo (and more)

Sean, I appreciate you taking time here.

I have a jabber/sms client interacting with Indigo server currently via Restful API. All set but one. I would like client to send me an IM/SMS when someone rings a doorbell or motion is detected.

ps: I did not see how telling anyone EXACTLY what I want to do was relevant here. :)

Posted on
Tue Sep 21, 2010 12:30 pm
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Automogator - Perl client for Indigo (and more)

jashaffner wrote:
...ps: I did not see how telling anyone EXACTLY what I want to do was relevant here. :)

Having spent a few years in (mostly software) product management, and emphasizing in requirements gathering, I can say that we always do a much better job meeting the customers ' needs when they tell us what they need to have happen instead of how they want it done..

The problem with getting the "how to do it" type of requirement is that it is limited to the customer's scope of view of the problem and limits the range of useful outcomes.

my 2¢

BTW, in the particular case described, the existing AppleScript "interface" from Indigo may be the best way to proceed.

Posted on
Tue Sep 21, 2010 12:37 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Automogator - Perl client for Indigo (and more)

The plugin API will have the ability to define actions as well as devices and events. So, you would create an Indigo Trigger event that would watch for the doorbell ring event. When it sees it, it would execute actions, one of which might be a plugin action that sends an IM. So, your plugin wouldn't actually watch for the doorbell event, but rather IndigoServer would tell your plugin to execute an action (send an IM) in response to a trigger event defined by the user.

The trigger event, of course, could also be something defined by a plugin - for instance, if your doorbell ring detection is done from, say, your alarm system, then the plugin would generate the doorbell ring event (by listening to your alarm system in whatever way it communicates) and sent that to IndigoServer.

Plugins will also have the ability to get device state change information so you *could* do the triggering logic in your plugin - but since IndigoServer is optimized to do just that it is probably more work than you need, at least for this example.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Sep 21, 2010 12:51 pm
seanadams offline
Posts: 489
Joined: Mar 19, 2008
Location: Saratoga, CA

Re: Automogator - Perl client for Indigo (and more)

Here's how you might approach that as a plugin. Create a plugin device called "SMS Gateway" which accepts a command containing the recipient and message body. In your plugin code, invoke one of the existing python Jabber clients to send it. Done. We are probably talking about less than ten lines of code, besides whatever skeleton/example plugin you start with.

Personally, I rather miss the days before there was a library for everything, and you really had to get down in the details to accomplish anything. That was something I enjoyed. It's getting too easy for my taste.

Posted on
Tue Sep 21, 2010 1:01 pm
jashaffner offline
Posts: 59
Joined: Jan 14, 2007

Re: Automogator - Perl client for Indigo (and more)

berkinet wrote:
jashaffner wrote:
...ps: I did not see how telling anyone EXACTLY what I want to do was relevant here. :)

Having spent a few years in (mostly software) product management, and emphasizing in requirements gathering, I can say that we always do a much better job meeting the customers ' needs when they tell us what they need to have happen instead of how they want it done..

The problem with getting the "how to do it" type of requirement is that it is limited to the customer's scope of view of the problem and limits the range of useful outcomes.

my 2¢


Very true. I guess being a software engineer myself, I could not help trying to gain better understanding of how 5.0 plugin could send events to some remote client.

berkinet wrote:
BTW, in the particular case described, the existing AppleScript "interface" from Indigo may be the best way to proceed.


Yea, I thought about it. Thanks.

Posted on
Tue Sep 21, 2010 1:41 pm
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Automogator - Perl client for Indigo (and more)

jashaffner wrote:
Sean, I appreciate you taking time here.

I have a jabber/sms client interacting with Indigo server currently via Restful API. All set but one. I would like client to send me an IM/SMS when someone rings a doorbell or motion is detected.

ps: I did not see how telling anyone EXACTLY what I want to do was relevant here. :)


The issue here, is how exactly to detect that your doorbell has been rung. The motion is simple, an X10 or Insteon motion sensor...

One idea that I have thought about is to place a relay inline with your doorbell, and have it momentarily close when the doorbell current changes. Then connect either an insteon or X10 door sensor to the relay... That way you still have normal door bell operation, but the door sensor would be triggered when the bell is set off.

The SMS/IM gateway is simple, SMS is accessible via email, what's your carrier, and where are you located (roughly)... ? I can look up what your SMS email gateway is.

------
My Plugins for Indigo (v4, v5, and v6) - http://bit.ly/U8XxPG

Security Script for v4 - http://bit.ly/QTgclf
for v5 - http://bit.ly/T6WBKu

Support Forum(s) - http://www.perceptiveautomation.com/userforum/viewforum.php?f=33

Who is online

Users browsing this forum: No registered users and 6 guests