CoRE - Get peer assistance here with setting up Pistons

Is there a “most efficient” build for multiple triggers/conditions/evaluations?

As in is best to…

  • Start with the least likely trigger? The most likely?
  • Start with things like date/time, then sensors, then state of lights?
  • Start with things outside your home like weather or date/time, and then move to things inside your home, like sensors, etc?
  • Or does it barely matter?

I thought perhaps build might have something to do with delay in some routines. Like motion trigger activates. Now count one and two and three then my light finally comes on, or the speak sounds or whatever. I know things are pushed to the cloud and so there is a delay. So wondering if there is a better build for efficiency or even to help reduce traffic up there.

Yeah, store the $currentEventDate into a time variable of your choice, say eventDate. Later (on a different piston run), set a time variable, say ms = $now - eventDate

You now have the number of milliseconds between the two times stored into ms. You can then set number variable minutes = ms / 60000 or seconds = ms / 1000

Good luck

So, I’m still having trouble with this Piston. Can someone please cast your eye and tell me if there is a better way to do this? The current state is:

Need some help: I have some rules set up in Rule Machine. I’m wanting to expand them a little and move them to CoRE, but I’m not sure how to set it up. The idea is that I have a weirdly shaped room. I’ve got a motion sensor by the door that leads out to the rest of the house, and it covers the “entryway” to the room so to speak but not much of the room itself. I also have a motion sensor deeper in the room. There’s a very small area of overlap, but there’s also a small area where motion doesn’t pick up at all…

What I have set up now is a rule that if the either motion sensor activates, the lights come on. If the one away from the door activates, it sets a boolean that prevents the lights from timing out. When motion registers again on the sensor by the door, it flips the boolean and activates a 3 minute timer to turn off the lights, unless the motion sensor in the room becomes active again. Most of the time, it works fine, unless I have to leave the room briefly and the sensor in the room doesn’t in the room doesn’t have enough time to register motion has stopped.

What I’d like:
Motion turns on lights
If motion by door start 3 minute timer
After 2 minutes, if motion in room is still active discontinue timer
After 3 minutes, if motion by door is active, reset timer; else if neither is active, turn off lights

What would be the best/most efficient way to accomplish this in CoRE? Any help would be appreciated! I’m hoping seeing how this one works will get me started transitioning the rest of the stuff that I still have in Rule Machine (much less complex use cases).

Honestly, I haven’t messed with CoRE at all. I already had everything set up in Rule Machine, and with all the issues, I haven’t added anything since last year. Since everything has mostly just been working, I’ve been afraid to mess with anything to try and fix a few edge cases… Thanks!

Try this…

Using a latching piston

 IF
 Door motion or room motion is active
 THEN
 Using lights
      > turn on

 BUT IF
 Door motion and room motion is inactive
 THEN
 Using lights
      > wait 3 minutes
      > turn off
            TCP - cancel on piston change

This is an example of what I think is exactly what you are wanting.

Can you be a little more specific as to what is happening… To my [untrained, non-expert] eye it looks good & should function…

In the BUT-IF section you also check for the VAR autoBathroomLights=true; personally I see no point in doing so. All you care about is that the Motion=Off &Light=On & you need to switch it off, regardless of how it got switched on…

J

Has anyone used Core to use remote sensors with their thermostats? If so what are you doing with them. How did you tell the therm to use the temp from the sensor instead of whatever your therm says it is? Or are you using comparisson numbers?

I can see how you would tell it to reference a sensor and then tell it to set the therm at a set point. Simple.
But if your downstairs sensor is 17 degrees and your upstairs Therm is 19, asking it to turn the heat up to 19 does nothing. So I’d either need to make it reference the sensor as the current temp, orrr…compare the two and adjust the set point by the difference between them.

Nest manager will use other sensors but has only day and night options. Not Sunday to Thursday night use upstairs sensor and Friday/Saturday night use downstairs sensor. that’s where I’m having to come back to trying with Core.

Thanks for any advice!

Just for reference, Save attribute to variable will allow you to use several sensors and get the average temperature.

1 Like

Thanks. That is something that looked super intimidating.
Do I have to set up a seperate piston to do the calculation? Or within whatever Piston I’m using it in?

:slight_smile:

Not sure if there is a way around this. I want to turn all the lights and sockets off in the bedroom area when I leave and turn off the main light. Problem is when anyone goes into the ensuite and the motion stops in the bedroom the Piston that turned on the bedroom light times out and turns off that light but also triggers the Master Bedroom All Lights Off piston for the bedroom area as well. Clear as mud.
I saw that there is an option for the trigger called “Interaction” so I chose Physical instead of All thinking that unless the switch was physically pressed the piston would not run and leave the ensuite lights/sockets on. Unfortunately it doesn’t work at all even if the switch is pressed off.
Thoughts around stopping the interaaction between these 2 pistons?

You could create a mode for when you are away that sets when you leave. Set up the piston to work only in all of the other modes.

You could use a variable our a virtual switch that is set when you leave and changes back when you arrive. Set the piston to use one of these as a condition.

Or, you can post a dashboard view of both of the pistons in question and we can probably help out a little better. (Not said with any nastiness)

Has anyone put together a list of CoRE pistons with links to the post in this thread or elsewhere? I’m sure there are lots of great ideas out there but it’s difficult to find ones that are completed verses ones that are in work or not working or ??? Thanks!

1 Like

There will be an upcoming wiki page with screenshot examples that @bamarayne and I are starting. If anyone else has good, working examples they may PM me with a screenshot and I can post into wiki.

For the meantime there are a lot of revelation notes at http://thingsthataresmart.wiki/index.php?title=CoREnotes

1 Like

I’d like to have a section under the main CoRE documentation page “piston examples and how-to’s”. Also, in the piston types section, at the end of each type have a link to the examples section for that piston type.

So, I’m thinking we categorize by piston type.

This section can be everything from simple basic pistons to unique edge use case pistons.

Basically showing how to do the simple things ask the way to the power of CoRE.

Ok, community, their some ideas at us for formatting and things needed in the docs.

@JDRoberts, I think we’re ready for you to branch this to its own thread, lol. :hammer::watch:

1 Like

Probably just something I’m overlooking, but…

I’m in the process of converting Rule machine Rules to CoRE Pistons.
I have several instances of this solved with two rules, but I believe that I can do it in core with one “OR IF” Piston

Scenario
Based on day of the week, a set of lights comes on the same time relative to sunset but goes off at different times. (Work nights versus Off nights)

Using an"OR IF" Piston, I want to add the different days of the week in the conditions - along with the different times for ‘off’’ in the matching actions - So that Conditions #1 match with actions #1 and versus Conditions #2 match with actions #2.

My issue is that I cannot find how to set the days of the week in each condition (1 and 2). I can find days of the week for the whole pistion, but not the individual conditions. If that’s not clear, I can try again.

TIA

You can set the days and times restrictions using the actions instead of the conditions…

Such as…

  Using lights
       > turn off at 2200 (only for night mode)(only if the day is Mon thru Fri)
       > turn off at 0200 (only for sleep mode)(only if the day is say & sun)

I suddenly can’t modify any pistons. I have about 20 pistons that all work great, but I want to make a modification, and I get the following message on screen “You are not authorized to perform the requested operation.”.

In the live log I see this everytime I open a piston (any piston) to edit:

java.lang.SecurityException: Getting properties on class physicalgraph.app.ExecutionResult is not allowed @ line 10350

1 Like

PSA

THERE IS CURRENTLY AN ISSUE WITH THE ST SIDE OF THE GROOVY PLATFORM. ST IS AWARE AND USD INN WORK ON THIS.

IT IS RECOMMENDED BY THE DEVELOPER OF CORE TO NOT ATTEMPT ANY CHANGED TO ANYTHING AT THIS TIME. @ady624

SO, SLOWLY BACK AWAY FROM THE PHONE. PATIENCE IS KEY.

5 Likes

I was just about to mention that I had this error…

22:30:02: error java.lang.SecurityException: Getting properties on class physicalgraph.app.ExecutionResult is not allowed @ line 10118

in the logs…

DAMN! LOL!

It’s not so much that were in need of a different mode, we’re just Home wandering about when this happens. I’m just a conservatory nut. When we are done in the bedroom there can be 5 lights on and one socket. I can just leave and let them all time out and go off but I would rather hit the last switch leaving the room and have it kill everything right away with a supplementary piston.
Problem is this supplementary piston gets “touched” by the regular motion piston in the room when it send an off command, if your in the bath room you go dark as well. Not good for WAF.
I’ll just put it back to Interaction:All and put a condition in to include motion in the ensuite as a check.
I was just hoping the Interaction:Physical might get explained or maybe fixed if it is broken @ady624 as I haven’t read of anyone else using this option.