Announcement

Collapse
No announcement yet.

Help with Expression - Using Condition "And If This expression is true"

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help with Expression - Using Condition "And If This expression is true"

    I haven't used expressions in my events so I'm not sure how to put together the syntax, any help would be appreciated.

    I am working on some events to determine when to turn on our HVAC to either Heat/Cool/Off. One of the conditions that I would like to create, I think will use the ET condition "This expression is true...", if there are other suggestions I am completely open to them. The expression that I would like help with the syntax is:

    ((forecast high temp + forecast low temp) /2) to get the average temp for the day and then if that average is above 75F then turn on A/C, if below 65F then turn on Heater, if between 65F and 75F then turn the system to Off.

    My guess:
    ($$DVR(###)+$$DVR(###))/2>75
    ($$DVR(###)+$$DVR(###))/2<65
    I'm not sure how to put together between 65 & 75

    I'm debating using a three day average as well so that I don't have the HVAC system potentially turning on the Heater one day and the A/C the next. There are times where we have an unusual hot desert wind that blows in for a day but doesn't justify the A/C being turned on unless it will be here for several days.

    Thanks to any that can help out with this idea!
    HS3 3.0.0.548 &HSTouch Designer 3.0.71 with 996 Devices, 547 Events
    Plugin's:
    BLBackup, BLOccupied, BLShutdown, EasyTrigger, Ecobee, Nest, AK Bond
    EnvisaLink DSC, PHLocation, Pushover, SONOS, Blue Iris, UltraRachio3,
    weatherXML, Jon00 Alexa Helper, Network Monitor, MyQ, Z-Wave 3.0.1.252

    #2
    Hey spud I've created an event for the above 75 and below 65, would you happen to have a minute to help me out with an expression that will evaluate between 65 and 75? Sorry to bother, just don't know how to create it. I assume it will have to be less than 76 and greater than 64.9 in order to include 75 and 65?
    Click image for larger version

Name:	Cool.png
Views:	126
Size:	21.4 KB
ID:	1345542Click image for larger version

Name:	Heat.png
Views:	123
Size:	21.2 KB
ID:	1345543
    HS3 3.0.0.548 &HSTouch Designer 3.0.71 with 996 Devices, 547 Events
    Plugin's:
    BLBackup, BLOccupied, BLShutdown, EasyTrigger, Ecobee, Nest, AK Bond
    EnvisaLink DSC, PHLocation, Pushover, SONOS, Blue Iris, UltraRachio3,
    weatherXML, Jon00 Alexa Helper, Network Monitor, MyQ, Z-Wave 3.0.1.252

    Comment


      #3
      Code:
      ($$DVR(###)+$$DVR(###))/2 >= 65 && ($$DVR(###)+$$DVR(###))/2 <= 75

      Comment


        #4
        Originally posted by The Profit View Post
        Hey spud I've created an event for the above 75 and below 65, would you happen to have a minute to help me out with an expression that will evaluate between 65 and 75? Sorry to bother, just don't know how to create it. I assume it will have to be less than 76 and greater than 64.9 in order to include 75 and 65?
        Click image for larger version

Name:	Cool.png
Views:	126
Size:	21.4 KB
ID:	1345542Click image for larger version

Name:	Heat.png
Views:	123
Size:	21.2 KB
ID:	1345543
        It looks like you're using 3 separate events to accomplish this. I think you could also do it with a single event using "Easy Trigger: Set Device to Expression" Actions. The "expression" for that Action can be an "if" statement which let's you select the value for your device. You'll need the numeric value corresponding to Off, Heat, and Cool for the control device. You get this from the "Status Graphics" page for the device and the typical values are Off = 0, Heat = 1, Cool = 2.

        Then create your event using the Weather trigger that you indicated (or a recurring trigger; say every 15 minutes). Don't include either of the "And" conditions.
        Then in your actions, you will have 3 "Easy Trigger: Set Device to Expression" actions each operating on the HVAC Control Settings device. Set the expressions as follows (you might need to check if I got the # of parenthesis correct!):

        For the 1st Action, set its expression as follows:
        if( (($$DVR(###)+$$DVR(###))/2 >= 65 && ($$DVR(###)+$$DVR(###))/2 <= 75 ), 0, $DEVICEVALUE)

        This runs an "If" test to see if the temperature is between 65 and 75, if that evaluates to true, you set the device to 0 (off). Else, you set the device to its current value $DEVICEVALUE - in other words, if the expression is false, the action will do nothing as it just leaves the device at its current value.

        For the 2nd Action, set its expression as follows:
        if(($$DVR(###)+$$DVR(###))/2< 65, 1, $DEVICEVALUE)

        This runs an "If" test to see if the temperature is below 65, if that evaluates to true, you set the device to 1 (Heat). Else, you set the device to its current value of $DEVICEALUE - again, if the expression is false, the action will do nothing.

        For the 3rd Action, set its expression as follows:
        if(($$DVR(###)+$$DVR(###))/2>75, 2, $DEVICEVALUE)

        This runs an "If" test to see if the temperature is above 75, if that evaluates to true, you set the device to 2 (Cool). Else, you set the device to its current value of $DEVICEALUE - again, if the expression is false, the action will do nothing.


        Be sure to click on the "Send command only if expression results in a new value" advanced option for each Easy Trigger action.


        Comment

        Working...
        X