CoRE and Piston Rules Engine, first design steps

After extensive testing with the assistance of my kids and cats, I can finally sleep at night knowing this will now work to my family’s standards! :slight_smile:

Surprising enough, I’ll need this setup for most of my motion sensors. Having 3 dogs, 3 cats, 2 kids, and a wife, that’s a LOT of motion in common rooms at a given time. I can totally see having some lower delay sensors not needing this, but to be honest, why? This seems to be a more fool proof method, are there downsides in any way? I’m going to apply this to my dining room and office rules now. Thank you again Adrian!

2 Likes

Could you please share with us what “finally worked”? :slight_smile:

1 Like

@ady624, is this statement true? I’m still trying to figure out why the piston I posted a screenshot of is executing the wrong actions.

Piston Mode: Latching

If...

Upstairs Hall Motion Sensor -> motion is active

Then... (3 actions, to be clear)

@ If mode is {Home, Evening, Night}
Using Upstairs Hall Light -> Set level to {100%, 10%, 1%}

But If...

Upstairs Hall Motion Sensor -> motion is inactive

Then...

Using Upstairs Hall Light -> Wait 1 minutes - > Turn off (Cancel on piston state change)

Individual actions applied to groups run when the group evaluates true. That is the only scenario that makes sense, isn’t it? You can apply individual actions to each action and the whole group. Flexibility galore. :)))

And my dining room one with power:

Piston Mode: Latching

If...

Living Room Motion Sensor -> motion is active

And

Living Room Theater outlet -> power is less than 30W

And

Bloomsky -> Illuminance is less than 3600lux

Then...

Using Dining Room Light -> Turn on

But If...

Upstairs Hall Motion Sensor -> motion is inactive

Then...

Using Living Room Light -> Wait 5 minutes -> Turn off -> Turn on after 1000ms -> Wait 1 minutes -> Turn off (Cancel on piston state change)
2 Likes

So are you saying that if A is False and B is False, C’s action will still run if C is True?

IF
    A
    AND
    (
        B 
        AND 
        C
            WHEN TRUE
                // Do Something
    )

Yes. Normal programming optimizations would never even evaluate B nor C because the end result is false due to A being false. If I used optimizations, non-programmers would be lost… So, as I said before, no logical evaluation optimizations are used. So C does get evaluated regardless of A being false, and yes, if it is true, the actions applied individually to C would execute.

Note that you can also add actions to the whole group (B AND C), which would only run if both B and C are true.

1 Like

I have never used parameters for the custom commands when it was available in RM. I remember it not working when a parameter was used with the custom command.

There are also some custom commands for the Aeon Siren DTH “My Aeon Home Energy Monitor” by jscgs350

All custom commands should work in v0.0.055 provided the prameters, if any, are simple types: boolean, decimal, number or string

So in order to make the following work:

IF
    A
    AND
    (
        B
        AND
        C
        (
            D
                WHEN TRUE
                  // DO X
            OR
            E
                WHEN TRUE
                    // DO Y
        )
    )

It would need to be written as:

(
    A
    AND
    B
    AND
    C
    AND
    D
)
    WHEN TRUE
        // DO X
OR
(
    A
    AND
    B
    AND
    C
    AND
    E
)
    WHEN TRUE
        // DO Y

@ady624, I can’t seem to get a Zero for the sunrise/sunset variable, it always shows as null. You commented on it before. It will take a value of 1 but not zero.

Is this a bug or am I doing something wrong?

Rick

Unfortunately, yes. Should logical evaluation optimizations be enabled? Or maybe configurable?

Are you running latest version?

@ady624

I upgraded to the latest version. The error is still there. I removed the pump from the piston and the error went away.

So, I created a while new piston.

Piston type - latching
Pri IF - pump raises above 2 watts
Pri THEN - turn on fans and lights
But If - pump falls below 2 watts
Then - turn on a switch

Absolutely no errors in the logs. As a matter of fact, it doesn’t show up at all in the logs, nothing… Zilch.

Also, it doesn’t do a damn thing! It’s like it doesn’t even exist!

I will try out the raises and drops and see. Nothing in the logs unless you turn on debugging. Debugging on?

Yes latest as of this morning. I can enter a zero but it shows null after save

Rick

You’re probably right that the way it currently works makes more sense to the average user. As a developer, it will take a little getting used, but I’ll still be able to make things work the way I want them to so it’s not that big of a deal.

If you were able to make logical evaluation optimization an advanced feature that could be enabled, that would be great and would most likely make the pistons execute faster.

1 Like

Crap! Duh.

@ady624
This is the log with simulate on an entirely new piston (described above).