Plugin startup order question

Forum rules

This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo

Posted on
Tue Apr 24, 2012 5:45 pm
Swancoat offline
Posts: 503
Joined: Nov 20, 2009
Location: Houston

Re: Plugin startup order question

Ok, plugin downloads correctly, loads, creates Alarm Panel device and connects.

It does not create the zones however.

It just keeps banging out row after row of...
Code: Select all
ELK M1G Control Error           EOFError: telnet connection closed


Any ideas here?

http://nerdhome.jimdo.com

Posted on
Tue Apr 24, 2012 8:07 pm
jcrides offline
Posts: 26
Joined: Oct 23, 2010
Location: Concord, CA

Re: Plugin startup order question

Can you try turning on debug logging and reload the plugin then PM me the output? It should log a bunch including the raw info it's getting back from the alarm panel.

edit: also would be good to know which version of Indigo you're running

~JC

Posted on
Wed Apr 25, 2012 4:16 am
Swancoat offline
Posts: 503
Joined: Nov 20, 2009
Location: Houston

Re: Plugin startup order question

I had turned on debugging in an attempt to glean more info last night as well. Not much help unfortunately...

Code: Select all
  ELK M1G Control Debug           Alarm code saving enabled
  ELK M1G Control Debug           True, True, True
  ELK M1G Control                 Connecting to Alarm Panel
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control Error           EOFError: telnet connection closed
  ELK M1G Control                 Disconnecting from Alarm Panel


Basically, I let it run for 2 or 3 seconds before disconnecting.

http://nerdhome.jimdo.com

Posted on
Wed Apr 25, 2012 9:20 am
jcrides offline
Posts: 26
Joined: Oct 23, 2010
Location: Concord, CA

Re: Plugin startup order question

I'll add some more debugging tonight to see if I can figure out what's going on. In the meantime you can try powercycling your M1-XEP ethernet module. I've had a few occasions in the past where I needed to do that.

~JC

Posted on
Wed Apr 25, 2012 4:58 pm
Swancoat offline
Posts: 503
Joined: Nov 20, 2009
Location: Houston

Re: Plugin startup order question

jcrides wrote:
I'll add some more debugging tonight to see if I can figure out what's going on. In the meantime you can try powercycling your M1-XEP ethernet module. I've had a few occasions in the past where I needed to do that.

~JC


Cycled the power. Same issue.

Can this be something on my end? I'll log in with ElkRP and see what of the bajillion settings I might need to correct.

http://nerdhome.jimdo.com

Posted on
Wed Apr 25, 2012 7:16 pm
Swancoat offline
Posts: 503
Joined: Nov 20, 2009
Location: Houston

Re: Plugin startup order question

Ok, so I'm not sure I'm even connecting to the M1XEP....

When I 'connect to panel' conn_state goes to On.... but nothing else responds. arm_ready is always 0, and I armed the alarm and arm_state also stays at 0. So whatever my issue is, it's pretty basic.

Furthermore, I tried logging in with a bogus code, and I get the same answer. conn_state still goes to On.

I tried my RP access code, and I tried setting up a non-secure port... still the same results.

Then I sent the plugin to the wrong IP address..

Still says conn_state goes to On

Hope that helps. Basically sounds like M1XEP is not picking up the phone (which sounds more like a problem of mine...). I do use eKeypad for my iPhone with it though, so I CAN talk to the ELK through the M1XEP...(Although that requires a name and password for the secure port)

http://nerdhome.jimdo.com

Posted on
Wed Apr 25, 2012 8:11 pm
jcrides offline
Posts: 26
Joined: Oct 23, 2010
Location: Concord, CA

Re: Plugin startup order question

The plugin has to connect to a non-secure port, the default is 2101. From reading through ELK's documentation connecting to the secure port is a non-trivial exercise. Once you set it up to listen on a non-secure port you can test that it's working from a terminal window.

Open terminal then telnet <your M1XEP IP> 2101(or whatever you set the port to). It should look like this:
Code: Select all
jserv:~ jcarey$ telnet 10.10.10.131 2101
Trying 10.10.10.131...
Connected to 10.10.10.131.
Escape character is '^]'.


If you let it sit for a little you should see some lines like this:
Code: Select all
16XK02061942504121100070
16XK3206194250412110006D


If you don't get the connect and the 16XK... messages then you're not connecting to the M1XEP.

Haven't had a chance to add the additional logging yet since traffic was HORRIBLE tonight and I just got home. I'm going to add some to output some info about the connection attempt that will hopefully shed some light on what's going on.

~JC

Posted on
Wed Apr 25, 2012 8:11 pm
Swancoat offline
Posts: 503
Joined: Nov 20, 2009
Location: Houston

Re: Plugin startup order question

GOT IT!

So, here's the deal: It looks like I do need to use the unsecured port (correct me if I'm wrong)...

It seems like all of my changes to the port and code don't really have any effect unless you:

1) Disconnect from the Elk Panel
2) Delete the Alarm Panel Device
3) Change the port/access code in the config box.
4) Disable and Reenable the plugin.

Boom! it connects and is correctly reporting alarm states, etc....

That being said, some errors were thrown up (included below...) and I'm not sure if the plugin queries the zone states or not, as zone's 1-4 show status 'Normal', but the rest show '0'.

Anyway... things looking pretty good now! I'm going to have a lot of fun with this plugin!

Code: Select all
  Enabling plugin "ELK M1G Control 1.0.0"
  Starting plugin "ELK M1G Control 1.0.0" (pid 812)
  Plugin "ELK M1G Control" connected
  Plugin "ELK M1G Control 1.0.0" started

Apr 25, 2012 8:58:40 PM
  ELK M1G Control Error           Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
  File "plugin.py", line 50, in runConcurrentThread
  File "plugin.py", line 159, in dispatchMsg
  File "/Library/Application Support/Perceptive Automation/Indigo 5/Plugins/Elk Plugin.indigoPlugin/Contents/Server Plugin/elkextra.py", line 120, in setZoneStatus
<type 'exceptions.KeyError'>: 'key name Zone 17 not found in database'

  ELK M1G Control Error           plugin runConcurrentThread function returned or failed; will attempt again in 10 seconds
  ELK M1G Control Error           Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
  File "plugin.py", line 50, in runConcurrentThread
  File "plugin.py", line 159, in dispatchMsg
  File "/Library/Application Support/Perceptive Automation/Indigo 5/Plugins/Elk Plugin.indigoPlugin/Contents/Server Plugin/elkextra.py", line 120, in setZoneStatus
<type 'exceptions.KeyError'>: 'key name Zone 17 not found in database'


http://nerdhome.jimdo.com

Posted on
Wed Apr 25, 2012 8:14 pm
Swancoat offline
Posts: 503
Joined: Nov 20, 2009
Location: Houston

Re: Plugin startup order question

Ahhh, and right as I hit the post button, I see what the errors were all about...

They all refer to Zone17... well, my wife just walked through the living room and Zone17 was violated. It's the motion sensor in the Living Room. She was probably tripping it like crazy, but it wasn't yet defined, as I hadn't scanned for devices. Now that I've scanned for devices, I'm also not getting any more errors.

SO...

Basically, everything works, (except a lot of the zones don't yet have their state, but hey - I need to test them anyway).

Thanks!!!

http://nerdhome.jimdo.com

Posted on
Wed Apr 25, 2012 8:27 pm
Swancoat offline
Posts: 503
Joined: Nov 20, 2009
Location: Houston

Re: Plugin startup order question

Ahhh... I'm having a busy night.

So the plugin fully WORKS... I now have a functionality issue.

I went and renamed all of my zones to what they are. i.e. I renamed Zone17 to 'Living Room Motion'.

However, now when it trips, I get the error that Zone17 is not available, etc... It looks like you're using the name as the key, yet I have a desire to change that to something usable.

Code: Select all
Apr 25, 2012 9:23:19 PM
  ELK M1G Control Error           Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
  File "plugin.py", line 50, in runConcurrentThread
  File "plugin.py", line 159, in dispatchMsg
  File "/Library/Application Support/Perceptive Automation/Indigo 5/Plugins/Elk Plugin.indigoPlugin/Contents/Server Plugin/elkextra.py", line 120, in setZoneStatus
<type 'exceptions.KeyError'>: 'key name Zone 17 not found in database'

  ELK M1G Control Error           plugin runConcurrentThread function returned or failed; will attempt again in 10 seconds

http://nerdhome.jimdo.com

Posted on
Wed Apr 25, 2012 8:45 pm
jcrides offline
Posts: 26
Joined: Oct 23, 2010
Location: Concord, CA

Re: Plugin startup order question

Glad to hear that you got it connected and working.

Yes, the way it currently works is the device name is based on the zone number and I'm putting the name from the panel in the description. I'll see if I can come up with a way to be able to use the description as the name. I think I did it this way originally because the zone state and description are in two different messages.

~JC

Posted on
Tue May 22, 2012 7:15 am
Swancoat offline
Posts: 503
Joined: Nov 20, 2009
Location: Houston

Re: Plugin startup order question

Any progress on freeing up the 'name' field to be changed?

Now that I'm further down the road on my own plugin, I encountered this problem on mine as well.

My solution (with guidance from Matt and Jay):

-Device is identified by a unique identifier in its configUI (when you validate device, you can make sure it's the only one with that identifier).
-However, this is not a useful key, value pair. So I have a dictionary, and on device startup, I add that identifer as a key for that dictionary, and the device itself as the value.
-Now, to find any device for which I have only it's identifier, I just refer to the dictionary/key.

device = self.dict[identifier]

http://nerdhome.jimdo.com

Posted on
Tue May 22, 2012 7:24 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Plugin startup order question

Swancoat wrote:
Any progress on freeing up the 'name' field to be changed?

Refresh my memory -- which name field in particular are you talking about?

Image

Posted on
Tue May 22, 2012 8:26 am
Swancoat offline
Posts: 503
Joined: Nov 20, 2009
Location: Houston

Re: Plugin startup order question

Sorry, this plugin stores uses dev.name as the key. So it creates a bunch of zones for your alarm automatically (or should I say, awesomatically?), but names them all 'Zone 1', 'Zone 2', etc... (In the user-interface editable name field).

However, if you rename them something useful (i.e. 'Kitchen Window', 'Garage Door', etc...), then the plugin breaks, because when it tries to update status, it's looking for a device named 'Zone 12' or something.

Other than that, the plugin is fantastic, but to use it, I kind of need to be able to name the zones with descriptive names (don't want to leave a post-it on my monitor with all of my Alarm zone names and numbers on it...)

http://nerdhome.jimdo.com

Posted on
Tue May 22, 2012 9:05 am
jay (support) offline
Site Admin
User avatar
Posts: 18219
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Plugin startup order question

The object ID (in this case I guess the dev.id) should always be used in Python code for this exact reason - the name changes, the ID doesn't. I can't stress enough how important that is.

If you're writing a plugin that needs to reference any Indigo object, the ID should be used. So, for instance, if your plugin defines devices, then when deviceStartComm is called with the device instance, you should always use the ID to identify the device. If you need to keep a list of active devices, keep it as a list of device IDs.

In this case, the plugin needs to map the zone (from the alarm system API) to the device id that it created for that zone. It shouldn't be a big deal to do for whoever developed the plugin to fix that.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Who is online

Users browsing this forum: No registered users and 1 guest