Piston execution only during the defined window


#1

1) Give a description of the problem
Need a piston to execute at certain times only

2) What is the expected behaviour?
Only execute during the defined times

3) What is happening/not happening?
If I manually turn on the switch outside the times, the piston executes and turns it off as the time is not as defined and neither if the temperature. I do not want the piston to execute outside of the defined time.

I would like this piston to only fire during the defined times, how can I adjust the code to do so? Thanks


#2

Using three conditions and no triggers (as you have done), it is not possible.

Currently, every single time that:

  • Sensor 1 presence changes (at all)
  • or, Sensor 5’s temperature changes (at all)
  • or, at 3:46am

… the piston will run top to bottom, and execute any code not blocked by conditions.

This also means that IF all the conditions are false at that time, then your ELSE block will execute…


Ideally, a piston should have a single trigger, then as many conditions as you like beneath it.

So my question for you is:
When do you specifically want this piston to run.
(I need a precise answer, not something vague like whenever you are home)


Pro Tip:

Getting rid of the ELSE block entirely will help greatly, since no action will ever be taken unless the time condition is true.

Keeping the ELSE block means that if any of the 3 conditions are false, then the ELSE block executes.


#3

Thanks, the trigger is time. Everything else is secondary. Between 3.46 and 6.02am, M-F.


#4

Time… Good… But you gave me a VAGUE time…

IE: 3:46, 3:47, 3:48, 3:49, etc.


I am asking for a specific instant that you want this piston to trigger.

IE:

  • The instant you arrive home?
  • The instant the temp drops below 80?
  • The instant the temp rises above 40?
  • Every 15min between 3:46 and 6:02?
  • etc.

#5

Apologies.

So I wake up at 4am on the weekdays at 3.46am if the temperature isn’t between the defined values, I want the heater to turn on.

Based on your bullets above, I would say every 2 mins btwn 3.46 and 6.02am


#6

No need to apologize. We are brainstorming here…


This statement contradicts your original post, but here is an untested piston that may do what you want:

Note: It stops working two minutes earlier than your original post. (at 6am)

Also, if this were my piston, I would add a tiny block to the very bottom as a safety net:
Every day at 6:03am, Turn off Heater

This makes sure that your heater is not left running all day while you are at work.


Edit:

I added your daily restrictions to the above piston.


#7

Side Note:

Do you really want the heater to come on if the temp is hotter than 80 degrees?!?


#8

Haha! I changed it to inside


#9

Can you please post your latest green snapshot here?


#10

Upon re-reading your original post & piston, (with a clear head), I think I would just get rid of the ELSE block in “ek5ep”, and convert that last block into a separate IF block at the very bottom:

IF "something" happens, Then turn off heater


#11


#12

Worked perfectly


#13

Piston “sce8q” looks good, but I am a bit confused as to why you want the condition to be “inside of range 40 and 80”.

  • Do you really want the heat on when the temp is in the 70’s?
  • Do you really want the heat off when the temp is in the 30’s or less?

If your answer is “Yes” to both questions, then you have a great piston!

I guess it doesn’t matter if I am confused by your logic… As long as you are happy with it, then I am happy.


#14

I’m in LA, it’s never below 40.

I’m in LA, my blood is thin, therefore I want to go to 80F :slight_smile:


#15

Sounds like you have a winner then!

Perhaps you can take a moment to solution a post as a solution to help others…