Jump to content

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


SBlight

Recommended Posts

Posted (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 by larryllix
  • Like 1
Posted
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.

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

Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

  • Forum Statistics

    • Total Topics
      37k
    • Total Posts
      371.4k
×
×
  • Create New...