Page 1 of 1

compare temps

PostPosted: Sun Jul 05, 2015 12:18 am
by cdeggz
Trying to get indigo setup to do some commands when the outside temperature is colder than inside (shut off ac, start fan).

Looks like I can easily trigger with a weather snoop temperature changes above some set constant

Looks like I can also trigger based off the inside temperature relative to some content

Not sure how to trigger from one (nest plugin) to the other (weather snoop plugin)

I assume I could just do this with an Applescript. Is there an easy way to dig through all the available property names? I'm a beginner to AppleScript language (but have done a lot of programming).

Re: compare temps

PostPosted: Sun Jul 05, 2015 4:27 am
by DaveL17
For custom plugin devices, you can see a list of all of the custom states directly below the device details window. Select the plugin device, and then right-click on the custom state and select the information you want. There's not a "Copy AppleScript Reference" option, but you should be able to infer pretty easily from the information that's there.

I'd strongly encourage you to use Python over AppleScript--especially if you are still learning--It's not that much harder to pick up, and it's a much better option IMO.

Dave

Re: compare temps

PostPosted: Sun Jul 05, 2015 10:23 am
by jay (support)
In fact, you have to use Python. Custom devices (and their states) aren't available in AppleScript.

Re: compare temps

PostPosted: Sun Jul 05, 2015 11:06 am
by cdeggz
In fact, you have to use Python. Custom devices (and their states) aren't available in AppleScript.


Thanks! That makes me feel better about myself after failing to get it to work with AppleScript for 3 hours last night!!

I'd strongly encourage you to use Python over AppleScript--especially if you are still learning--It's not that much harder to pick up, and it's a much better option IMO.


Python looked a lot more familiar to me. I have done a lot of JavaScript work. I actually wrote it in Python first, but later learned I can't just dump my python work into script box for a conditional trigger, correct?

I'll go do some more reading on Python/Indigo 101.

Re: compare temps

PostPosted: Sun Jul 05, 2015 12:32 pm
by DaveL17
Python looked a lot more familiar to me. I have done a lot of JavaScript work. I actually wrote it in Python first, but later learned I can't just dump my python work into script box for a conditional trigger, correct?

If I'm understanding your question correctly, sure you can. Set up your trigger and conditions, then:

    Actions tab
    Server Actions
    Script and File Actions
    Execute Script (embedded script or from a file.)

Re: compare temps

PostPosted: Sun Jul 05, 2015 1:13 pm
by cdeggz
Ahh, so I ignore the conditions tab, execute the action and then just do conditions in the python script. I should have thought of that!

Thanks for all your help. This will open a world of possibilities!

Re: compare temps

PostPosted: Sun Jul 05, 2015 1:26 pm
by DaveL17
cdeggz wrote:
Ahh, so I ignore the conditions tab, execute the action and then just do conditions in the python script. I should have thought of that!

Thanks for all your help. This will open a world of possibilities!

You can still use Indigo conditions if you'd like, but scripting them will obviously work too.

I use scripting conditions with my climate control automation. I have conditions within the script to check for weekday/weekend, home/away, etc. to determine set points.

Re: compare temps

PostPosted: Mon Jul 06, 2015 9:02 am
by jay (support)
cdeggz wrote:
I actually wrote it in Python first, but later learned I can't just dump my python work into script box for a conditional trigger, correct?


Correct - the embedded script box on the Conditions tab is only for AppleScript. As someone else suggested, just write your script in an Execute Script action and manually execute the appropriate actions (most easily through Action Groups) if your conditional logic warrants it.