View unanswered posts | View active topics It is currently Wed Jun 19, 2013 7:06 pm



Reply to topic  [ 5 posts ] 
 Comparing device states to each other for a trigger? 
Author Message

Joined: Sep 05, 2011
Posts: 14
Post Comparing device states to each other for a trigger?
I want to have an alert that fires if the temperature as seen by my thermostat (T1800) drops a few degrees below the set point while the heat is on (This is to detect a failure in the furnace that the thermostat is controlling).

I can trigger on the zone temperature in relation to a constant; how can I compare the zone temperature to the set point? Or in general, how do I use more than one device state in a condition?


Fri Oct 26, 2012 7:00 am
Profile
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 6859
Location: Austin, Texas
Post Re: Comparing device states to each other for a trigger?
You can do it in an AppleScript condition or you want to use Python then use a python script action that tests the various conditions and if they are all met then execute some action group.

_________________
Jay (Indigo Support)
Image


Fri Oct 26, 2012 11:14 am
Profile WWW
User avatar

Joined: May 10, 2012
Posts: 228
Location: Newcastle Upon Tyne, England
Post Re: Comparing device states to each other for a trigger?
I have a lot of Applescripts setup to do this, but it would be nice to define conditions in the GUI per action rather than per trigger/schedule/action. Perhaps something to put on your exceptionally long wish list? ;)

_________________
Is it bad every time I mention my HA hobby to people they always think of this? http://www.youtube.com/watch?v=XaNuB52_Irc


Sat Oct 27, 2012 4:02 am
Profile
Site Admin
User avatar

Joined: Jan 27, 2003
Posts: 11815
Location: Texas
Post Re: Comparing device states to each other for a trigger?
durosity wrote:I have a lot of Applescripts setup to do this, but it would be nice to define conditions in the GUI per action rather than per trigger/schedule/action. Perhaps something to put on your exceptionally long wish list? ;)

Sure, we'll add it to the list.

In this particular example what I would do in this situation is probably create a Trigger action for whenever temperature value changes at all. Then for the action I would use a small embedded python script write the difference of the temperature and the setpoint to a variable value called _tempToSetpointDifference.

Then I could use that new value both on Control Pages and in the final trigger or conditional. That probably doesn't simplify the example much (some could argue it is more complicated), but it does help break down the logic into smaller pieces so you can use the UI for the final trigger/conditional logic.

_________________
Image


Sat Oct 27, 2012 4:58 am
Profile WWW

Joined: Sep 05, 2011
Posts: 14
Post Re: Comparing device states to each other for a trigger?
I ended up doing it all in a Python action of a trigger, as Jay and Matt describe. Putting the difference into a variable is potentially interesting, but I also wanted to include the values in the email (which also sends me a text, since this is a relatively urgent condition):

Code: Select all
t = indigo.devices['Thermostat']
if (t.heatSetpoint - t.temperatures[0]) > 2:
  msgBody ="Check furnace - temperature (%d F) is more than 2 degrees below set point (%d F)"%(t.temperatures[0],t.heatSetpoint)
  indigo.server.sendEmailTo("nathanw@mydomain;9999999999@tmomail.net",
   subject = "Automation - house is cold",
   body = msgBody)
  indigo.server.log(msgBody)


The only annoyance I'm having now is that I want this to be conditional on the heat being enabled, but testing for that is more elaborate than I like:
Code: Select all
   "Any" "of the following rules are true"
      "If device" "Thermostat" "Mode is Heat (true or false)" "is true"
      "If device" "Thermostat" "Mode is Auto (true or false)" "is true"
      "If device" "Thermostat" "Mode is Program Heat (true or false)" "is true"
      "If device" "Thermostat" "Mode is Program Auto (true or false)" "is true"


Is there a good way to simplify that? I suppose I could encapsulate that logic in another trigger that exports a "heating is enabled" variable.


Sat Oct 27, 2012 8:22 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.