[SOLVED] Observing the Indigo log

Posted on
Wed Mar 19, 2014 10:56 pm
Perry The Cynic offline
Posts: 836
Joined: Apr 07, 2008

[SOLVED] Observing the Indigo log

How can my plugin get notified that a message was posted to the Indigo log? I know of indigo.server.getEventLogList(returnAsList=True), but how do I know that there are new messages to be read, and how do I read (just) "messages since last time I checked"?

Is there a "subscribeToChanges" variant I missed?

How does SQL Logger do it? I just noticed it doesn't seem to have a plugin.py file at all (it has plugin.so instead). Interesting…

Cheers
-- perry

Posted on
Thu Mar 20, 2014 11:03 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Observing the Indigo log

Hi Perry,

I think this is what you want:

Code: Select all
   indigo.server.subscribeToLogBroadcasts()

   def eventLogLineReceived(self, entry):
      ts = entry["TimeStamp"]      # datetime
      typeval = entry["TypeVal"]   # integer
      typestr = entry["TypeStr"]   # str
      message = entry["Message"]   # str
      iserror = (typeval == 1)   # bool

Image

Posted on
Sat Mar 22, 2014 12:03 am
Perry The Cynic offline
Posts: 836
Joined: Apr 07, 2008

Re: Observing the Indigo log

matt (support) wrote:
Hi Perry,

I think this is what you want: […]


Yes. Great. Thanks.

Is there any meaning to be squeezed from the typeVal, beyond the error indication?

How hard would it be to get fractional seconds in the timestamp? (It's a datetime which has microseconds, but they're all zero.)

Cheers
-- perry

Posted on
Sat Mar 22, 2014 6:43 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Observing the Indigo log

Perry The Cynic wrote:
Is there any meaning to be squeezed from the typeVal, beyond the error indication?

The typeVal enumeration is documented on this thread.

Perry The Cynic wrote:
How hard would it be to get fractional seconds in the timestamp? (It's a datetime which has microseconds, but they're all zero.)

Internally the Indigo Server doesn't try to track with a resolution smaller than 1 second. This is partially intentional (I don't want to create the illusion that Indigo is meant for realtime control since its scheduling engine isn't and neither are INSTEON or Z-Wave). That said logging with more precision would be useful, especially when trying to debug hardware communication timing problems. So I'll add it to the feature request list.

Image

Posted on
Sat Mar 22, 2014 9:32 pm
Perry The Cynic offline
Posts: 836
Joined: Apr 07, 2008

Re: Observing the Indigo log

matt (support) wrote:
The typeVal enumeration is documented on this thread.

Oh, that thread. Ah, yes... ;-)
matt (support) wrote:
Internally the Indigo Server doesn't try to track with a resolution smaller than 1 second. This is partially intentional (I don't want to create the illusion that Indigo is meant for realtime control since its scheduling engine isn't and neither are INSTEON or Z-Wave). That said logging with more precision would be useful, especially when trying to debug hardware communication timing problems. So I'll add it to the feature request list.

That's basically the reason. I hope everybody understands that with all the IPC involved, clocks are, well, approximate. Offering timestamp.microsecond values does not promise microsecond resolution, obviously; but even hundredths of a second would be useful.

There's no practical way to sort log messages with second-resolution timestamps, so we'll just have to assume that they're ordered properly upon retrieval, and delivered in order to the callback. These are reasonable expectations, I hope…

Cheers
-- perry

Posted on
Thu May 15, 2014 10:09 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Observing the Indigo log

Indigo v6.0.12 is now available and shows more time precision in the Event Log file (but not the Event Log window).

Image

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 12 guests