SBlight Posted August 7, 2020 Posted August 7, 2020 I not sure how to code the above "if", I have not problem with the action
larryllix Posted August 7, 2020 Posted August 7, 2020 (edited) 1 hour ago, SBlight said: I not sure how to code the above "if", I have not problem with the action Two programs using a State variable. State variables can cause programs to trigger when they change value. First program to sync your state variable with one of the device values. If weather temperature < 99999 Then $sVariable = weather temperature Else ----- Second program compares the two values If furnace temperature > $sVariable Then do whatever you want here Else ------ Edited August 7, 2020 by larryllix 1
jec6613 Posted August 7, 2020 Posted August 7, 2020 3 minutes ago, larryllix said: Two programs using a State variable. State variables can cause programs to trigger when they change value. First program to sync your state variable with one of the device values. If weather temperature < 99999 Then $sVariable = weather temperature Else ----- Second program compares the two values If furnace temperature > $sVariable Then do whatever you want here Else ------ I perfer a temperature != $variable to a less than, but it gets to the same place. It means the variable isn't constantly stored to the same value if the temperature didn't change, so last updated time becomes meaningful for other uses.
larryllix Posted August 7, 2020 Posted August 7, 2020 1 minute ago, jec6613 said: I perfer a temperature != $variable to a less than, but it gets to the same place. It means the variable isn't constantly stored to the same value if the temperature didn't change, so last updated time becomes meaningful for other uses. Values of device fields and variables do not trigger programs unless they change. The variable will never be written to (program will not run) unless the value changes anyway. However that method may work better for a power up situation.
Recommended Posts