Watched folder to trigger Indigo?

Posted on
Sun Apr 03, 2016 1:08 pm
Different Computers offline
User avatar
Posts: 2533
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?

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

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: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: Watched folder to trigger Indigo?

Where do I find docs on the the Restful API?

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

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: 2533
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.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

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: 2533
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.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Mon Apr 04, 2016 8:01 am
FlyingDiver offline
User avatar
Posts: 7189
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 8 guests