Task Cancellation on new temp data


#1

1) Give a description of the problem
I cannot get the while loop to keep running consistently. Any time there is a temp update it jumps it out and screws it up. I have change settings on cancellation and execution policies and still can’t get it to run correctly.

2) What is the expected behavior?
The temp goes above 98, then fan circulation cycling runs until the temp drops below 98.

3) What is happening/not happening?
It cancels the while loop of new temp change report.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
(PASTE YOUR LOGS HERE BETWEEN THE MARKS THEN HIGHLIGHT ALL OF THE LOGS SND CLICK ON THE </> ICON TO FORMAT THEM)


#2

On your first if, try adding an ‘OR temp IS greater than 98’. When the wait comes back to the piston, it can’t get past the trigger because it is expired. Adding the condition will let it get back to the loop.


#3

Thanks for the reply. Not quite the issue. It is supposed to stay in the while loop, but the new temp reading causes the IF to restart.


#4

Every time it comes back from the wait, it restarts.


#5

Whenever you subscribe to a device’s attributes,
(in your case, Contact Sensor 4’s temperature)
…then anytime there is a change in that attribute (either up or down),
the entire piston runs thru the code from the very top to the very bottom.
(executing anything allowed in the conditions)


One way around this is to make the trigger time based, and make the temperature a condition, like:

ϟ Every 20 minutes                  <-- Trigger
  Do
      IF temp is greater than 97°   <-- Condition
          Then do stuff
      END IF
  END EVERY

With this method, you can delete line 31 (Wait 15 minutes)
Also, the only trigger is time, so changes in the temperature will never activate the piston.


#6

Dammit this is beautiful :disappointed_relieved:

Will try this today, but looking at it, it looks all set.


#7

I need to find a way to get the notifications in there for when it starts, and when it finishes.


#8

You should be able to insert those commands directly in the code. (in the “do stuff” section)

I am walking out the door now, but if you can’t get it, please post a new green snapshot, and I will look at it in a few hours when I get back


#9

Thanks, I got that much, but in there it will just keep spamming me with messages every 20 minutes. Was hoping to get a message when it finally starts up and one when it is done.


#10

Ahh yes. I think using variables will be the solution to that


#11

Cool, was my thought. Set a bool true on start. I’ll upload what I come up with.


#12

Hopefully this will only trigger on the variable state change.


#13

Looking pretty good. The only changes I might consider is making the “Set variable = true” to happen before the wait, so you get notified when it starts instead of when it finishes. Also, you have a 1 degree overlap as well. 95 degrees matches both the first and second IF blocks.


#14

So I had to change the statement that sets the boolean false to a normal condition from a trigger. The trigger was interrupting the main routine. Now it won’t send the notification that circulation has stopped. Does that if need to be moved into the main routine to work, or do yo have any better ideas? Otherwise, it is working great.


#15

Interesting note too, the initial transition of the bool to true triggers the change to true statement and that kicks it out of the loop. Think it will jump back in when the 15 minute timer trips again.


#16

You can change line 36 to:
IF Contact sensor 4’s temperature drops below 95 degrees

This turns that line into a trigger.


#17

I had to change that to a normal condition because the trigger made it jump out of the 5 minute run wait.


#18

Hmmm… TCP set to Never in that block should keep it running…

The only thing I would expect to see when the temp drops is the premature notification
(in other words, the notification should occur before the fan returns to auto)


#19

LOL! That has been driving me nuts, because it doesn’t! Not sure why. Not sure what to do. Maybe I need to set one of the other settings in the IF’s.


#20

Ignoring the notification for the moment, can you confirm that the fan did not return to ‘auto’ after 5 minutes?

If it did not, then maybe clear the logs, and then set logs to ‘max’ to try to capture the details from behind the scenes.