CoRE - Get peer assistance here with setting up Pistons

Hi all

I’m new to CoRE and have been trying to create a particular Piston but am unsure about how to go about it.

My setup:

What I’d like to achieve, and have setup through lighting director right now is to have the lounge lights, (can be individually and set level, using a group switch, or using a momentary scene switch), turn on when:

lux is below 20 AND there is motion
Turn off if no motion for 3 mins

BUT

If the lights are manually turned on using: hue widget/smartthings/sharptools - whatever. Then don’t worry about the former.

Any pointers would be greatly appreciated.

Nitin

EDIT: actually, something close to this type of logic with an external variable looks like it may be how I should structure this? (credit to ady624)

Same here, however I know many who have issues with it, particularly with the 2nd device.

Yeah that is what I am using for my kitchen lights. It uses an internal (local) variable and works as requested by you above. You do not need the time of the day condition, but add the lux condition. And adjust the waits accordingly.

Thanks Ady, I’ll attempt to copy it word for word!

1 Like

How is this catered for in the above dashboard?.. I’m having some training in understanding the variable logic and how a manual turn on as described in my original post, comes into play here?

Well, here’s the trick: if motion is detected and the light is off, it turns it on and sets a variable to true (meaning I - the piston - turned the light on). When motion stops, if the variable is true (meaning I - the piston - turned it on), then it schedules an action to turn it off later. When the light was turned on manually or by any other means other than the piston, the light will already be on when motion is detected, so nothing will happen. That’s the whole piston logic, in plain English :wink:

4 Likes

Why doesn’t this work?

Just use a basic piston for what you are doing there, and I would change those conditions to solid circle triggers.

Solid circle triggers?

The wait and the set level 0% should be two tasks in the same action. You can add multiple tasks to each action…

Also, I would use a simple piston:

IF
   Door is open
THEN
   Using light...
      > Set level to 100%
      > Turn on
ELSE
   Using light...
      > Wait 5 minutes
      > Turn off

The Turn on is there because some devices may not turn on as a result of level setting, but most will.

That looks better. I guess I should clarify though. It’s not the turning off that’s the issue, it’s the turning on/setting level. The lights in question are currently at 1%, but do not raise when the door is open. I created a simple piston if door is open, then set level to 100. Nothing happens.

is there s way to trigger a virtual switch with a variable in the name? I want to do something like this.

On motion turn on scene${currentMode}

I’ve been unsuccessful with my attempts.

You can technicaly set a string variable to “scene{variable}” but not sure how you will send the variable. What device? What task?

Thanks for laying it down, it’s going to take me a while to get my head around this. I don’t understand the 2nd ‘then’ conditions and the ‘tcp cancel on…’ part… I think I may need to take some CoRE courses!

Anyway, I will persevere. Btw, is there a way to create Pistons on a web GUI, going around the smartapp can be a little cumbersome…

Thanks again for all your help!

Nitin

1 Like

If you are doing a lot of them, and know Android a bit, some people use the Android emulators like MeMu or Bluestacks. When I first moved all my rules over I did this.

Whats wrong with this piston?

It keeps reseting the timer to 15 min with motion even though lux it above the threshold.

I had the same issue and was advised tof use 'only on piston state change ’ in the else part.
Worked or me.

Ok, I’ll give that a try. Thank you!

Can you upload an image of this piston from your dashboard? I don’t have any tasks in “Else” so I’m not able to toggle that feature.