CoRE - Get peer assistance here with setting up Pistons

How the heck do you do that? Is there an option to do that?

The same way you added the first part.

For the love of me I can’t set a global variable in WebCore. I set it as

define variable and enter name of @AC and it changes @ to _.

What am I doing wrong?

I have been trying to set up a piston that will turn on and off then back on five times with a 1 second pause in between. Can this be done? I haven’t had had any luck.

I think the issue you’ll have is that the timing of 1 sec intervals is so short, I don’t feel it would be consistent. Do you have a screenshot of the piston you’ve tried using.

Hi CoRE experts,

I have two questions regarding lookback conditions – i.e., a condition that something happened in the last N minutes:

  1. What is the best way to implement the condition “routine was executed in the last two hours?” Under “Routine” I see only “executed.” There is no option “in the last” where I can enter a time lookback.

  2. What is the best way to implement the condition “garage door was changed to open in the last one minute?” Under “changed” I am able to set a time threshold, but I cannot also require that it was changed to open rather than to closed.

Any advice would be welcome. Thanks!

Ken

what are you trying to accomplish? I’m sure there are ways to accomplish the task but you are trying to describe the method/process by which you wish you use rather than the goal.

Sure.

  1. I want a particular motion sensor to turn on lights only between sunset and the time “Good Night” is run. I had in mind a CoRE condition like “sensor detects motion AND time is between sunset and sunrise AND Good Night has not run in the last eight hours.” I don’t want to accomplish this using modes because I am already using modes for something else.

  2. I want the contact sensor on the door from our house to our attached garage to trigger a closing of the garage door when it is likely it should be closed. I had in mind “door sensor changes to closed AND garage door was opened in the last minute.”

Any thoughts welcome!

@kenfeyl I highly recommend that you use WebCORE instead of CoRE. It can accomplish everything you have stated above. A good place to start is the WebCORE community forums. There is a section of example pistons that you can check out. They also have instructional videos on what WebCORE is and how to install it. If you have any questions after you install WebCORE, you should post any questions on their forums and one of the many experts will gladly assist you. :slight_smile:

I really need some help as I have been going crazy for two days trying to get my pistons to work through SmartThings. What I am trying to do is to be able to control my home theater system by voice via Alexa and my Harmony hubs. There is a harmony Alexa app that works very well for starting and stopping activities and executing video controls like pause and fast forward, but you cannot execute button commands like opening the channel guide on the cable box. To accomplish this I am using a brilliant app built by KuKu called KuKu Harmony. I got this up and running fine, but I am having a problem executing it through ST. I am doing this to help my wife who cannot operate the remote for the HT, but if she can just speak commands, she is fine.

I was able to get it working well through IFTTT, but there are lags and it is confusing to have to say Alexa, trigger… for some commands, but not others. So my idea was to create commands linked to virtual buttons that I can then link to Alexa routines, which will allow me to set any voice command I want.

My challenge was to figure out how to trigger the commands through ST. I finally came up with a solution to create a piston that would trigger the command in KuKu Harmony and then another piston to trigger that piston. I created a virtual button to trigger the piston and open the DVR Guide. When I test the piston in Webcore it works, but when I push the virtual button in the ST app, nothing happens. When I go to ST IDE I can see in the events list for the button that it registers as being pushed but nothing happens.

Here is the piston to execute the KuKuHarmony command to open the Guide:

When I test it, the guide opens fine.

Here is the piston that triggers the above piston:

Again, in works when I hit the Test button, but it does not work when I press the simulated button “test” in the ST app.

Does anyone have any idea what the problem is? Or maybe someone can point out a more efficient way t accomplish my goal.

I would very much appreciate any assistance.

Cheers,
Ray

Ray - your second piston isn’t subscribed to anything.

We will assume your ‘test’ device is a simulated switch device.

What you then need to do is where you have: with ‘test’

Change to:

if Test.switch=on then
…Do Stuff
…with test
…off()
…end with
Else
…Don’t do stuff
Endif

This will subscribe your piston to the test switch event and fire every time it’s switched on. (note I turn it back off after I do whatever you wanted it to do)

when you make the edit, note the little lightning bolt that appears next to the if clause that tells you that clause subscribes to a device or event.

Thanks for the help- my ignorance is going to show, but in order to have Else …Don’t do stuff do I just leave else blank?

1 Like

You are correct, sir. and ignorance is OK because you ask questions and learn how to not be ignorant. :slight_smile:

Thank you- it is now working. I suspected user error.:grin:

1 Like

OK I cant find it I know it is there but what I want to do is if temp 1 is greater than temp 2 +1.5 degrees then execute. I cant find where to add the 1.5 degrees

Matt, in your condition (TV Room Motion’s temp) It looks like you selected a specific device and then the attribute temp. To do what you want, you’re going to need to do some math in an expression.

I have a piston that basically does the same thing you’re doing and controls a space heater. Here’s how I do it:

  • I have a global variable that stores my tolerable drift (integer in degrees) and set that =5
  • I create a local (integer) variable to store the current reading from my home thermostat’s setpoint and then use set variable to load it. at the beginning of my piston
  • in the comparison statement above where you compare to Kid Kitchen Temp, I compare to an expression, and in that expression I do the math…
    It looks like this:

Good luck!

1 Like

thank you for the reply. I found doing this was a simple enough way of getting what I needed

image

Hoping to get some assistance in building my first piston. I want 2 of my lights in the hallway to blink and stay in the previous state when there is a knock at my door. I have a samsung mult-sensor, and hue lights all connected to my smartthings.

Hi All,

A piston i have setup is running sometimes and not others. I’m clearly doing something wrong but can’t figure it out.

Here’s what i want to do .

IF TIME IS BETWEEN 4AM & 7:55AM
AND
ENSUITE THERMOSTAT TEMPERATURE IS LESS THAN OR EQUAL TO 15

THEN

USING ENSUITE THERMOSTAT
SET HEATING POINT TO 27
WAIT 30 SECONDS (I WAS TESTING IF THIS HELPED)
SET TO HEAT

It fired yesterday but not this morning. It says conditions are true but current state = false when it shoudl have fired this morning.

here’s a screenshot

Try setting it to heat prior to changing the set point.