Page 2 of 2

Re: can indigo email the activity log ?

PostPosted: Fri Dec 30, 2011 9:19 pm
by berkinet
Matt:

Now can I go back to work on the Phidgets plugin? :P

HAPPY NEW YEAR to you, Jay, Norm and the rest of our extended Indigo family.

Re: can indigo email the activity log ?

PostPosted: Fri Dec 30, 2011 11:06 pm
by matt (support)
Perfect. Thanks for putting together the python version. :-)

Happy New Year to you, and all the other forum folks!

Re: can indigo email the activity log ?

PostPosted: Sat Dec 31, 2011 3:26 am
by DomoPat
berkinet wrote:
Notes for @chrismoore and others: This can be run as an embedded script since the way Indigo runs Python is a little better behaved than AppleScript.


Is it because with Python the server is not 'blocked' during the execution of the script ?

Re: can indigo email the activity log ?

PostPosted: Sat Dec 31, 2011 6:17 am
by matt (support)
DomoPat wrote:
berkinet wrote:
Notes for @chrismoore and others: This can be run as an embedded script since the way Indigo runs Python is a little better behaved than AppleScript.


Is it because with Python the server is not 'blocked' during the execution of the script ?

Correct. The Indigo Server executes all embedded python scripts in their own process. If they take longer than 10 seconds to complete, then Indigo Server kills them so that the next embedded python script can execute. If you execute a python script as an external file (not embedded) then it gets its own process and can run indefinitely.

Whereas embedded AppleScripts have to execute in the main thread of the Indigo Server, which means there is no way for Indigo to kill them and they can block the server if something goes wrong.

Re: can indigo email the activity log ?

PostPosted: Mon Jun 18, 2012 6:23 pm
by bcall
I just implemented Matt/Berkinet's script for emailing the error's from the activity log on a daily basis. It works great.

I was wondering if there is any way to trigger that script to run as soon as an error is written to the log?

What I'd like to do is have an email or sms sent to me as soon as possible after an insteon communication error is logged. I'm having reliability issues with my insteon network and it would be great to be notified as the problems are occurring so that I can see what might be causing the problem. The problem is intermittent and I can't seem to track the culprit in order to install a filterlinc or take whatever other action is necessary to restore reliability.

I can't seem to find anything in the forum on tracking the log in real time, or otherwise triggering an action when an insteon communication error occurs, so this may not be possible.

If something doesn't already exist, would it be possible to create a plugin to sub class the insteon devices in order to do this? I'm in the process of creating a plugin for the ISY which creates virtual relays, dimmer and thermostats, so I'm somewhat familiar with how indigo calls the plugin to execute actions for these custom devices when using the built in UI. But, I'm not sure how, or whether, I could then call back into indigo to actually execute the insteon command and let the plugin know if it succeeded.

Thanks for any assistance!

Re: can indigo email the activity log ?

PostPosted: Tue Jun 19, 2012 2:21 pm
by bcall
Matt or Jay,
Can one of you please help me with the above question?

Re: can indigo email the activity log ?

PostPosted: Tue Jun 19, 2012 2:38 pm
by jay (support)
There's no built-in way to trigger off of device errors at the moment. So you'd have to cook up something that monitors the log for errors. I don't do it so I don't have anything offhand that would work.

That may be an event we can add to the SQL Logger plugin fairly quickly though. It's not perfect since all Indigo-generated errors use the same type string ("Error") so you'd get more than just device communication errors. I'll look into that for a future release.

Re: can indigo email the activity log ?

PostPosted: Tue Jun 19, 2012 5:17 pm
by bcall
It would be great if you could add something to the SQL logger. Anything I can use as a hook, even if I need to do some evaluation on the data (ie, I would handle figuring out what type of error).

For the longer term, I would be happy to work on some type of plugin to do this. In my ISY plugin (which adds an extra layer of control - indigo talks to isy to send insteon commands and receive insteon device updates), I have included hooks for triggers when isy reports a communication error on a particular insteon device. So the process works as follows:

1. indigo standard ui sends my plugin an action (user turned a relay on, for example) for an indigo device (custom relay based on indigo relay)
2. my plugin handles that (thanks to the meta plugin and your custom thermostat for example code) by sending the appropriate command to ISY which in turn sends the insteon command
3. ISY then notifies my plugin of the new device state, or a communication error if the insteon command was not successful.
4. my plugin updates the indigo device state on the server, or in the case of a communication error, marks the device as "in error" and triggers an event

This give me the error checking I need, but only when I go through ISY (which I'd prefer to only do for my remote location insteon devices). For local insteon devices, I'd prefer to stay with the native indigo insteon. Is there a way a plugin could get in between the indigo ui action calls and the insteon execution methods (in a similar way as I've outlined above)? The front end doesn't seem like a problem (receiving indigo standard ui actions for my custom relays, dimmer and thermostats - as I've done with the ISY plugin). I can see from the docs and example plugins that I can also send insteon commands (indigo.device.turnOn(123) for example) to indigo devices on the back end. But the only success/failure feedback I see is through the sendRawCommand methods of the Insteon Commands plugin, which would require me to format the actions into raw insteon. Is there a way to get success failure info from the higher level commands?

Re: can indigo email the activity log ?

PostPosted: Wed Jun 20, 2012 8:17 am
by matt (support)
bcall wrote:
For local insteon devices, I'd prefer to stay with the native indigo insteon. Is there a way a plugin could get in between the indigo ui action calls and the insteon execution methods (in a similar way as I've outlined above)?

Not currently. You are correct that the lower level INSTEON commands can report back NAKs/failures, but there isn't currently a way to do it from the higher level Turn On/etc. type commands. This is pretty high on our priority list, but it unfortunately didn't make it into Indigo 5.

Re: can indigo email the activity log ?

PostPosted: Wed Jun 20, 2012 8:24 am
by jay (support)
FYI - the next Indigo release will have a couple of things that will help some:

The SQL Logger plugin will now define a new Trigger called "Error in Event Log" which will fire whenever an error occurs in the event log. You can specify any error (including plugin errors), Indigo generated errors, or you can specify the custom type (allowing you to filter specific plugin errors for instance). It's not perfect since there's currently no way to distinguish between Indigo generated errors (device comm errors, connection errors, etc.) but I think it's useful.

The Action Collection plugin will have a new action called "Email Event Log Data" that will allow you to specify a number of event log lines (starting with newest and going in reverse chronological order), a subject, and an address list. It will send those event log lines to those email addresses when it's executed.

I believe these two things together will help people when diagnosing some types of errors. Not sure exactly when that release will drop but I think it should be sometime in the next couple of weeks.

Re: can indigo email the activity log ?

PostPosted: Wed Jun 20, 2012 9:40 am
by HFTobeason
I occasionally get "send failed" errors in my Event Log, such as this:

Error "Irrigation - Front Yard Drip" off; send failed (no acknowledgment)

I cannot figure out how to trap these errors (this particular one is bad, as it results in my irrigation zone running continuously until I notice it). The SQL Logger method described in this thread is no longer valid. Any other suggestions would be most appreciated. Thanks.

Re: can indigo email the activity log ?

PostPosted: Wed Jun 20, 2012 9:58 am
by jay (support)
The event I mention in the above post will catch that log line and then you can do whatever you want when it occurs (it's an Indigo error).

Re: can indigo email the activity log ?

PostPosted: Wed Jun 20, 2012 10:14 am
by HFTobeason
I guess I'm just an idiot - I can't figure out how to use the "Error in Event Log" trigger. I'm assuming I should create a new Trigger of type "Plugin" and then choose the SQL Logger plugin, and the Event "Error in Event Log". But, when I do so, I get greyed-out dropdowns for "Plugin" and "Event". Obviously, I'm doing something wrong...

Re: can indigo email the activity log ?

PostPosted: Wed Jun 20, 2012 10:27 am
by jay (support)
It's not there yet - the first line of the post says "the next Indigo release"... ;)

Re: can indigo email the activity log ?

PostPosted: Wed Jun 20, 2012 10:38 am
by HFTobeason
See? I told you I was an idiot. Thanks.