CoRE - Get peer assistance here with setting up Pistons

Quick question, is the "Or-If " piston type limited to just a single set of Or’s? Put another way, can that piston type do this:

F (conditions1) THEN (actions1) OR IF (conditions2) THEN (actions2) OR IF (conditions3) THEN (actions3) OR IF (conditions4) THEN (actions4)

Or would I need to use the Latching type of piston?

This will be your first piston. You will need to enable expert mode in the settings of CoRE to accomplish this next part.

In the IF section of your piston create a group. In there you are going to check the location mode is morning. When you do that and are back in the group with this IF statement you will see a section “when true”. Click into that and set up all the actions of fading to 0 over 2 seconds, changing the color, and fading back up. You should have these all grouped by adding a task instead of having 3 single actions.

Back out to the main group now and follow the above steps for the mode being night and away. Once you do this you should see “AND” between all your groups. Click on one and change it to “OR”. This will change all of them.

The next part will be determined by how you are currently changing modes for ST.

Since the above piston is handling the lights based on the mode you only need to worry about setting the mode and not anything with the lights.

Hopefully this will help get you going.

1 Like

Easiest to just use a Simple piston with multiple conditions in it separated with OR and use “when true” on each condition for the then actions.

OK, I was trying to simplify things so I didn’t have 40 separate pistons for various automations. I’ll try your example and reread the CoRE wiki.

Just to be clear that example I gave you is a single piston. It should do everything you explained you wanted but if I misunderstood you or there is more you want to add into that piston just let me know.

Yup. That’s what I do. Refresh every few minutes and anytime one of several sensors are activated.

I don’t know if you ever got an answer. Here is an example of one of my pistons that I use the values from one RGB light set to control another.
If I change the front right set it gets loaded to the front left set. If I change the front left set, only it changes . Then if I change front right set again it will bring the front left set back in sync.

Maybe you can base your logic off something like this. I only used local variables vice global it has been working for some time now.

Here’s what I got going. My next question would be, if bedroom lights changed to off, turn off the lamp immediately (even outside of the given times).

Thanks Dustin, that appears to have done the trick.

1 Like

Hi guys,

Probably a newbie question that has been ask a 1000 times before, but I couldn’t find the answer in a quick search. Apologies up front.

Is there a simple way of duplicating pistons? I have a large install and would love to be able to copy complicated pistons to then change the specific device(s) in each case. Would speed up the creation no end.

Thanks

Paul

Not with the current version of CoRE. A new web-based version is under development and I understand that ability will exist with that version.

1 Like

Thanks for the info @lflorack. That will be awesome having a web based editor.

Now that my first Piston is working as it should, I’m working on my next one… Presence based on location Modes.

In this new piston I have this logic set:

IF everyone one is “not present” WHEN TRUE set location mode to “Away”

ELSE IF

Anyone is “present” WHEN TRUE set location mode to Morning/Day/Evening/Night based on day of the week and time ranges.

This one is much harder to test since I have to take all the phones out of the geofence, so I’m wondering if the ELSE IF is the correct thing to use to make this work as intended. Below is a screenshot of my actual piston:

Thanks again everyone for all the help.

Here is how I solved my mode switching problems.

You system should work. If you want to be able to test it then remove all the others leaving yourself and go for a drive haha

1 Like

While maybe some others in the community would know how to do it with how you built that piston I don’t. First, you are only triggering it with motion in the hallway, it won’t re-evaluate on the Bedroom Lights changing. Second, you built the actions in the THEN and not in an ELSEIF so there is no easy way I know of to do other evaluations. And you also used “only execute when” restriction which I personally don’t use so sorry it is hard for me to suggest a change there.

To do what you want I would create the piston like this:

IF
GROUP [motion in hallway AND time between A & B]
OR
Bedroom Light changes to On
THEN <<leave this blank
THENIF
Bedroom Lights are off When True: USING Bedroom Lamp - Turn On, Wait 5 Mins, Turn Off
ELSEIF
GROUP [Bedroom Lights is on AND Bedroom Lamp is off] When True: USING Bedroom Lamp - Turn On
ELSIF
GROUP [Bedroom Lights is on AND Bedroom Lamp is on AND time between A & B] When True: USING Bedroom Lamp - Turn Off

I am fairly certain that will do everything you want. The way I wrote it the Lights will always shut off the lamp when they are turned on and between time A & B. If you want the turn on the lights to shut off the lamp only after it’s been triggered by the motion in the hallway just add another AND in that last group for motion changed in last ## minutes.

You got me thinking. Can I have it evaluate via a time variable?

Time is any time of day

Then have a group with the motion

Is there a way to set temperature of a thermostat with a variable?

Load setpoint from variable.

Hummm can’t find it. It’s a stelpro thermostat.

Well, first you’ll need to save the attribute to a variable. Then you can Load state of attributes from variable. Mind elaborating on what you are trying to accomplish?