CoRE and Piston Rules Engine, first design steps

Thank you. It’s doing exactly what I want now.

It turns on when door opens and turns off when door closes. However that makes sense. The BUT IF statement would run on every door close.

My other question is how to i make the “Then” a “When True”?

Oh sorry. Remove the two but if conditions, add a group with two conditions and a condition:

BUT IF
   (
      Light is on
      AND
      Door changes to open
   )
   FOLLOWED BY
   Door changes to closed
THEN
   Using light...
      > Turn off

Add the first group with the two conditions, then get out of it and add the last condition. After that tap the AND between the group and the condition and make it a FOLLOWED BY.

Let me know how that works :wink:

First let me say that CoRE has made my SmartThings hub actually usable. It is almost the only thing I use to drive the automation projects in the home. Without it I would be looking at a completely different solution and really appreciate all of the efforts.

One question… I have several 4 in 1 Zooz sensors that trigger lights based on motion. Part of the trigger is a variable that indicates whether or not the lights should come on at 100% or 20%. 100% is the normal routine and the 20% is essentially a night-lite / don’t sear my eyeballs when I’m half asleep and walking through the house level. A separate goodnight piston sets the variable to 1 for night-lite and a morning piston places it back to 0.

For some reason the variable seems to slow down the execution considerably. Without it the lights turn on within a second and with it it seems to take nearly 6 or 7. This may not be related to CoRE, could be a red herring, but I wanted to see if anyone else had a similar experience or if there is a better approach.

It may be that using @ variables slows things down as the parent app needs to run and save those variables. Taking a slightly different approach with webCoRE for this exact reason.

Why use a variable and not a location mode or time restriction on actions/tasks?

IF
   Kitchen motion changes to active
THEN
   Using Hallway Lights...
      > Set level to 100% (only for Home mode)
      > Set level to 25% (only for Night mode)
...

or using action time restrictions:

IF
   Kitchen motion changes to active
THEN
   Using Hallway Lights... 
      > Set level to 100%
   Using Hallway Lights... (only if time is between this and that) <<< set the TOS for this one to Local (not Action) - this will cancel the 100% of the above action
      > Set level to 25%

… or use a virtual switch, see if that makes it faster

2 Likes

This is how my kitchen lights work:

The piston won’t interfere with my lights if I turn them on manually (or via Alexa) - the lights will stay on until I turn them off myself. They also dim for 15 seconds before being turned off when the piston has control of the lights.

1 Like

Makes sense. The variable to keep the lights working manually is a good idea. I’m thinking, though - could be wrong, the parent app isn’t being run if we are referring to the same thing. Essentially I have a large ‘Goodnight’ piston that runs, does a bunch of magic to the locks, lights, TV, etc., pauses the bedroom motion piston to keep lights from coming on every time we move and then sets the variable to 1. No other reference to the variable (besides the lights coming on) is made until morning when turning on a bathroom light signals awake and turn the variable back to 0.

Not using a location mode is simply because of my own short-sightedness when I originally set everything up. I have several other automation events via a node-red implementation, shell scripts via web calls, etc. that rely on a fixed set of modes that doesn’t include night. They are pretty integrated into environmental, presence etc… I’m lazy and don’t want to redo them all is the simple answer… :slight_smile:

Time of day is difficult simply because the goodnight routine might happen at 11pm, 3pm or 4am depending on the house schedule.

Now that I’m done with the excuses I’ll try the virtual switch, didn’t even cross my mind, and look at pulling out a piston and running it against a location mode temporarily to see if that makes a difference. If so I’ll just have to not be lazy… it’s also possible it’s the Zooz sensor but it ‘seems’ to be pretty repeatable.

What sets {autoKitchenLights} back to false?

Second last task in the last action

Question, will CoRE eventually work offline? I know ST has to whitelist specific apps. My internet stops working regularly and it would be preferred that my pistons continue to run offline, maybe even setting one up to automatically reboot my modem. Appreciate any info.

How do you switch the state of a global bool variable? I couldn’t figure that one out yesterday. Anyone?

The short answer is NO, the loger answer is never, but @slagle might have a different opinion, who knows…

If I’m understanding it correctly. I created a DO piston that sets/alters variable values, like the one below, I just edit the variable name and value I want.

Using location...
► Set boolean variable {@lockUnlockedTimeVarSet} = false
1 Like

I think I tried that but it didn’t work. Ill try again. Was thinking that it must be a way to select the global variable I want to update rather than keying it… Thanks though!

Ah, yep, I think I did try to edit directly but couldn’t and I didn’t want to delete and reset the variable so I ended up doing that DO piston. I really haven’t used it much so it wasn’t such a pain… yet :smiley:

This is probably a pretty simple piston idea.

I am trying to setup a piston with a Virtual Dimmer device handler I just added through the IDE. I’d like when the Virtual Dimmer changes, 2 physical light bulbs use the same settings (level and switch).

The level adjusts to match the virtual dimmer almost instantly, however turning off/on the virtual dimmer doesn’t change the physical switches. I can see the switch variable changing correctly. Did I use the wrong option for this task? Would this be better written in a different way not using variables?

so my motion light goes on when wind speeds hit a certain level so I want to shut off the switch if it reaches above X. However looking at CoRe values for gust and windspeed you cant us less than equal to or between. any suggestions?

So no one has done anything with wind speed?

I have not tried what you’re doing but if in between in not available, you can try saving wind speed value to a variable and then use the variable capability to check if it’s within.your target range.

yep that is what I am trying. First time I had to do this so we will see how it works