Watched folder to trigger Indigo?

Posted on
Sun Apr 03, 2016 1:08 pm
Different Computers offline
User avatar
Posts: 2579
Joined: Jan 02, 2016
Location: East Coast

Watched folder to trigger Indigo?

Before I jump too far down this rabbit hole, I thought I would ask if this seems like a good idea:

My Foscam C1 is set up to record motion detection events to the Drop Box folder of the user my Indigo Server runs under.

If I use Automator to watch that folder, then on any new file, I could trigger an Indigo action, effectively making my C1 a motion detector.

Reasonable?

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

Posted on
Sun Apr 03, 2016 1:22 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Watched folder to trigger Indigo?

Yes, certainly.

Using the Restful API, you can call an Indigo action.

I do it with some Python on a Windows PC, but I'm sure Automator would work.


Sent from my iPhone using Tapatalk

Posted on
Sun Apr 03, 2016 2:59 pm
Different Computers offline
User avatar
Posts: 2579
Joined: Jan 02, 2016
Location: East Coast

Re: Watched folder to trigger Indigo?

Where do I find docs on the the Restful API?

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

Posted on
Sun Apr 03, 2016 4:13 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Watched folder to trigger Indigo?

http://wiki.indigodomo.com/doku.php?id= ... stful_urls

Or:

Website > Support > How to Wiki > Tech Docs for Indigo 6* > RESTful API

*right at the bottom.


Sent from my iPhone using Tapatalk

Posted on
Sun Apr 03, 2016 4:44 pm
Different Computers offline
User avatar
Posts: 2579
Joined: Jan 02, 2016
Location: East Coast

Re: Watched folder to trigger Indigo?

Thanks again! I even think I get it!

Assuming I have an indigo variable called YardMotion
I create this applescript that triggers on folder change:

Code: Select all
set YardMotion to "true"
set IndigoWarning to "curl -u username:password --digest -X PUT -d value=" & YardMotion & " http://192.168.0.99:8176/variables/YardMotion"
do shell script IndigoWarning


Edit: fixed curly quotes in code
Last edited by Different Computers on Mon Apr 04, 2016 7:35 am, edited 1 time in total.

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

Posted on
Mon Apr 04, 2016 12:34 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Watched folder to trigger Indigo?

In theory it looks right but I don't know AppleScript or how curl PUTs values.

Someone like @flyingdiver can probably help here.


Sent from my iPhone using Tapatalk

Posted on
Mon Apr 04, 2016 7:34 am
Different Computers offline
User avatar
Posts: 2579
Joined: Jan 02, 2016
Location: East Coast

Re: Watched folder to trigger Indigo?

More experimenting got that script above to compile in Script Editor AFTER I replaced the curly quotes with straight quotes.

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

Posted on
Mon Apr 04, 2016 8:01 am
FlyingDiver offline
User avatar
Posts: 7249
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Watched folder to trigger Indigo?

Different Computers wrote:
More experimenting got that script above to compile in Script Editor AFTER I replaced the curly quotes with straight quotes.


Yeah, fancy quotes are a programmer's nightmare. Never use a word processor (TextEdit or worse) for editing scripts.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest