How to Use AppleScript to Display Logs in Indigo Touch

Posted on
Mon May 02, 2016 6:34 am
Different Computers offline
User avatar
Posts: 1850
Joined: Jan 02, 2016
Location: East Coast

Re: How to Use AppleScript to Display Logs in Indigo Touch

That did fix it, I think. Thanks!

Was this a file name format change in 6.18?

Also, any idea on how to get
Code: Select all
May 2, 2016, 8:34:00 AM   Script                          2016-05-02 Events.txt

to stop appearing in the log every minute?

SmartThings refugee, so happy to be on Indigo. 10.13.6 on an i5 MBP w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKit Bridge, MatplotLib, Plex, uniFAP, Wunderground, Nanoleaf, LED Simple Effects, Airfoil Pro, Grafana.

Posted on
Mon May 02, 2016 10:43 am
howartp offline
Posts: 3349
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: How to Use AppleScript to Display Logs in Indigo Touch

Don't think the log file names will have ever changed.

You've not been around long enough to have had the script running at the beginning of last month (1st to 9th) I don't think? So you wouldn't have come across it until now.


Sent from my iPhone using Tapatalk

Posted on
Tue May 03, 2016 2:03 pm
Different Computers offline
User avatar
Posts: 1850
Joined: Jan 02, 2016
Location: East Coast

Re: How to Use AppleScript to Display Logs in Indigo Touch

No ideas on how to get rid of

Code: Select all
May 2, 2016, 8:34:00 AM   Script                          2016-05-02 Events.txt
???

:cry: :cry:

SmartThings refugee, so happy to be on Indigo. 10.13.6 on an i5 MBP w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKit Bridge, MatplotLib, Plex, uniFAP, Wunderground, Nanoleaf, LED Simple Effects, Airfoil Pro, Grafana.

Posted on
Tue May 03, 2016 3:03 pm
jay (support) offline
Site Admin
User avatar
Posts: 14884
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How to Use AppleScript to Display Logs in Indigo Touch

It looks like your script is writing it. Does it have any "log" lines in it?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue May 03, 2016 4:14 pm
howartp offline
Posts: 3349
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: How to Use AppleScript to Display Logs in Indigo Touch

Yep, the "log indigolog" line.


Sent from my iPhone using Tapatalk

Posted on
Tue May 03, 2016 4:33 pm
jay (support) offline
Site Admin
User avatar
Posts: 14884
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How to Use AppleScript to Display Logs in Indigo Touch

That's what's doing it. Take that line out and it will go away.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue May 03, 2016 7:53 pm
Different Computers offline
User avatar
Posts: 1850
Joined: Jan 02, 2016
Location: East Coast

Re: How to Use AppleScript to Display Logs in Indigo Touch

Got it. Thanks.

For anyone else wondering how to do this, the line to comment out is
Code: Select all
log IndigoLogName

SmartThings refugee, so happy to be on Indigo. 10.13.6 on an i5 MBP w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKit Bridge, MatplotLib, Plex, uniFAP, Wunderground, Nanoleaf, LED Simple Effects, Airfoil Pro, Grafana.

Posted on
Tue May 10, 2016 1:23 pm
Different Computers offline
User avatar
Posts: 1850
Joined: Jan 02, 2016
Location: East Coast

Re: How to Use AppleScript to Display Logs in Indigo Touch

I'm puzzled to be the only person with this problem:

I had to pad my log file name with a "0" in the date for the first 9 days of May. Today I had to take it out.

I didn't change any of the code. Is everyone else manually changing this 2x a month?

SmartThings refugee, so happy to be on Indigo. 10.13.6 on an i5 MBP w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKit Bridge, MatplotLib, Plex, uniFAP, Wunderground, Nanoleaf, LED Simple Effects, Airfoil Pro, Grafana.

Posted on
Tue May 10, 2016 4:59 pm
howartp offline
Posts: 3349
Joined: Jan 09, 2014
Location: West Yorkshire, UK

How to Use AppleScript to Display Logs in Indigo Touch

You need to pad anything less than 10.

I can't see your script as I'm on phone, but it will probably be an if() command.

If dayofmonth is less than 10 then... otherwise ....

Same with months of the year because you'll have same problem in October when months become double-digit.


Sent from my iPhone using Tapatalk

Posted on
Fri Jul 08, 2016 10:01 pm
MartyS offline
Posts: 69
Joined: May 06, 2008
Location: Charlotte, North Carolina

Re: How to Use AppleScript to Display Logs in Indigo Touch

I'm a bit late to this topic, but for anyone else following along and implementing other code suggestions brought up after creation of the original script…

I don't believe that the extra AppleScript code for building and then using the actual Indigo log filename (in "yyyy-mm-dd Events.txt" format) is necessary. The code by the OP uses the filename of indigo_log.txt which is a symlink to the latest date-based name. That didn't change between Indigo 5 and 6: they both have that same symlink. The same has likely been true for several (or all) major versions.

That avoids any issue about which day of the month, or which month it is, and when to pad them with an extra "0". Just use indigo_log.txt! 8)

I for one implemented the additional code, debugged it to my satisfaction and only then realized that it wasn't needed.

/Marty

Posted on
Wed Jan 31, 2018 1:43 pm
Different Computers offline
User avatar
Posts: 1850
Joined: Jan 02, 2016
Location: East Coast

Re: How to Use AppleScript to Display Logs in Indigo Touch

I'm considering revisiting this. As I moved Indigo from one Mac to another a while ago, I lost this feature somehow.

The original AppleScript has "tell IndigoServer" in it, so this won't work soon. Thoughts about how to do this with Python?

SmartThings refugee, so happy to be on Indigo. 10.13.6 on an i5 MBP w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKit Bridge, MatplotLib, Plex, uniFAP, Wunderground, Nanoleaf, LED Simple Effects, Airfoil Pro, Grafana.

Posted on
Wed Jan 31, 2018 7:22 pm
jay (support) offline
Site Admin
User avatar
Posts: 14884
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How to Use AppleScript to Display Logs in Indigo Touch

Well, the log is in Indigo Touch.

But, this script is similar (untested but should be close):

Code: Select all
import sys
import collections

def tail(iterable, N):
    deq = collections.deque()
    for thing in iterable:
        if len(deq) >= N:
            deq.popleft()
        deq.append(thing)
    return list(deq)

# A list of the variable IDs - this script doesn't create them so they have to exist already
variable_ids = [1, 2, 3, 4, 5]

lines = tail(open("/Library/Application Support/Perceptive Automation/Indigo 7/Logs/indigo_log.txt"), len(variable_ids))
for index, line in enumerate(lines):
   indigo.variable.updateValue(variable_ids[index], value=line)


This doesn't create the variables that hold the log lines, they must already exist. But it also will use the number of variables specified in the list at the number of lines to get.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Feb 01, 2018 6:54 am
Different Computers offline
User avatar
Posts: 1850
Joined: Jan 02, 2016
Location: East Coast

Re: How to Use AppleScript to Display Logs in Indigo Touch

Thanks Jay! I'll try this today.

jay (support) wrote:
Well, the log is in Indigo Touch..


It is???? You mean I can look at it via IT, right? Sure. But it's super handy to have a running glimpse of the log on a control page that is sitting open on my desk. For watching those non-responsive camera notifications I'm getting. (I've got a Foscam C2 that's losing its mind, even after two hard resets.)

SmartThings refugee, so happy to be on Indigo. 10.13.6 on an i5 MBP w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKit Bridge, MatplotLib, Plex, uniFAP, Wunderground, Nanoleaf, LED Simple Effects, Airfoil Pro, Grafana.

Posted on
Thu Feb 01, 2018 8:19 am
Different Computers offline
User avatar
Posts: 1850
Joined: Jan 02, 2016
Location: East Coast

Re: How to Use AppleScript to Display Logs in Indigo Touch

Jay, thanks again. That script worked perfectly first try.

Now I'm confronted with the same issue mentioned for the AppleScript about a page back: Any simple way to strip the timestamps before they become the variable values? Or after for that matter.

I searched for "python equivalent of tail" and as I started to read my head nearly exploded.

SmartThings refugee, so happy to be on Indigo. 10.13.6 on an i5 MBP w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKit Bridge, MatplotLib, Plex, uniFAP, Wunderground, Nanoleaf, LED Simple Effects, Airfoil Pro, Grafana.

Posted on
Thu Feb 01, 2018 11:41 am
jay (support) offline
Site Admin
User avatar
Posts: 14884
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How to Use AppleScript to Display Logs in Indigo Touch

Different Computers wrote:
Now I'm confronted with the same issue mentioned for the AppleScript about a page back: Any simple way to strip the timestamps before they become the variable values? Or after for that matter.


Can you just restate the problem?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Who is online

Users browsing this forum: No registered users and 2 guests