CoRE and Piston Rules Engine, first design steps

I have a feeling all these sudden problems are either because of

  1. a bug I introduced
  2. ST being a bit iffy…

Trying to consolidate some things, found a bug where location/shm conditions were not filtered to only events coming from the location, but from any device. Fixed that. Some other fixes regarding the stability of comparisons. Tested with a piston I could not get to work right…

Also temporarily fixed the changes away from - this is however historical, it should look at what the state was previously (and I cache that, so the first round did not work as I had no cached value). What it does now, it acts exactly opposite to “changing to any of”. If you have 4 values, 1, 2, 3, and 4 and you say “changes away from 1 or 2”, it should only trigger when the value WAS 1 or 2 and now is not 1 nor 2. However, that’s complicated. What it does right now is it looks to see if the new value is not in that list. So if it changes from 3 to 4, “changes away from [1,2]” is TRUE. I think the name should be different or I should do away with it…

v0.0.066.20160603 - Alpha test version - Fixed some bugs involving the “changes away from” - still keeping an eye on this though

Can you check the runtime stats? Event delay chart?

Where would those be? Sorry.

Main CoRE page, down the page, Runtime statistics. You can then tap on the event delay or execution time to see last 24 hours… new to runtime stats? :smiley:

Do you want a screenshot?

I see execution time and event delay, then a list of my pistons and their evaluation and event delays.

Tell me what to post and I will.

Well on the two graphs, you should have as low numbers as possible, ideally below 1s… Do you have any over 2s?

Event delay (since 8PM my time)
8PM-14.3 seconds
9:15ish-3.8
9:45ish-1.9
10PM-1.6
1030-1.2

Execution time
8PM-7.1
8:45ish-1.8
9PM-2.3
915PM-2.5
930PM-1.6
10PM-.8

Save/Load State to Local Store is working for me in this piston:

Pretty slow. I’ve seen much better days. My pistons have been very stable, except one that included location - I have a DTH from my own integrationwith Digital Life’s alarm. In that DTH, I implement an attribute called “mode”. Turns out, subscribing to location’s mode will trigger events even when that device changes that “mode” attribute - and I haven’t subscribed to that! It’s as if any event for attribute “mode”, regardless of source device is broadcast as a location event. Perhaps, similarly, one can subscribe to location’s “switch” attribute and get all events for “switch” from all devices? That would be cool. Anyways, had to implement code to ensure that listening for location’s “mode” is actually triggered by the location only. Problem solved and all good and stable…

I don’t think the Else ever runs since the Or and Or-If are mutually exclusive? One of them will always be true and the other one false. The OR between them ensures piston is always true. Point is, Else is not needed. But yeah, turning the switch on turns on the lights, turning the switch off brings the lights to their initial state prior to switch turning on. Just what the capture/restore is designed to do. Really thinking I should rename them Capture/Restore.

it works fine… Though i’ll test without the else.

Can anyone please test the physical switch? I don’t have any in the house… In expert mode, when using the switch attribute, a new option shows up called “Interaction” and has three possible values: Any, Physical, Programmatic. Set it to physical and that condition should only be true whenever you manually push the switch button.

Thank you

The physical switch/ programmatic interaction restrictions work as expected…

Thank you. I love writing code in the dark, with no way to test, but my brain’s state machine emulator lol

Here’s my alarm management piston :wink: works like a charm. Digital Life was built to automatically sync with mode and SHM, so all three are tied together. I change any, the other two follow.

This piston locks doors and lets me know of what’s going on :wink:

You have a But If… evaluation?

Latching piston, yeah

Would my Or-If piston for my lights that I used with save/restore states work any better as Latching?

@ady624

Remember the “do nothing if the state changed in the last x minutes” you wrote for rule machine for the presence sensors?

How do implement that in core?

I’m changing all of my presence sensors rules I’ve to CoRE.

Oh, haven’t done that yet. Will figure something out…