CoRE and Piston Rules Engine, first design steps

You are welcome. Let’s just say I knew what it does off the bat… Didn’t have to look too far… lol

I wanted to buy it, but it’s free to download. I looked briefly though. I will look again tomorrow.

1 Like

I haven’t found a way to purchase the image without signing up for a subscription, but here’s a link to the original in case anyone’s interested.

http://www.dreamstime.com/stock-images-pistons-gears-image27947584

1 Like

Adrian,

For the simulator and to aid in troubleshooting, would it be possible to introduce a step through approach rather than just run from start to finish?

While my current pistons are pretty simple, it might also help me to learn about more complex Pistons If I could step through them

Just a thought
Rick

1 Like

@ady624

what does this mean from the simulation?

e6caf5d5-8b20-45e3-b6a0-89b8a055b519 11:27:43 PM: trace ╔═══ Task processing took 153ms
e6caf5d5-8b20-45e3-b6a0-89b8a055b519 11:27:43 PM: trace ║░░░ Removing any existing ST safety nets
e6caf5d5-8b20-45e3-b6a0-89b8a055b519 11:27:43 PM: trace ║░░░ Rescheduling time triggers
e6caf5d5-8b20-45e3-b6a0-89b8a055b519 11:27:43 PM: trace ╚═══ Processing tasks
e6caf5d5-8b20-45e3-b6a0-89b8a055b519 11:27:43 PM: trace ╔═══ Event processing took 204ms
e6caf5d5-8b20-45e3-b6a0-89b8a055b519 11:27:43 PM: debug ║░░░ Scheduling actions for condition #-2. State did NOT change.
e6caf5d5-8b20-45e3-b6a0-89b8a055b519 11:27:43 PM: debug ║░░░ Primary IF block evaluation result is false
e6caf5d5-8b20-45e3-b6a0-89b8a055b519 11:27:43 PM: debug ║░░░ Event eligibility for the primary IF block is 1 - ELIGIBLE (triggers not required, event is a condition)
e6caf5d5-8b20-45e3-b6a0-89b8a055b519 11:27:43 PM: trace ╚═══ Processing event time with id time, generated on Fri May 27 04:27:43 UTC 2016, about 1ms ago
e6caf5d5-8b20-45e3-b6a0-89b8a055b519 11:27:27 PM: error ║ ERROR: Error evaluating condition: java.lang.ClassCastException
e6caf5d5-8b20-45e3-b6a0-89b8a055b519 11:27:18 PM: trace ╔═══ Task processing took 147ms
e6caf5d5-8b20-45e3-b6a0-89b8a055b519 11:27:18 PM: trace ║░░░ Removing any existing ST safety nets
e6caf5d5-8b20-45e3-b6a0-89b8a055b519 11:27:18 PM: trace ║░░░ Rescheduling time triggers
e6caf5d5-8b20-45e3-b6a0-89b8a055b519 11:27:18 PM: trace ╚═══ Processing tasks
e6caf5d5-8b20-45e3-b6a0-89b8a055b519 11:27:18 PM: trace ╔═══ Event processing took 331ms
e6caf5d5-8b20-45e3-b6a0-89b8a055b519 11:27:18 PM: error ║░░░ ERROR: Error evaluating condition: java.lang.ClassCastException
e6caf5d5-8b20-45e3-b6a0-89b8a055b519 11:27:18 PM: trace ╚═══ Processing event power for device Pump with id e9533fd2-ace6-43dc-91d4-d0197cc79428, value 0.788, generated on Fri May 27

1 Like

I’m just going to throw something in and I hope I’m wrong.
I have just moved all my rules over from Rule Machine to CoRE.
I never had any issues with RM.
Two of my rules failed to complete last evening.
They were motion. Turn on. Wait 2 minutes. Turn off. They didn’t turn off. Walked past motion sensor again and they turned off after 2 miss.
I’m in UK and on a v2 hub on the UK server.
So. Anyone else having issues or could this just be server is playing up.

BTW my hub upgrade completed successfully 4 hrs earlier.

1 Like

@ady624 - not sure what it is mate - all working in the morning without any changes …

I have just upgraded to the latest code v0.0.04c.20160526 and will see if it makes a difference today … it almost seems like that potentially the switch from is between to is not between locks something … so I changed the rules to exclude a minute and only use is between in general … lets see how that works out …

1 Like

I had an issue last night when a virtual switch didnt turn off after 10 minutes, and a light stayed on all night.

I’ll monitor tonight and see. First time its ever done this so hopefully just a hub glitch.

Running 04c now, however was running earlier version(049…i think) when goodnight switch didn’t work

1 Like

I just updated to latest, I think I’m still seeing an issue…

Mode is home

is one of Away, Night – eval false

is not one of Away, Night – eval true

is not one of disarm, Home – eval true

is one of – home, disarm – eval false

so the is nots are always coming up true, and the is one of always false – hopefully that’s clear. Thanks again!

1 Like

04c? There was a problem with is_one_of. The not version simply negates the is_one_of so if obe doesn’t work, the other doesn’t either. There was a fix last night for that, can you confirm your version please?

Yup, 04c – I updated and then went in and switched up the rules several times just to make sure I was seeing the above

It seems the behaviour is different from yesterday… still wrong, but different wrong! :wink:

1 Like

My vote is that closed should be 1 and open 0, based on what constitutes the “normal” device state

3 Likes

How about doors and windows? Oh I see… See, the way I was looking at it was convenience. Door open > light on. So open=on. But then you have door closed > AC on… Closed=on. I don’t think there is any right answer ;(

1 Like

Personally I think they should all be the same, ok == true == closed == 1 in thinking about this from an alarm perspective where the normal, non alarm state is 1 or ok

2 Likes

Sorry, updated my comment above.

1 Like

The Contact Sensors I’ve worked with have all had open = 1 or on and closed = 0 or off so my vote is to keep it the way he had it.

1 Like

I think an optional Negate input is required to allow both scenarios, when mixing up attributes…

4 Likes

v0.0.04d.20160527 - Alpha test version - Fixed a bug (for good?) with item in list for is_one_of. Types enum, mode, and other special types need not be casted.

You squished that bug good sir! Ran through the 4 scenarios again that I had listed above, everything works as expected this time! Well done, and thanks!

1 Like

Talking about the boolean value of states, here’s what I am planning on doing.

One can save an attribute into a variable, all good so far. But that value may be, for example “open” from a contact sensor.
Later, one can set that attribute to a device’s “switch” attribute. How will this work?
In my commands “database” I’ll have, for each command, what attribute it changes and what value it sets it to. This is what will allow me to figure out what command to use. I don’t want to send an event to the device with the value for the attribute, because that may go around logic implemented in the command that normally sets that attribute. So I need to figure out what command to execute to get to that value. For setLevel I’ll have to use a wildcard, so I know that setLevel sets attribute level to value * (anything). This way I know that I just have to send that value to setLevel and it’ll take care of it for me. However, if I find no match for an attribute/value pair that I need, say, in our example, “switch”/“open”, then I will fallback onto boolean values. I’ll figure out the boolean value of “open” and then go and look for all commands with “switch” and get the boolean value of it’s normal attribute value and that’s how I’ll allow inter-attribute linkage. If I still don’t find anything, then I fail miserably and put a warning in the log.

Does this sound sane?

1 Like