Turning off fan when Contact sensor changes to closed


#1

1) Give a description of the problem
I’ve created the attached piston, but it only seems to work sporadically. i’m sure the solution is simple and I’m just overlooking something.

Basically I want it to turn on my garage fan whenever the door is open, and the temp is above 95 degrees, and I want it to turn the fan off if the door is closed.

2) What is the expected behaviour?
Sometimes the switch turns off, sometimes it doesn’t.


3) What is happening/not happening?
(PUT YOUR INFO HERE)

4) Post a Green Snapshot of the pistonimage
(UPLOAD YOUR IMAGE HERE)

5) Attach logs after turning logging level to Full
7/28/2020, 1:43:38 PM +996ms
+1ms ╔Received event [Garage Door Sensor].temperature = 103 with a delay of 46ms
+47ms ║RunTime Analysis CS > 13ms > PS > 5ms > PE > 30ms > CE
+49ms ║Runtime (37823 bytes) successfully initialized in 5ms (v0.3.110.20191009) (48ms)
+50ms ║╔Execution stage started
+144ms ║║Comparison (enum) closed is (string) open = false (1ms)
+146ms ║║Condition #3 evaluated false (7ms)
+147ms ║║Condition group #1 evaluated false (state did not change) (8ms)
+153ms ║║Comparison (enum) closed is (string) closed = true (1ms)
+154ms ║║Condition #5 evaluated true (6ms)
+155ms ║║Condition group #2 evaluated true (state did not change) (8ms)
+157ms ║║Cancelling statement #6’s schedules…
+162ms ║║Skipped execution of physical command [garage fan].off([]) because it would make no change to the device. (3ms)
+163ms ║║Executed [garage fan].off (4ms)
+165ms ║╚Execution stage complete. (115ms)
+166ms ╚Event processed successfully (166ms)


#2

Instead of “is closed” use “Changes to closed”

You may want to use separate IF blocks for each open and closed conditions


#3

I Changed the is closed, to Changes to closed, and the fan did not turn off.

I then Separated the IF blocks so that open had it’s own, and Closed has it’s own, but it still won’t turn the fan off.

As you can see, the first part is behaving as it should, I think.

|+0ms|╔Received event [Home].test = 1595964405703 with a delay of 0ms|
|---|---|
|+43ms|║RunTime Analysis CS > 19ms > PS > 4ms > PE > 21ms > CE|
|+46ms|║Runtime (37867 bytes) successfully initialized in 4ms (v0.3.110.20191009) (45ms)|
|+47ms|║╔Execution stage started|
|+59ms|║║Comparison (enum) open is (string) open = true (2ms)|
|+61ms|║║Condition #2 evaluated true (8ms)|
|+67ms|║║Comparison (decimal) 101.0 is_greater_than_or_equal_to (integer) 95 = true (1ms)|
|+69ms|║║Condition #3 evaluated true (8ms)|
|+70ms|║║Condition group #1 evaluated true (state did not change) (19ms)|
|+73ms|║║Cancelling statement #4's schedules...|
|+347ms|║║Executed physical command [garage fan].on() (269ms)|
|+348ms|║║Executed [garage fan].on (271ms)|
|+357ms|║║Condition #7 evaluated false (5ms)|
|+359ms|║║Condition group #6 evaluated false (state did not change) (7ms)|
|+363ms|║╚Execution stage complete. (316ms)|
|+364ms|╚Event processed successfully (364ms)|

#4

Try changing line 18 to ‘contact changes to open’ It’s currently not a trigger (no lightning bolt as there is on line 29)


#5

Paul,

I did update that part, and it runs the first if correctly, but the first IF was running without that change already.

At this point I just can’t get the fan to turn off when the contact sensor is closed, or changes to closed.


#6

Can you provide a full log covering both the on and off changes?


#7

ON Log

7/28/2020, 3:08:16 PM +983ms
+1ms ╔Received event [Garage Door Sensor].contact = open with a delay of 140ms
+49ms ║RunTime Analysis CS > 20ms > PS > 5ms > PE > 25ms > CE
+51ms ║Runtime (37888 bytes) successfully initialized in 5ms (v0.3.110.20191009) (49ms)
+52ms ║╔Execution stage started
+58ms ║║Comparison (enum) open changes_to (string) open = true (0ms)
+60ms ║║Cancelling condition #2’s schedules…
+60ms ║║Condition #2 evaluated true (5ms)
+67ms ║║Comparison (decimal) 112.0 is_greater_than_or_equal_to (integer) 95 = true (1ms)
+68ms ║║Condition #3 evaluated true (7ms)
+69ms ║║Cancelling condition #1’s schedules…
+70ms ║║Condition group #1 evaluated true (state changed) (15ms)
+72ms ║║Cancelling statement #4’s schedules…
+322ms ║║Executed physical command [garage fan].on() (246ms)
+323ms ║║Executed [garage fan].on (248ms)
+328ms ║║Comparison (enum) open changes_to (string) closed = false (0ms)
+330ms ║║Condition #7 evaluated false (3ms)
+330ms ║║Condition group #6 evaluated false (state did not change) (5ms)
+332ms ║╚Execution stage complete. (281ms)
+333ms ╚Event processed successfully (334ms)

Off Log
7/28/2020, 3:09:28 PM +939ms
+1ms ╔Received event [Garage Door Sensor].contact = closed with a delay of 61ms
+53ms ║RunTime Analysis CS > 20ms > PS > 6ms > PE > 28ms > CE
+55ms ║Runtime (37885 bytes) successfully initialized in 6ms (v0.3.110.20191009) (53ms)
+56ms ║╔Execution stage started
+62ms ║║Comparison (enum) closed changes_to (string) open = false (0ms)
+64ms ║║Cancelling condition #2’s schedules…
+64ms ║║Condition #2 evaluated false (4ms)
+65ms ║║Cancelling condition #1’s schedules…
+66ms ║║Condition group #1 evaluated false (state changed) (7ms)
+71ms ║║Comparison (enum) closed changes_to (string) closed = true (1ms)
+73ms ║║Cancelling condition #7’s schedules…
+73ms ║║Condition #7 evaluated true (5ms)
+74ms ║║Cancelling condition #6’s schedules…
+75ms ║║Condition group #6 evaluated true (state changed) (7ms)
+77ms ║║Cancelling statement #8’s schedules…
+83ms ║║Skipped execution of physical command [garage fan].off([]) because it would make no change to the device. (1ms)
+84ms ║║Executed [garage fan].off (3ms)
+86ms ║╚Execution stage complete. (31ms)
+87ms ╚Event processed successfully (87ms)


#8

In the off log at +83ms - it thinks the fan is already off. Before closing the door, does the fan show as running on the smartthings app?


#9

Yes it does, and is physically running.

I re-ran this, and I can see the sensor state change form open to closed in the app, but I see no change to the fan within the app when the door closes.


#10

Oddly, Today this worked just fine, with no changes to the piston.


#11

Thats good. I can’t see anything wrong with the piston. Just a thought, is the fan using a local or cloud device handler? Sometimes command don’t get through, this can be made worse if there’s a lot of traffic on your network.


#12

It’s cloud based, so that makes sense to me. Thank you for the insight.