New NEST Plugin ready for general use

Plugins that users have built. NOTE: plugins that were developed for Indigo versions older than 2022.1 will have to be updated to work with Indigo 2022.1 (Python 3 - see this blog post for details). If the plugin listed here is not in the Plugin Store (which will show updated plugins) then you will need to ask on the appropriate thread below if it has been updated and where you get get the update.
Rocco
Posts: 37
Joined: Fri Oct 11, 2013 1:01 am

Re: New NEST Plugin ready for general use

Post by Rocco »

Thanks Mike!

It worked terrifically for me.

Carl,
to test the code I simply changed the "tail -q -n 10" to something like "tail -q -n 10000" to make sure it went back far enough in the log to find the last instance of failure. Once I saw the error variable turn true, I knew it would work, and then changed the tail search back to 10. (If I am not mistaken, that is how many lines back in the log to look. Which is why its important to run it frequently, lest the errors get lost in other output.)

Rocco
ckeyes888
Posts: 2438
Joined: Thu Nov 26, 2009 2:41 pm
Location: Kalispell, MT

Re: New NEST Plugin ready for general use

Post by ckeyes888 »

Thanks Rocco. I did try that but still nothing happening.
Having never looked into how log files work I'm curious how often
the log is written to the indigo_log.txt file. I did open it, pasted
the "bad" text into it and ran the script. Shouldn't the script have triggered
from that?

Since trying that I haven't seen the indigo_log.txt file update in hours.
Any info anywhere on how the log files work?

edit: I just tried creating a simple text file containing a sentence or two and set the script up
to look for a single word in it with no joy either.

Thanks,

Carl
mikeL
Posts: 46
Joined: Fri Apr 30, 2010 4:25 pm
Location: Gatineau, QC

Re: New NEST Plugin ready for general use

Post by mikeL »

Carl,
The log file referred to in the script is the daily log file for the current day. It contains all the messages that Indigo writes to the Event Log Window from midnight forward to the present time. What you see in the Event Log Window is what's in the log file. Both the window and the log file are updated by Indigo at the same time. A new log file is started each day at midnight.

The tail -q -n 10 command reads that latest 10 lines of the log file into the Applescript variable res. Then res is checked to see if it contains the text "Invalid message:", i.e., the bad text. If it does then the the Indigo variable "YANTP_error" is set to "true" which, in turn, triggers the reset plugin function. For tail, I'm assuming that the bad text occurs within the last 10 lines of log messages occurring in the last 45 seconds. This works for me, but you can certainly increase the number of lines if you have a more verbose log.

So, to test this:
1) create an Indigo variable "YANTP_error" and give it an initial value of "false".
2) create a new action group that executes the following line of embedded AppleScript:

Code: Select all

log "Invalid message:"
3) run that Applescript using the Run command in the Create New Action Group window.
4) observe that the text "Invalid message:" gets written to the Event Log Window and note that it also gets written to the log file.
5) make sure the scheduled event to test the log file is running (this is the script containing the tail command).
6) wait 45 seconds then observe that "YANTP_error" becomes "true".

Let me know if you successfully get this far.
Cheers,
Mike
mikeL
Posts: 46
Joined: Fri Apr 30, 2010 4:25 pm
Location: Gatineau, QC

Re: New NEST Plugin ready for general use

Post by mikeL »

Rocco,
You don't want to go back too far because you'll pick up "Invalid message:" errors from previous YANTP activity, i.e., before the latest plugin restart. So far, tail -n 10 works well for me. Occasionally, the plugin needs to be restarted several times before I get a clean restart without errors--the script does this nicely. Let me know if this happens in your case too.

Have you had any luck controlling the fan? I am unable to set the fan into Always On or Auto On using a script.

Cheers,
Mike
ckeyes888
Posts: 2438
Joined: Thu Nov 26, 2009 2:41 pm
Location: Kalispell, MT

Re: New NEST Plugin ready for general use

Post by ckeyes888 »

Actually I had tried that as well. I'm stumped. I can log the Invalid message: and see it post to the
log but the script does nothing. I've tried simplifying the flow as well but apparently the script
either can't see the file or isn't finding anything.

edit: Shouldn't the modify time on the indigo_log.txt file change whenever Indigo
updates it? Mine only changes when I do it myself in TextEdit.

Thanks,

Carl
mikeL
Posts: 46
Joined: Fri Apr 30, 2010 4:25 pm
Location: Gatineau, QC

Re: New NEST Plugin ready for general use

Post by mikeL »

Carl, if you post your script here maybe I can spot the error. Sometimes two sets of eyes are better than one.
Mike
mikeL
Posts: 46
Joined: Fri Apr 30, 2010 4:25 pm
Location: Gatineau, QC

Re: New NEST Plugin ready for general use

Post by mikeL »

Carl:
edit: Shouldn't the modify time on the indigo_log.txt file change whenever Indigo
updates it? Mine only changes when I do it myself in TextEdit.
The indigo_log.txt file is actually an alias for the latest daily event file. So indigo_log.txt is pointing to 2014-11-24 Events. The alias was created at midnight and is, itself, never modified. It's the Event file that gets modified each time Indigo writes to the log. So the creation and modification time for indigo_log.txt remain unchanged. Hope that helps.
Mike
ckeyes888
Posts: 2438
Joined: Thu Nov 26, 2009 2:41 pm
Location: Kalispell, MT

Re: New NEST Plugin ready for general use

Post by ckeyes888 »

I did notice it was an alias...but the time never changes on the other file.

Here's one version I've been trying:

Code: Select all

set bad to "Invalid message:"
set res to (do shell script "tail -q -n 30 '/Library/Application Support/Perceptive Automation/Indigo 6/Logs/indigo_log.txt'")
if res contains bad then
	execute group "Nest Plugin Restart"
end if
Thanks a bunch,

Carl
mikeL
Posts: 46
Joined: Fri Apr 30, 2010 4:25 pm
Location: Gatineau, QC

Re: New NEST Plugin ready for general use

Post by mikeL »

Carl,
Your script should work perfectly. I wonder if you broke the indigo_log.txt alias when you edited it so it no longer points correctly. Do you get 30 lines of log file when you run the tail command in a Terminal shell window?

Nice to see that you eliminated the YANTP_error variable from the equation. I've done the same--the variable was helpful while testing the script.
Cheers,
Mike
ckeyes888
Posts: 2438
Joined: Thu Nov 26, 2009 2:41 pm
Location: Kalispell, MT

Re: New NEST Plugin ready for general use

Post by ckeyes888 »

When I run it in Terminal I see this:

> tail -q -n 30 '/Library/Application Support/Perceptive Automation/Indigo 6/Logs/indigo_log.txt
tail: illegal option -- q
usage: tail [-F | -f | -r] [-b # | -c # | -n #] [file ...]
TV:~ TV$

Removing the -q seems to fixed it.

Many thanks!

Carl
mikeL
Posts: 46
Joined: Fri Apr 30, 2010 4:25 pm
Location: Gatineau, QC

Re: New NEST Plugin ready for general use

Post by mikeL »

Carl,
Interesting. I guess we're running different versions of Unix 'cause -q works for me.
tail [-F | -f | -r] [-q] [-b number | -c number | -n number] [file ...]
-q Suppresses printing of headers when multiple files are being examined.

I'm on OS X 10.10.1
Ottawa:~ Mike$ uname -a
Darwin Ottawa.local 14.0.0 Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64

Good that you got it working finally.
Cheers,
Mike
ckeyes888
Posts: 2438
Joined: Thu Nov 26, 2009 2:41 pm
Location: Kalispell, MT

Re: New NEST Plugin ready for general use

Post by ckeyes888 »

I assume it was a 10.5.8 thing. Tried to research it but came up empty.
Thanks again for all the help!

Carl
kalophtalmos
Posts: 9
Joined: Mon Nov 10, 2014 2:03 pm

Re: New NEST Plugin ready for general use

Post by kalophtalmos »

Hey !

Tried to use that plugin with my brand new Nest Protect (smoke and CO2 detector) but when I try to add a New Nest device, I can just pick Thermostat...
Any other plugin maybe dedicated for Nest Protect or Nest Protect compliant ?

Thanks a lot for the hard work
User avatar
henkjanvries
Posts: 108
Joined: Sat May 05, 2012 6:48 am

Re: New NEST Plugin ready for general use

Post by henkjanvries »

Im just wondering if there is a way to change the temp scale from C to F and set the temp and set it back to C.
That way i can use the C status as output, use indigo to change the temp with F and translate it back.

can someone send me in the direction in the plugin, or tell me where i can find the lines?
im not sure how the plugins uses the js and py files. perhaps mikel can point me in the direction

thanks!!
Alphaman
Posts: 38
Joined: Sat Jun 07, 2014 11:10 pm

Re: New NEST Plugin ready for general use

Post by Alphaman »

I've been trying to get the watchdog script to work on my system, with mixed (at best) results.

I've only been able to get the script to recognize that the plugin has failed if I turn on its Debug to console logging mode. The downside to this is that my log fills up at 8.7MBytes within a 24 hour period (yes, I have several motion sensors throughout the house that I use to keep the Nest awake via Indigo -- hence the large log files), and I get the following error at the end of the file (usually around 4PM/1600 hours):

Code: Select all

*** Log File Overflow -- suppressing future logging to this file and console ***
And nothing else gets logged for the remainder of the day. So if the plugin fails after 1600, it won't get restarted until after midnight, after the system starts a new log, and then logs the right error message.

Any idea on how to remove this 8.7MB log file limit? Is that number adjustable? Is it a system-wide setting, or something from Indigo? Or am I missing something else? Is there another less voluminous way to get the right error message into the log without flooding my disk? Is there not another way to tell that a process is no longer responsive? The Activity Monitor shows the plugin with a nice "(Not responding)" in red whenever it hangs; there's got to be another way to tell that something's awry without tail'ing a log file every few seconds...
Post Reply

Return to “User Plugins”