Jump to content

How would you program if 'weather' Temperature < 'furnace' temperature then do something


SBlight

Recommended Posts

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
    ------

Link to comment
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.

Link to comment
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.

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...