CoRE - Get peer assistance here with setting up Pistons

Hello, first time poster here. Been using SmartThings for maybe 2 years now, and now that I’ve collected a bunch of devices I’ve really been getting into it. I started using CoRE just about a month ago (haven’t looked at webCoRE yet).

I’ve set up a piston that will control my fan speed based on motion and the temperature. I’m storing the temperature from a multisensor in a variable (or at least I think I am) and it’s actually being set to the status of the motion sensor. It all looks correct from me so maybe a second (or third or fourth) set of eyes can help me on this one.

The logic is supposed to be:

if motion is detected and temp >= 70 then
if temp <= 75 set fan speed to low
else if temp <= 80 set fan speed to medium
else if temp > 80 set fan speed to high
else set fan speed to low ## added this to use low as the default if the temp variable is not a number

What’s happening is that the variable I set is being set to “inactive” instead of a temperature value. Piston below:

I know this is not going to help with your piston, but I would leap straight into webCoRE.
I wouldn’t mind betting that what you want has already been done by somebody and unlike CoRE, you can import other peoples pistons and modify to suit your needs.
Also it is more powerful than CoRE and you can use your laptop to copy and paste statements etc.

Can anyone verify if the second IF statement in the below pistion is setup correctly please? I debated whether to use a While Loop or just the If. Basically once motion stops and the other two conditions are true, I want the 30 minute wait to start, but if motion occurs it should stop waiting and then should restart the 30 minute timer when motion again stops and the other two conditions are true. Im worried that the way I have set it up may cause repeated instances of the 30 minute wait to be scheduled. I do Cancel Task on Condition State Change set. Thanks.

Firstly this is the CoRE thread not the webCoRE thread just for future reference. :wink:

On this part…

Click on your ‘with’ and in the settings set TCP to never. You will see a red ‘N’ next to the statement when you have set it this way.
Then the timer will stop if there is motion and restart when it stops again.

Cheers! Where is the webcore thread please?

Did it work OK?

I can’t test it out until tonight, but I did get the red ‘N’ to show up, yes thanks - see below. I have to say that this seems counter-intuitive though; if the 30 minute wait is not cancelled when the motion changes to active, and another 30 minute wait is scheduled when motion stops again, won’t I then get multiple 30 minute waits scheduled?

I know what you mean about not quite sounding right. You can read Never cancel task to mean whatever happens the task will mature, but that’s not how it works.
Just for testing, change the timer to, say, 2 minutes. Then when your piston runs the first time you will see a trace button at the bottom.

When you enable that you will see the timer on the left hand side of the piston.
When motion stops you should see the timer start counting down.
When the timer matures the light should turn off.
If you get active motion before the timer matures, you should see it disappear and the when motion stops, it will start again from 2 minutes.

OK will give it a try tonight. Thank your for all your help, much appreciated.

I have a door that has a habit of not latching shut properly, which has resulted in it swinging open a few times. I need to get the door adjusted, but in the meantime I wanted to create a seemingly pretty simple piston to help alert me.

If the door closes, and then opens within 2 seconds, generate an alert.

Being new to Core I’m struggling slightly. Can anyone point me in the right direction?

Hey Guys,

I’m using yvesracine Automatic Manager and Device Type. The device type keeps track of the vehicles fuel level using fuelLevelPercent. What i’m trying to do is use CoRE to setup a automation to notify me whenever that level is below 25%. How would I add fuelLevelPercent as a variable that CoRE will keep tabs on?

Didn’t get a chance to test this last night unfortunately. I do have a follow up question if you don’t mind. How would I integrate a cancellation of the 30 minute timer as opposed to a restart? What I am trying to achieve is if the lights are turned off manually while the 30 minute timer is counting down, then the 30 minute timer should be cancelled.

You could just let the timer run down.
If it’s already off then it will just mature and do nothing.
EDIT: You could add a 4th statement in your if.
If light ‘x’ is on.
This way if the light is turned off manually the statement will become false and stop. (I think).

This is exactly how I feel! After a while, you just know that should be the way it works. Have to put the disclaimer out there just in case! :joy:

1 Like

I was afraid of the learning curve jumping into webCoRE when I was just getting to know CoRE but it wasn’t bad at all. I setup the same Piston in webCoRe and it’s actually working.

1 Like

Yes I had my old CoRE version of this piston set to just let the timer run out, the only thing that bothered me was that the notification would still be sent at the end of the 30 minutes, which was redundant if I had already turned the lights off manually. I’m being super anal I know. Yes I think your suggestion of another ‘IF’ after the wait has expired should do the trick, like the below. One minor quirk I just noticed, I have the Wait on the Location and I do see the red ‘N’ against the Location when editing the piston, but when viewing the piston after saving it, you’ll see that both Location and the red ‘N’ are not displayed. Is this a bug or a feature?

Do you have an example of how I would actually do this?

Let me know if anybody has any insight on this…

I have three dimmer switches on my outside lights.

At Sunset & 4 AM I run a piston to turn on my dimmers and set them to 20% and then at Midnight and Sunrise that same piston turns those lights off.

I want another piston to take lights to 75% for 10 mins when the front door opens and then return to whatever state they were previously in. Here is how its looking so far…

I’m noticing that sometimes the restore state isnt working. I’ve only been working on this for two night and it seemed to work the first night. I noticed last night that the lights never went back to the correct state. I think the difference may have been that last night the door was opened at 1 am when the lights were already off. They ended up staying at 75% until 4 AM when the turn on piston set them back to 25%.

I have a very simple requirement. This is available on Smart Lighting app too. But trying to implement it on CoRE.

  1. Turn on Light with Motion.
  2. Wait for 5 minutes and Turn off.
  3. If there is further movement need to reset time to 5 minute wait again.

Can someone give me an example to do this in CoRE.

if MOTION then
– LIGHTS on
– WAIT 5 mins
if Motion then reset 5 minute timer <<— Do not know how to do this?
– LIGHTS off
endif

If motion then
   Lights on
Else
   Wait 5 min
   Lights off
End if

That will work out of the box in webCoRE. For CoRE you need to set the TCP to cancel on condition state change for the action in the Else (this is the default for webCoRE)

1 Like