Run when not a status


#1

1) Give a description of the problem
I tried to add a new conditional to a working piston, that it will run except when not a specific status. After making this change, it wont trigger

**2) What is the expected behavior?
I have a second piston set up to turn off the water heater a specific times because of peak demand utility pricing. This piston is the other piece, to turn it back on if it is not those peak times. It was working, but I wanted to change it up so that it also would not run when status was away

3) What is happening/not happening?
It just does not run when I think all the conditionals are being met (date, time, device off, and not a status). We came home to a very cold shower (wife not happy)

**4) Post a Green Snapshot of the piston![image|45x37]

**5) Attach any logs
1/20/2019, 6:45:17 PM +83ms
+2ms ╔Received event [Dart Water Heater].switch = off with a delay of 118ms
+101ms ║RunTime Analysis CS > 24ms > PS > 47ms > PE > 30ms > CE
+103ms ║Runtime (38154 bytes) successfully initialized in 47ms (v0.3.109.20181207) (100ms)
+105ms ║╔Execution stage started
+120ms ║║Comparison (enum) off is (string) off = true (2ms)
+122ms ║║Condition #6 evaluated true (12ms)
+137ms ║║Comparison (time) 67517206 is_not_between (time) 53100000 … (time) 72300000 = false (10ms)
+139ms ║║Condition #7 evaluated false (16ms)
+140ms ║║Condition group #5 evaluated false (state did not change) (30ms)
+142ms ║╚Execution stage complete. (38ms)
+144ms ╚Event processed successfully (143ms)
1/20/2019, 6:45:13 PM +567ms
+2ms ╔Received event [Main Water Heater].switch = off with a delay of 78ms
+105ms ║RunTime Analysis CS > 26ms > PS > 46ms > PE > 32ms > CE
+107ms ║Runtime (38153 bytes) successfully initialized in 46ms (v0.3.109.20181207) (104ms)
+109ms ║╔Execution stage started
+125ms ║║Comparison (enum) on is (string) off = false (1ms)
+128ms ║║Comparison (enum) off is (string) off = true (2ms)
+130ms ║║Cancelling condition #6’s schedules…
+131ms ║║Condition #6 evaluated true (16ms)
+146ms ║║Comparison (time) 67513700 is_not_between (time) 53100000 … (time) 72300000 = false (11ms)
+148ms ║║Condition #7 evaluated false (16ms)
+150ms ║║Condition group #5 evaluated false (state did not change) (35ms)
+152ms ║╚Execution stage complete. (44ms)
+154ms ╚Event processed successfully (153ms)

Thanks for your help


#2

Hi @hoffa
I believe the problem is having 3 conditions…
If you have a trigger followed by conditions that would solve it…

You said you have another piston turns it OFF at a specific time,
How about turning it ON at a spesific time??

IF time happens daily at XX (trigger)
and
IF location mode is not vacation
and
IF outlet 1 and outlet 3 is OFF (I don’t know if you need this one. Normally if a switch is ON sending another ON command won’t do anything - unless the switch toggles-)
then
do this do that

Edit : by the way you can put all that into a single piston by the way FYI (if that other piston only turns it off)


#3

I switch it to this

It works, but it sometimes takes a long time to trigger, do you think the order of the conditionals matters? Should the condition that is least often true be the first condition so it it doesn’t run as often?


#4

removed


#5

Sometimes I can see from the logs that this ran but for some reason the device is not changing status. (likely because I have a large network and sometimes signals are temporarily dropped). The problem is that this piston only sends 1 command to turn on then waits to be triggered again. Because the switch never turned on, it does not have a change status to from off to on to trigger again.

How do I add a loop so that it will keep triggering until the status is actually changed from off to on?

I am very new to this so please be very explicit about the code

Thank you for your help in advance


#6

Have you tried TIMER? Would that work? (I never used LOOP)


#7

I know very little about this whole process, but I was thinking that if I use a timer there is no guarantee that it will also go through if the first command did not. If there was some type of loop (I dont even know if webcore allows for this or if I’m using the correct term) that keeps triggering until it registers that the switch really is turned to on, it would overcome this issue.


#8

I will never recommend spamming your network. (which is likely the reason the original command did not go thru) This is likely also the reason why things are slow to respond in your house.


This is the logic I follow, but I start off with a precise trigger, instead of coding a piston entirely with vague conditions. (If they are no triggers in a piston, then all your conditions become triggers, which means the code runs top to bottom at each tiny event)


This is also related to a congested network. A possible band-aid is add a 2 second wait after the “Turn on”, followed by another “Turn on”. A long term solution would be to streamline your other pistons to help clear up your network traffic.

Also, keep in mind that heavy streaming or downloading (like Bittorrent) can also impact the reliability of your SmartHome. Some routers let you prioritize your SmartThings hub to a high priority, which really helps in those cases.