1) Give a description of the problem
The smart plug is on out of the specified time
2) What is the expected behavior?
The smart plug should only be on between 6PM-10PM.
3) What is happening/not happening?
It’s been on for 17 hours since morning according to the webcore script.
**4) Post a Green Snapshot of the piston!
Why is my smart plug on out of time frame?
You only have a condition to turn on your outlet. You need another condition to turn it off. You can make a simple timers repeat daily at 6 pm to turn on and repeat daily at 10 pm to turn off to accomplish what you want.
I see. I thought “between” means it’ll turn on at 6PM and turn off 10PM. I guess that’s not the case then. Thanks!
Okay, this is what I have. My problem right now is that when the temperature reach 68 degree or greater the smart plug did not turn off. Any suggestion?
Okay, so it’s not working as expected. It should turned on when the temperature is 68 degrees or colder and only after 6PM but it’s not.
I would code something like this:
IF Keypad's temperature DROPS BELOW 68° <-- Trigger
and
Time is after 6PM <-- Condition
Then Turn on Outlet
END IF
IF Keypad's temperature RISES ABOVE 68° <-- Trigger
Then Turn off Outlet
END IF
Every day at 11PM <-- Trigger
Turn off Outlet
END EVERY
WCmore, many thanks for the help. I gave your suggestion a tried and this is what I have. However, perhaps something is wrong in my code or what because the smart plug did not turn on at 6PM even though the room temperature is 64 degrees.
Hmmm… I don’t know if it matters, but in an IF statement, I always put the trigger first, and the condition second… I am tempted to switch lines 18 & 20 in your last screenshot…
The other possibility is:
If the temperature dropped during the day, and then an hour later the time turned to 6PM, it would not fire with the current wording.
If this was what happened, you can add a tiny block like this:
Every day at 6PM <-- Trigger
do
IF Keypad's temperature is below 72 <-- Condition
Then Turn on Outlet
END IF
END EVERY
I think the problem is in line 20. For some reason it does not recognize the drops below.
I think I over complicated this thing. I don’t need the IF statement within the every day at 6PM since I already have the IF statement in line 29. The outlet will only turn on if it is below 71F else it’ll turn off. I’ll try that tonight.
Yes, you are right! (it didn’t work because you changed the wording from my earlier suggestion) Each block of code should have no more than one trigger, with conditions following that. To clarify:
- A trigger inside a trigger will never fire.
- A condition inside a trigger will fire if true
Long story short:
Never put a trigger inside another trigger.
For example, either of these blocks will execute if the conditions are right:
IF Keypad's temperature DROPS BELOW 70° <-- Trigger (precise moment)
and
Time is after 6PM <-- Vague Condition
or
Every day at 6PM <-- Trigger (precise moment)
IF Keypad's temp IS below 70° <-- Vague Condition
Okay, so this is what I have. Why is it that my outlet turns on around 3PM and also get 6PM everyday? I’m quite confused.
The only “Turn on
” command in this piston is at 6PM.
That is the only time this piston will turn the device on.
If the device is turning on at any other time, there is probably some old programming still in effect…
(another piston, SmartApp, routines etc)
That is why I was quite puzzled. Thank you for the response. I’ll check if there is anything else that is triggering this outlet then. Again, thank you so much for the help.