87squirrels Posted May 16, 2014 Posted May 16, 2014 I recently upgrade my 99i to a 994 and added a custom notification to one of my programs. It works great, but I'm getting notifications I don't expect. If $POND_OVERRIDE > 0 Or ( $POND_OVERRIDE is 0 And ( ( $OUTDOOR_TEMP > 50 And $OUTDOOR_TEMP > $POND_TEMP ) Or ( $OUTDOOR_TEMP > 52 And Status 'Outdoors / Pond - winter pump' is 100% ) Or ( $POND_TEMP >= 68 ) ) ) Then Set 'Outdoors / Pond - winter pump' 100% $POND_TEMP Init To $POND_TEMP $OUTDOOR_TEMP Init To $OUTDOOR_TEMP Send Notification to 'Tom' content 'Pond' Else Set 'Outdoors / Pond - winter pump' Off $POND_TEMP Init To $POND_TEMP $OUTDOOR_TEMP Init To $OUTDOOR_TEMP Send Notification to 'Tom' content 'Pond' The OR clause is to keep from switching on and off when close to the temperature threshold. If already running, don't shut off until it goes below the lower threshold. POND_OVERRIDE: <0 = off; 0 = auto; >0 = on I'm receiving notifications (always "On") at random intervals. Is this somehow happening when one of the state variables changes, even though it's already on? I see that the latest notification (arrived at 12:08) matches the last update time of the OUTDOOR_TEMP variable. Pond status update: ${sys.node.14 81 9 1.ST} ${alert.details} -------------------------------- Pond status update: On At: 2014/05/16 12:08:54 PM Program: Pond - winter pump Value: 2.1
LeeG Posted May 16, 2014 Posted May 16, 2014 A change to the State variable value causes the Program to trigger. As OUTDOOR_TEMP goes from 52 to 53, 53 to 54, 54 to 55, etc the Then clause executes Or ( $OUTDOOR_TEMP > 52 And Status 'Outdoors / Pond - winter pump' is 100% )
larryllix Posted May 16, 2014 Posted May 16, 2014 You have all that complex condition logic in an enabled programme. Every time the status of one/any of the parameters changes you will get a notification from the "Then" or the "Else Each and every time any parameter you are checking changes the whole logic statement will be tested for true or false and the appropriate Then or Else will run. Break the programme into two statements with the first triggering events and the second full of conditions that you do not want to trigger events AND DISABLED. For instance; It appears you would not want a notification every time the pond temperature or outside temperature changes one degree up or down. With the programme enabled these will be trigger events that will evaluate the whole complex logic test and execute True or False, based on that outcome. Turning your pump on when it is already on is never noticed but the notification will be.
Xathros Posted May 16, 2014 Posted May 16, 2014 I am assuming that the variables are State variables. If that is the case, anytime a state variable's value changes, any If statements that reference it will be triggered and evaluated true (then) or false (else). In this case, since you have a notification in both the then and else sections, you will get notified anytime the temp changes. I think you need to remove: And Status 'Outdoors / Pond - winter pump' is 100% It's pointless. Remove the notifications from this program altogether. Create a second program to notify on status change of the pump: If Status 'Outdoors / Pond - winter pump' is 100% Or Status 'Outdoors / Pond - winter pump' is Off Then Send Notification to 'Tom' content 'Pond' Else Hope this helps. -Xathros
87squirrels Posted May 16, 2014 Author Posted May 16, 2014 Thanks, I'll move the notification into a separate program, as suggested. I didn't realize (and wouldn't have noticed, until now), that the Then clause would be executed again each time one of the test conditions changes. Xanthros, The And Status 'Outdoors / Pond - winter pump' is 100% clause is there to keep the pump from switching on and off if the temperatures are close to each other. Once it's on, it will stay on as long as OUTDOOR_TEMP is above 52, even if OUTDOOR_TEMP falls below POND_TEMP.
Recommended Posts