How to Use AppleScript to Display Logs in Indigo Touch

This subforum has been locked since we no longer support AppleScript.
User avatar
Different Computers
Posts: 2609
Joined: Sat Jan 02, 2016 10:07 am
Location: East Coast
Contact:

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

Post by Different Computers »

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?
Sonoma on a Mac Mini M1 running Airfoil Pro, Bond Home, Camect, Roku Network Remote, Hue Lights, DomoPad, Adapters, Home Assistant Agent, HomeKitLinkSiri, EPS Smart Dimmer, Fantastic Weather, Nanoleaf, LED Simple Effects, Grafana. UnifiAP
howartp
Posts: 4559
Joined: Thu Jan 09, 2014 4:43 pm
Location: West Yorkshire, UK

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

Post by howartp »

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
User avatar
Different Computers
Posts: 2609
Joined: Sat Jan 02, 2016 10:07 am
Location: East Coast
Contact:

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

Post by Different Computers »

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:
Sonoma on a Mac Mini M1 running Airfoil Pro, Bond Home, Camect, Roku Network Remote, Hue Lights, DomoPad, Adapters, Home Assistant Agent, HomeKitLinkSiri, EPS Smart Dimmer, Fantastic Weather, Nanoleaf, LED Simple Effects, Grafana. UnifiAP
User avatar
jay (support)
Site Admin
Posts: 18411
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

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

Post by jay (support) »

It looks like your script is writing it. Does it have any "log" lines in it?
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
howartp
Posts: 4559
Joined: Thu Jan 09, 2014 4:43 pm
Location: West Yorkshire, UK

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

Post by howartp »

Yep, the "log indigolog" line.


Sent from my iPhone using Tapatalk
User avatar
jay (support)
Site Admin
Posts: 18411
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

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

Post by jay (support) »

That's what's doing it. Take that line out and it will go away.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
User avatar
Different Computers
Posts: 2609
Joined: Sat Jan 02, 2016 10:07 am
Location: East Coast
Contact:

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

Post by Different Computers »

Got it. Thanks.

For anyone else wondering how to do this, the line to comment out is

Code: Select all

log IndigoLogName
Sonoma on a Mac Mini M1 running Airfoil Pro, Bond Home, Camect, Roku Network Remote, Hue Lights, DomoPad, Adapters, Home Assistant Agent, HomeKitLinkSiri, EPS Smart Dimmer, Fantastic Weather, Nanoleaf, LED Simple Effects, Grafana. UnifiAP
User avatar
Different Computers
Posts: 2609
Joined: Sat Jan 02, 2016 10:07 am
Location: East Coast
Contact:

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

Post by Different Computers »

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?
Sonoma on a Mac Mini M1 running Airfoil Pro, Bond Home, Camect, Roku Network Remote, Hue Lights, DomoPad, Adapters, Home Assistant Agent, HomeKitLinkSiri, EPS Smart Dimmer, Fantastic Weather, Nanoleaf, LED Simple Effects, Grafana. UnifiAP
howartp
Posts: 4559
Joined: Thu Jan 09, 2014 4:43 pm
Location: West Yorkshire, UK

How to Use AppleScript to Display Logs in Indigo Touch

Post by howartp »

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
MartyS
Posts: 86
Joined: Tue May 06, 2008 11:22 am
Location: Charlotte, North Carolina

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

Post by MartyS »

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
User avatar
Different Computers
Posts: 2609
Joined: Sat Jan 02, 2016 10:07 am
Location: East Coast
Contact:

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

Post by Different Computers »

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?
Sonoma on a Mac Mini M1 running Airfoil Pro, Bond Home, Camect, Roku Network Remote, Hue Lights, DomoPad, Adapters, Home Assistant Agent, HomeKitLinkSiri, EPS Smart Dimmer, Fantastic Weather, Nanoleaf, LED Simple Effects, Grafana. UnifiAP
User avatar
jay (support)
Site Admin
Posts: 18411
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

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

Post by jay (support) »

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
User avatar
Different Computers
Posts: 2609
Joined: Sat Jan 02, 2016 10:07 am
Location: East Coast
Contact:

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

Post by Different Computers »

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.)
Sonoma on a Mac Mini M1 running Airfoil Pro, Bond Home, Camect, Roku Network Remote, Hue Lights, DomoPad, Adapters, Home Assistant Agent, HomeKitLinkSiri, EPS Smart Dimmer, Fantastic Weather, Nanoleaf, LED Simple Effects, Grafana. UnifiAP
User avatar
Different Computers
Posts: 2609
Joined: Sat Jan 02, 2016 10:07 am
Location: East Coast
Contact:

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

Post by Different Computers »

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.
Sonoma on a Mac Mini M1 running Airfoil Pro, Bond Home, Camect, Roku Network Remote, Hue Lights, DomoPad, Adapters, Home Assistant Agent, HomeKitLinkSiri, EPS Smart Dimmer, Fantastic Weather, Nanoleaf, LED Simple Effects, Grafana. UnifiAP
User avatar
jay (support)
Site Admin
Posts: 18411
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

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

Post by jay (support) »

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
Locked

Return to “AppleScript Scripting”