Multiple Trigger Points

Posted on
Sun Sep 23, 2018 10:58 am
greatbignerd offline
Posts: 2
Joined: Sep 22, 2018

Multiple Trigger Points

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?

Posted on
Mon Sep 24, 2018 11:35 am
jltnol offline
Posts: 378
Joined: Oct 15, 2013

Re: Multiple Trigger Points

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)

Posted on
Mon Sep 24, 2018 11:42 am
matt (support) offline
Site Admin
User avatar
Posts: 19086
Joined: Jan 27, 2003
Location: Texas

Re: Multiple Trigger Points

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

Posted on
Tue Sep 25, 2018 11:24 am
greatbignerd offline
Posts: 2
Joined: Sep 22, 2018

Re: Multiple Trigger Points

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.

Posted on
Wed Sep 26, 2018 12:49 am
mundmc offline
User avatar
Posts: 457
Joined: Sep 14, 2012

Re: Multiple Trigger Points

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

Posted on
Thu Sep 27, 2018 10:43 am
jay (support) offline
Site Admin
User avatar
Posts: 15338
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Multiple Trigger Points

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

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 0 guests