[RELEASE CANDIDATE] CoRE (Community's own Rule Engine)

I tried that ady. And leaving it on pm and clicking done but the screen back up shows am again. It occurs every time I setup Time on basic as an IF

Hi all

One issue I have regularly come across was after defining a new CoRE Piston.
I am currently using CoRE via GitHub and on iOS client v2.2.1 (1336). UK based as well

The Piston appears and is associated with the devices it uses for condition/trigger.
It can be seem on the appropriate SmartApps tab for the device.
But everytime I go back to CoRE, via Marketplace->My Apps->CoRE, then the last CoRE Piston is showed to me, and not the screen to access the CoRE Dashboard or any of the defined Pistons.

Does anyone have any ideas why?

You need to access CoRE from the Automations tab, not the Marketplace.

Thank you for this obvious point :wink:

1 Like

I’m having a heck of a time adding pistons. it seems every time i try and add a piston and i complete it and click done it takes me back to my marketplace screen but when i click on CoRE again it takes me back into the piston i was just creating and not to the main menu so i can’t add anymore. sometimes if i delete it and log out and back in i can get back to the main screen

See ady624s post above.
Make sure you access via the Automations tab.

Hi all again

I have an automation challenge I think CoRE can help me with but I am a beginner (see above as example).
The Use Case I want to implement is as follows -

We have a 3 story house & I want to activate the lights on the top floor (3rd), our master bedroom, when
the Motion Sensor, at the bottom of the stairs up to the 3rd floor activates
AND
the switch connected to a pressure pad & installed on the bottom stair of the staircase up to the 3rd floor is closed
AND (within a timeframe)
the switch connected to a pressure pad & installed on the top stair of the staircase up to the 3rd floor is closed.

This sequence of events means someone is going up to the 3rd floor

Any ideas?

Hi, ran into a problem that appears to have come up once or twice in the past, but not much info came out of it and the solution (from Beta Milestone 1:link to post) doesn’t seem to do anything.

Basically, I’ve got a piston that (I can’t for the life of me remember what I was doing when it basically crashed the app - Android BTW) won’t let me edit or remove it. I get: “You are not authorized to perform the requested operation” in a red box when I open it in the app, and in the log I see:

    groovy.lang.MissingMethodException: No signature of method: java.lang.String.abs() is applicable for argument types: () values: []
Possible solutions: any(), is(java.lang.Object), any(groovy.lang.Closure), wait(), wait(long), use([Ljava.lang.Object;) @ line 9541

When I try to load it up in the IDE and open the simulator as suggested in that link, none of the pistons show up for a given location. I used to be able to actually see it in the dashboard in the app, but now it just sits their with the spinning loading gear. I can pause it and un-pause it from the dash, but thats about it. I can also see it if I go to the ‘Installed Smart Apps’ section under ‘My Locations’ and get a dump of whats in it - though the device it references still exists and is in use by other stuff. The only option I have though is the ‘child app discovery’ box (which is cheked). I can copy/paste it somewhere or screenshot it - just didn’t want to clutter this thread.

@ady624 or @davew44, any ideas? (I linked you Dave since you had this happen before)

Can you please look into CoRE source code’s and copy&paste a few of the lines around the error line? I am not at the home and can’t look it up right now, sorry

Sure - looks like its in the middle of an ‘if’ statement:

if (comparison.contains("around")) {
    def range = i == 1 ? condition.o1 : condition.o2
    val += " ± $range minute${range > 1 ? "s" : ""}"
    } else {
    if ((!preciseTime) && (!recurring)) {
        def offset = i == 1 ? condition.o1 : condition.o2
	if (offset == null) {
	    offset = 0
	}
	def after = offset >= 0
	offset = offset.abs()
	if (offset != 0) {
	    result = result.replace("happens at", "happens")
	    val = "${offset} minute${offset > 1 ? "s" : ""} ${after ? "after" : "before"} $val"
	}
    }
}

I pulled some tabs out of the paste so it’d be a bit easier to read :stuck_out_tongue:

Which line was 9541?

Sorry - commented in the code now:

if (comparison.contains("around")) {
    def range = i == 1 ? condition.o1 : condition.o2
    val += " ± $range minute${range > 1 ? "s" : ""}"
} else {
    if ((!preciseTime) && (!recurring)) {
        def offset = i == 1 ? condition.o1 : condition.o2
        if (offset == null) {
            offset = 0
        }
        def after = offset >= 0
        offset = offset.abs()  //**Line 9541**
        if (offset != 0) {
            result = result.replace("happens at", "happens")
            val = "${offset} minute${offset > 1 ? "s" : ""} ${after ? "after" : "before"} $val"
        }
    }
}
1 Like

Have you tried a rebuild from the main CoRE app?

You can replace that line with

offset = offset ? offset.abs() : 0

I did actually, and for some reason half the pistons lost the ‘if’ part of the piston.

Copied the code in and get a new error in the log, but things haven’t changed otherwise:

java.lang.NullPointerException: Cannot get property 'children' on null object @ line 9371

Which has this on that line:

def conditionGroup = (condition.children != null)

I’m seeing something similar though in a different place. For me, I’m not able to get to the “Add a condition” or “Add a group” pages. When I try, I just get a “You are not authorized to perform the requested operation” error. Nothing shows up in live logging (even with all the logging options enabled).

Looking at our system logs, it looks like the page isn’t being found. I’ve traced through the CoRE code and it looks like things should be working. I’m trying to track down someone who can take a look.

2 Likes

Still having said errors?

Yeah. We haven’t figured it out yet.

So (not sure why I didn’t get you’re replies) - just to update… I busted out my old iphone and swiped at the piston I couldn’t get at and it deleted just fine - kinda wished I’d opened it first out of curiosity.

Just for the sake of some testing data:

Failed on:

  • Rooted (really wan’t worth the trouble) Samsung Galaxy S7 Edge (US) - Android 6.0.1 (The non US version has a different processor - at the moment anyway)
  • Boring Asus Tablet, P01Z (not rooted) - Android 5.0.2

Worked on:

  • iPhone 5 - iOS 9.3.2

All running the latest version of the Smartthings app at the moment - Android: 2.2.1 (Build 207901), iOS:2.2.1 (Build 1336)

Interesting to note, I noticed support for Ring doorbells last night and added mine to it using my tablet, but opening it on my S7 gave me the exact same error (on the phone) about not being authorized when I went to the ‘connect’ smartapp. I didn’t have logging open at the time so I couldn’t grab the log (my brain was falling asleep too). When I did it this morning it worked fine. As to why I added it from my tablet, the Ring page for authorizing the connection wouldn’t load properly on my phone… the “Authorize” button rendered in like, a div that was too small/not dynamic and had scrolling turned off - so the footer loaded and the everything but the portion with the button loaded…

As to whether or not it has to do with my phone being rooted… well… I’m not going to lie, my GF has the same phone, but unrooted and I have way more weird problems (slow as molasses some times - I digress). In any case, I was getting the error on the asus tablet with the piston, so… maybe yes, maybe no…?

I don’t know if that helps any :stuck_out_tongue: @ady624, the code you had me change, should I change it back?

Doesn’t matter much - it simply tries to be safe in a case that should really never happen.

Hey Adrian,

I know the topic of “why does CoRE go back to the SmartApps page when saving a Piston” has come up before many times, specifically for Android.

I was just in SmartTiles many times (6-8) since I just setup some new switches, contacts and plugs and each and every time it saved, it stays in the SmartTiles App and does not go back to the main SmartApp page.

Is there something specific they are doing to stay in the app when saving that might be useful for CoRE?

Just curious
Rick