
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.