[DEPRECATED Thread: visit community.webcore.co for assistance] webCoRE - Piston Design Help (ask your fellow members for assistance)

Yes you can compare temperatures. There is an example on the wiki in the samples.

1 Like

take a look at the samples page on the wiki. If you scroll to the bottom or click my name in the top you will see some examples of how I am controlling modes and SHM.

What makes you think the routine did not run? Minimal logs like those will not show execution of tasks - you need Medium for that. Did you make the IF execute on condition state change only? Which condition? Remove that please

The routine disarms the alarm. It did not disarm. Also the ST log shows it did not run.

Those are all fine, but I just want to run the routine.

I guess I’m still confused on the state change condition. I have read the WIKI. I thought that would be necessary to prevent the piston from running multiple times for that minute. I ran into this on another piston and had to set it that way.

Execute on condition state change only prohibits a statement to execute unless a parent condition has just changed. It makes no sense having this restriction on a top level statement, as there is no parent condition to change any state. Understand now?

Pistons only run on events. Events include:

  • device attributes changing (if subscribed to),
  • global variables changing (if subscribed to),
  • time conditions (two events per day, except for time is any which triggers no event) (if subscribed to)
  • time triggers (one event per day),
  • timers (one event per interval),
  • timed triggers (stay will generate an event when the specified time is up and if the value did not change),
  • timed tasks (one event when the wait is up).

Nothing else runs a piston, it does not continuously run, it only runs on any event described above.

The execute on condition state change is mostly needed (but not limited to) for chatty devices, like power meters, where the various similar values are being received as events. It effectively converts the whole parent condition into a trigger because it runs the statement when the condition changes to true.

1 Like

Just to clarify my pea brain. If you had a piston that says
IF switch is On, THEN do something
With the conditions set to always run, would it continually execute the THEN part as long as the switch was on?

I guess that is what is confusing me as to the IF getting triggered as a one shot or something continuous.

By the way, I changed the piston as you suggested, modified the time so I could test it and it worked fine.

No, no piston ever runs continuously. Unless you do an infinite loop, but even then, ST would stop it after 20 seconds. Everything is event driven.

switch is on
or
switch changes to on

they both subscribe to the very same event, an event coming from the switch attribute. They’ll run when the switch is on, or when the switch is off, but their conditions will filter events that are not needed. The trigger changes to on in itself is the exact same thing as the condition is on. The only difference is, when multiple conditions/triggers are involved (not just that one), then the trigger subscribes, the condition may not (if there are other triggers). When mixing triggers and conditions, triggers get a privileged position and only they can subscribe for events, so you can do 'if the light is on when I come home" <<< I come home needs to be a trigger, the light is on needs to be a condition - because you’re looking for the moment you came home, not when the light turned on. Hope it makes sense?

Yeah, that does make sense. I had thought since those same sensors check in with other data (temp, humidity, lux levels, etc) that it would trigger at those times. But I guess not.

Thanks!

I think I’m getting the hang of it…

Having come from a programming background where if is always true if on and then always runs, I have to get my head wrapped around it being an event or a happening rather than a continuous condition.

Thanks for all the help.

The only example I see in the wiki with temp is a weather one, and it is not comparing the temp of two devices, which I can do, but I can’t figure out how to enter the offset temp.

Quickest way I can think of is enter this into the expression for comparrison:

[Thermostat:temperature] + 3

So, it would look something like…

If
Door to Deck temperature is greater than or equal to [Thermostat:temperature] + 3
Then

1 Like

thanks, that did the trick.

I posted in the CoRE thread but have now learned of WebCoRE.

I need help in designing a Piston for my bathroom scenario below.

Turn On Bathtub and Shower lights when door is open
Turn Off Bathtub and Shower lights when door is closed
This is where I get confused: Turn off Bathtub and Shower lights when no motion for 10 minutes. Where do I put this???

The washer and Dryer is also in the bathroom and we shut the door when it is running but I don’t want the lights on.

Here is what I have so far:

I also would like to add a time clause that only does this between sunrise and midnight, but can’t find this option…

I have a motion sensor and a contact sensor in the Bathroom.

Here is my updated Piston. I’ll try it out once I get home.

I know I’m missing something. How do I compare a value against another value with an offset like in the core example? Do I need to setup a variable?

Scroll back up to post 73, same I think.

1 Like

Exactly what I needed. Thanks