Trigger off of a file changing?

Posted on
Sun Feb 25, 2018 7:41 pm
ZachBenz offline
Posts: 163
Joined: Feb 08, 2014

Trigger off of a file changing?

Is there a way to trigger based on a file on disk changing (e.g. being created/updated/deleted)? I feel like there was a plugin at some point that could watch a file for changes, but I can't for the life of me find it now.

ZachBenz's Plugins: RingForIndigo

Posted on
Wed Feb 28, 2018 9:01 pm
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Re: Trigger off of a file changing?

Somebody may have made a mac system-level plugin, though i can’t remember either.

I don’t know exactly how, but I know it can be done using
1) folder actions
2) automator, running a...
3) ... shell script that cURL’s the relevant info to Indigo’s RESTful interface

I have to guess- you doing an IFTTT trigger?


Sent from my iPhone using Tapatalk

Posted on
Sun Mar 04, 2018 2:50 pm
ZachBenz offline
Posts: 163
Joined: Feb 08, 2014

Re: Trigger off of a file changing?

Not IFTTT in my case, something a bit more esoteric (I want to trigger off of when a specific file is downloaded by a particular plugin). I think the solution I actually want is to write the python to add the specific trigger I want to another plugin (the Ring plugin in this case). That is, instead of kludging things by watching the file system for changes, just have the plugin tell me when the thing that I'm interested in has finished.

ZachBenz's Plugins: RingForIndigo

Posted on
Mon Mar 05, 2018 11:04 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Trigger off of a file changing?

Try asking the Ring author - they might add the trigger right in the plugin for you.


Sent from my iPhone using Tapatalk Pro

Posted on
Tue Mar 06, 2018 11:19 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Trigger off of a file changing?

How deep do you want to go with this? It's possible in Py to watch for a file but you'll likely need to do this in a plugin so it can thread and loop without hanging Indigo. Here's an example how to do this in Py:

Code: Select all
import sys
import time
import logging
from watchdog.observers import Observer
from watchdog.events import LoggingEventHandler

def watchForFile (self, path):
    logging.basicConfig(level=logging.INFO,
                        format='%(asctime)s - %(message)s',
                        datefmt='%Y-%m-%d %H:%M:%S')
    event_handler = LoggingEventHandler()
    observer = Observer()
    observer.schedule(event_handler, path, recursive=True)
    observer.start()
    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        observer.stop()
    observer.join()

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Tue Mar 06, 2018 9:48 pm
ZachBenz offline
Posts: 163
Joined: Feb 08, 2014

Re: Trigger off of a file changing?

Thanks, C4W.

I've already been making edits to the Ring plugin (and submitting them via pull requests), so I'm happy to muck about some more. :-)

ZachBenz's Plugins: RingForIndigo

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests