Multiple Trigger Points

greatbignerd
Posts: 2
Joined: Sat Sep 22, 2018 4:07 pm

Multiple Trigger Points

Post by greatbignerd »

I've been reading up on the forum and reading up on some of the Device State options, primarily thinking about the "Heatpoint/Coolpoint within x degrees of ambient" and would like to use that device state to control a Fanlinc.

However, I would REALLY like to have multiple trigger points so I could set the fan speed depending on how far from Target the Ambient is (I have a Haiku fan in one room and love how intelligently it sets its speed based on presence and temp points)

For example:
Heatpoint/Coolpoint is set to 72 degrees,
If Ambient is 74, fan speed should be set to low (target within 2 degrees of ambient)
if Ambient is 76, fan speed should be set to medium (target within 4 degrees of ambient)
if Ambient is 78, fan speed should be set to high (target within 6 degrees of ambient)

I feel fairly comfortable working with triggers and conditions, but not so hot with the AppleScript... Any thoughts on how to accomplish my goal?
jltnol
Posts: 1162
Joined: Tue Oct 15, 2013 11:11 pm

Re: Multiple Trigger Points

Post by jltnol »

Python is probably a better fit.

You can set the trigger to be any change in the set point, and then have python evaluate ambient temps and act accordingly.

I'm no python expert, but have done similar things, so am pretty sure it could be done..

I use this bit of code to switch from AC to Heat, so this may be a good place to start.

Code: Select all

CurTemp = indigo.variables[1070604830] # "CurrentTemp"

if CurTemp.value >= "75":
	indigo.thermostat.setHvacMode(1958695313, value=indigo.kHvacMode.Cool)
elif CurTemp.value <= "60":
	indigo.thermostat.setHvacMode(1958695313, value=indigo.kHvacMode.Heat)
User avatar
matt (support)
Site Admin
Posts: 21542
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: Multiple Trigger Points

Post by matt (support) »

If you want to do a >= or <= comparison then you probably want to cast the Indigo variable value to an integer and use an integer for the hard coded value (75 versus "75");

Code: Select all

CurTemp = indigo.variables[1070604830] # "CurrentTemp"

curTempVal = int(CurTemp.value)
if curTempVal >= 75:
   indigo.thermostat.setHvacMode(1958695313, value=indigo.kHvacMode.Cool)
elif curTempVal <= 60:
   indigo.thermostat.setHvacMode(1958695313, value=indigo.kHvacMode.Heat)
Otherwise, it will be doing a string compare which might work okay in this particular case but not others.
Image
greatbignerd
Posts: 2
Joined: Sat Sep 22, 2018 4:07 pm

Re: Multiple Trigger Points

Post by greatbignerd »

matt (support) wrote:If you want to do a >= or <= comparison then you probably want to cast the Indigo variable value to an integer and use an integer for the hard coded value (75 versus "75");

Code: Select all

CurTemp = indigo.variables[1070604830] # "CurrentTemp"

curTempVal = int(CurTemp.value)
if curTempVal >= 75:
   indigo.thermostat.setHvacMode(1958695313, value=indigo.kHvacMode.Cool)
elif curTempVal <= 60:
   indigo.thermostat.setHvacMode(1958695313, value=indigo.kHvacMode.Heat)
Otherwise, it will be doing a string compare which might work okay in this particular case but not others.

Thanks for the response... Unfortunately, where I'm not very good in the AppleScript realm, I have absolutely no idea how to code in Python. I don't even understand the syntax enough to tease apart the snippets you posted and figure out how to replace them with my own devices/variables... What are those 10-digit numbers in parentheses/brackets? where do i find the equivalent objects to "indigo,kHvacMode.cool" that will refer to my fan settings? i'm totally lost on this.
User avatar
mundmc
Posts: 1068
Joined: Fri Sep 14, 2012 4:34 pm

Re: Multiple Trigger Points

Post by mundmc »

I was where you are about 1 year ago. I finally could hack stuff together with AppleScript, then I learned it just couldn’t really do what I wanted it to do. In my case, I was doing something with motion sensors, Variables for the state of the house, and brightness depending on the time of day. I put something sloppy together in python fairly quickly, and became comfortable with python in the process.

I really recommend just screwing around with python and indigo. The forums have tons of snippets and documentation. Stay away from the more complicated stuff (e.g. object-oriented class stuff) in the beginning, because it is probably way more than you need.


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

Re: Multiple Trigger Points

Post by jay (support) »

greatbignerd wrote:Thanks for the response... Unfortunately, where I'm not very good in the AppleScript realm, I have absolutely no idea how to code in Python. I don't even understand the syntax enough to tease apart the snippets you posted and figure out how to replace them with my own devices/variables... What are those 10-digit numbers in parentheses/brackets? where do i find the equivalent objects to "indigo,kHvacMode.cool" that will refer to my fan settings? i'm totally lost on this.
The numbers are the ID of the device/variable (right-click the object in the Mac client and select copy ID).

Start with the scripting tutorial, which should give you the basics of Indigo's Python scripting (not AppleScript which is being deprecated). You probably want to do one of the many beginner Python 2.7 tutorials out on the net as they will give you the basic syntax (Python is installed on your Mac so you don't need to do that if the tutorial you use has a section on installation).

More detailed information is in the IOM Reference guide (including the constants used in the script above, i.e. indigo.kHvacMode.Cool).
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
Post Reply

Return to “NEST Home”