CoRE - Get peer assistance here with setting up Pistons

You should see an option titled “Send notification to contacts” Then you will have the option to send via text or push and to which contact.

Wow!! How did I not see that…thanks!

I’m still pretty new and trying to figure out how to set up a piston to turn a light on randomly x number of times in a week. So, I’d have it turn on 3 random days throughout the week. Any help on how to do that?

Follow up to this issue. It didn’t make sense to me that I couldn’t have multiple triggers in the rule as long as I didn’t AND them together (I understand why multiple triggers can be an issue). I looked at some of my other Pistons and as I thought I have several Pistons that have multiple triggers that work flawlessly. What I did determine after multiple rebuilds of the Piston, tinkering with the actual CoRE code, etc. is that there are a couple of bugs related to DateTime conditions. I am not very proficient in Groovy and I have been pretty busy so I don’t know exactly where the bugs are or have a suggested fix.

The first bug happens while building the rule, when defining actions that set a variable not only does it have a tendency to change the value of the variable (which shouldn’t happen in my mind) but at least for DateTime variables (not sure about other types) it tends to also change the type from DateTime to String which causes any condition screens using the variable to crash because it tries to evaluate the condition so it can show the current result and it can’t because it expects a DateTime and gets a String.

The second bug is somewhere in the code for running the Piston. If there are DateTime variables involved things start getting flaky. I tried both local and global variables but that didn’t seem to matter. For example this simple Piston never works right sometimes the variable gets set but the trigger to turn it off never happens and other times the variable never even gets set.:

So the end result is that I rewrote the Piston using counters instead of DateTime variables (which bugs me because the time trigger is always counting down and firing every minute regardless of the state of the light and tends to show as “Past Due” a lot). I know the simpler way to do this is to simply do a wait (which is how I have other Pistons controlling lights working) but as stated earlier I want to be able to add “on” time using a double tap and if the light is already set to be on for a longer time I don’t want one of the triggers (garage door or presence) resetting it back to a shorter time. So here is my new Piston that has been working perfectly for about a week:



Can the receiver accept commands over the network?

Yes, it is a Yamaha Receiver and I used this SmartApp. I think I figured out the logic of what I am trying to as part of a larger overall “Away” scheme. Does this look good? Thanks

If: Each of Sarah and Matt’s presence is not present AND Kid Sensor is or is not present,

Then: Set Location Mode to Away, Set Nest Upstairs and Downstairs to Eco and Using Yamaha Main Zone Turn Off.

Sounds good, as long as the device is able to accept command, then there should be a way to get it to synch with your mode or just turn it off on command.

I’ve been battling my WeMo devices this week (they disconnect after an hour from smartthings and don’t come back) and in the process installed something called WeMo advanced that I was hoping would help the situation. Soon after my I started running into issues with CoRE. At first I was getting messages about not having permission. So I went into the IDE and removed all my pistons. Next, I removed all the WeMo devices. Removed WeMo Advanced. Removed CoRE. Re-installed CoRE from github.

Unfortunately the issue still persists. When I click to create a new CoRE piston, I get “An unexpected error occurred” at the top and a remove button. That’s it. When I back up one screen, I see blank slots which should be pistons, but they are not accessible, “You are no authorized to perform the requested operation”

The IDE is reporting:[error] java.lang.NullPointerException: Cannot get property ‘id’ on null object @ line 10797

I’ve shut down the hub a couple times and pulled the batteries, to no avail.

Not sure how to proceed.

There are a bunch of strange things affecting WeMo and other devices, Some think it was from the recent IOS and Android App with health checking. It is possible, but this week other things that affected my GitHub integration and and basically trashed all my entries. It was fixed my Tech support. So I would not say to delete anymore devices and contact support. You can also post in the forum as Staff watches.

Hi guys! First time using CORE here, and I’m trying to really wrap my head around the logic. I’ve never been a programmer and my tinkering with Smartthings has been all about learning from threads.

With that said, the first piston I want to tackle seems to be a lot more complicated than I thought, and I’m hoping I’ll be able to get some guidance from a kind soul.

I have 1) A Closet Door Contact Sensor, 2) A Closet Light Switch and a 3) Closet Motion Sensor.

Here is what I’d like to achieve:

Whenever the Closet Door Contact is Opened or Closet Motion Sensor detects motion, I’d like the Closet Light Switch to Turn On.

If I close the Closet Door, I’d like the piston to check if there is motion in the Closet Motion Sensor (ie. Am I still inside?). If I’m still inside, I’d like for the light to stay on. If I’ve closed the door and I am not inside, I’d like for the light to turn off immediately.

On the other hand, if I’ve walked away and left the closet door open, I’d like the light to turn off after 2 minutes.

I realize this is severely complicated and way above my current grasp of CORE, and I would be eternally grateful if anyone could point me in the right direction for piston type and hopefully help me get started with the programming?

Many many thanks!

Hi,

I’m trying to build a core piston that does the following.

When there’s movement in the kitchen: memorise the current state of dimmers (Keuken 2 Algemeen and Keukentafel) and then set the dim level to 100%.

When there’s no motion for 1 minute: restore the previous level from cache.

So when “Keuken 2 Algemeen” and Keukentafel are off and motion becomes active: Set lights to 100%. Afterwards, when there was no motion for 1 minute: Turn the lights off.
but also
When “Keuken 2 Algemeen” is at 30% and Keukentafel is at 50% and motion becomes active: Set lights to 100%. Afterwards, when there was no motion for 1 minute: Set level “Keuken 2 Algemeen” to 30% again and set Keukentafel tot 50% again.

This is what I got, but the lights are not turning off. I guess it sets my global cache again, when the lights are at 100%. But I don’t find a work around.

Tnx,

Pieter-Jan

I left earlier today and the command did not turn off the receiver as expected. I am not sure if it is an issue with my CoRE settings or if it the Yamaha smartapp/device handler issue (which does respond to on/off commands). Thanks

Create a virtual switch for testing and see if you can make it turn off using that instead. Once you get the response you are looking for then integrate it with your piston.

Something like:

IF
VirtualSwitch changes to on
Using YamahaReceiver...
  > Sending the off command here

Wow, how much things have changed, almost a year later! How do you get your report now???

LOL! I just say, Alexa, ask my home is the garage door open.
if it is, she says yes and asks if I want anything else. I say yes, close the garage door.

I’ve built 3 core pistons that control my thermostats and window open states. The overall idea to accomplish this is as follows:

If any doors/windows remain open for 5 minutes, then turn off both thermostats (Ecobee3 Lites). However, if it’s:

  • At least 79° outside
  • We’re in bed or close to it
  • We want to have the windows open through the night because it WILL be cooler, eventually
  • Upstairs windows are open

Then keep the downstairs thermostat off and leave the upstairs thermostat in auto mode. It will eventually stay within the range and not come back on.

Unfortunately, I haven’t been able to completely figure this out using one piston…I have to use 3. Bigger issue, it seems that 2 pistons are working, but one is not; upstairs came on a few mins ago while my wife was upstairs (wasn’t supposed to).

The rules are as follows:

I think a few things - first of all, I don’t know if I need repeat statements in my code (If presence and then or-if presence). I also know that the trigger after 5 minutes needs to be checked periodically. If another window is opened, it starts the whole piston over, which is not desired. I also think I may be using or-ifs incorrectly; or at least they could be better used elsewhere (I don’t have else statments completed at the end).

Please help - I think it can be streamlined, but it’s difficult to do on my phone when I cant see the entire code and rulesets.

Could someone help me with how web requests work? I’m trying to do a POST to HomeSeer to control a device on or off. I use the ISY994 as well and do this no problem with it, one field is for the URL, one is for what you want to post. When I do web request as an action in CoRE though I can’t seem to figure out where I’d put anything.

The address I use to send things is http:/homeseerip.com:8000/JSON/

Then to turn a device on for example, I would post:
{‘action’ : ‘controlbyvalue’, ‘deviceref’ : ‘200’, ‘value’ : ‘255’}

I’m just confused where I actually put those values? Again with the ISY994 one field was the URL the one above, another you’d paste exactly “{‘action’ : ‘controlbyvalue’, ‘deviceref’ : ‘200’, ‘value’ : ‘255’}” and away you go.

I’m trying to basically use a CoRE action that will send a web request above but confused how I’d do that. Thanks!

I’m suffering with increasing numbers of false alarms at night from SHM caused by SmartThings Motion Sensors.

I have my downstairs well covered with Motion Sensors (6 covering 2 rooms and a hall) so I want to setup a Virtual Motion Sensor as the only motion trigger for SHM, and then use Core to set a rule that if >1 of the 6 Motion Sensors triggers within so many seconds of each other, the Virtual Motion Sensor will activate and SHM will alert via the siren.

I’m new to Core and have been playing around. So far I have managed to get CORE to activate the Virtual Motion Sensor if ‘Any’ or ‘All’ of the Motions Sensors see motion in the last 1 minute. Is there any way to change this to ‘More than 1’?

I’ve also released that the Virtual Sensor stays on ‘Motion’ even after the motion on one of the 6 real sensors has stopped, so can I include in the Piston for the Virtual Sensor to reset or turn inactive when motion stops?

Is there a way to prevent a piston from executing by checking if hub recently came back from inactive to active?

I’m having an issue where my hub gets disconnected randomly and gets connected then goes from inactive to active which then causes my door unlock on arrival CoRe piston (using ST arrival key fob) to execute after hub is active again.

Seems like there was a hub update:

Here’s my piston

Nice unlocked at 3AM !

This also happened during the day yesterday so I can’t use the time restriction or day. Basically I’m looking for a fail-safe way to prevent piston execution if Hub is having a brain fart.

Any $variable I can use? or create my own variable and set to true if hub inactive [need to know how to check for hub inactive/active] for more than x minutes?

Just thought I’d report back my issue here for other newbies who are still trying to figure this all out.

Firstly - I’ve decided to stick with toggle switches instead of momentary switches which has helped me quite a bit - specifically to ensure our babysitters know how to turn the kids rooms lights off without needing a full training session :slight_smile:

The issue with my logic seems to have related to the fact that I was using the wrong type of piston. By changing things back to the ‘Simple’ instead of going with a slightly more complex Else-If it seemed to help me in reducing complexity enough to start making progress. I also learned that turning on debuging and reviewing the Live Logs is really useful in helping to understand why something isn’t working - which in my case was a condition I thought was ‘True’, but instead was coming back as ‘False’.

I’m now hooked!