PLEG Next Gen UI

Folks,
I am at the beginning of a new development cycle for PLEG.
My intentions are to be much more graph oriented.
It will be UI7 only and will likely open it’s OWN window for editing.

See the attached demo snapshot.

I will use the output of the graph editing to make significant performance improvements.

  1. I will pre-compile all of the condition graphs. (Currently I parse and eval each condition) each time any input changes. Now it will execute LUA code directly for each condition evaluation.
  2. I will use the graph to ONLY eveluate conditions that are effected by changes in the specified input.
  3. You will be able to attach actions when an INPUT to the actions (is true, is False, or changes (boolean or any other value) with a REPEATS option.
    You will be able to attach actions directly to an INPUT without needed to create a trivial condition.
    Since you can connect to ANY change … you can use the Same Condition and Action to turn on/off a light. Using the value of the condition in the Argument of action
    i.e. a SetTarget with a value of ({ConditionValue})

The graph will also be able to be used for Analysis of your logic (i.e. a different view of the Status Report)

  1. It will be annotated with the State and TimeStamps of all inputs and Conditions.
  2. It will have the ability to focus on an Input (and see only the graph that is effected by it) or a Condition (and see only it’s graph back to all inputs and downstream actions and conditions).
  3. From the Graph you will still be able to DoItNow on schedules and Actions.

I also plan to remove the need to RESTART LUA on editing. It will re-init itself as changes are made.
[hr]
For Alpha Testing:
Just upload the attached files to your Vera (APPS → Develop Apps → LUUP Files → Upload)
(You down’t need the Demo.png file!)
You need to restart Vera after upload the .json file. Remove the .txt extension from the .js file.

This will add another option at the end of the PLEG panel (Scroll down).

Every thing is in the “Edit” panel. You should be able to inter-operate between the two editors, but I would refresh the browser if you want to go back to the OLD editor.

NOTE: I renamed the .js file since the initial release. You will need to re-download both files.
Remove the “.txt” from the J_PLC.js.txt to upload to Vera.
Pick one of the .json files and Remove the -XXX from the name to upload to Vera.
You will have to download J_PLC.js.txt from: [url=https://drive.google.com/file/d/0B3koQ6Ncw6jdWVFIZjBqOUxwVjA/view?usp=sharing]https://drive.google.com/file/d/0B3koQ6Ncw6jdWVFIZjBqOUxwVjA/view?usp=sharing[/url]

This file is too big for the Forum … I have included dependent javascript files inside it to make it easier to test.

This looks like it would be fantastic. One suggestion though, when i think of rules, i kind of view them as a flowchart and maybe following that standard would make a very clean interface (see image). Just my $.02

It all sounds good to me. I figure I am headed for UI7 sometime over the summer…

Most exciting.
I’m hoping that any future developments will include compatibility with amg0 altUI & akbooer’s openLuu[font=verdana]p.[/font]

Competition is good for us… :stuck_out_tongue_winking_eye:

Sent from my ONE A2003 using Tapatalk

By putting my UI on it’s own panel it should be easier to integrate with AltUI.
There are a couple of other design changes I need to make to run on OpenLUA.
It’s my goal to get there.
I will add that to my Next-Gen objectives.

As someone who cannot save ANYTHING in PLEG on UI7. A dedicated save button and confirmation text would make me sleep easier at night. This might be handled by the no need to restart luup, but confirmations are priceless at this point.

The current events are hot ! :slight_smile:
From my point of view it’s not really competition, the goals are not exactly the same.

The plugin on openLuup can not use lzoenc format (encrypted), so perhaps it could raise an issue.

Looking forward to seeing the result of your development Richard!

PLEG & RP2 is the final destination…perfection.

What I would love to see is some way to import or export via a file. Maybe a CSV or something like that. Personally I keep my configs in an excel spreadsheet and create new tabs when making changes. If I need to roll back or have a situation where I need to reset to factory it is very easy to copy and paste the conditions but it would be even better if I could somehow just import a file. I am not a programmer so really don’t know what the possibilities are.

I think a entry method more akin to a state matrix, using conditions and inputs as the transitions is something worth considering. Today this is a bit difficult to do, as a state machine implies states are mutually exclusive, and conditions don’t necessarily do that. Fundamentally any ‘flow’ can be represented as a state machine, but it could be easier to enter as a table and use the graphical flow as more of a visualization.

Once the state machine is created, actions can be assigned to the states as we do today with conditions…

x

@xeinth

Do you have an example or a reference ?

I am not sure I fully understand what you are stating.

In particular I am interested in an example that shows how a state matrix simplifies the logic definition.

@KewlRobD

PLEG already has an EXPORT and an INPORT for saving a single PLEG’s definition. The problem is that it can’t be imported to another machine, or after some devices it has referenced are deleted and posible re-created because the export has references to DEVICE IDs for both the INPUTS and the ACTIONS.

I will add to the list to save the export with references by NAME and allow rebinding do a new device ID on INPUT, and if the INPUT is not found it will allow you to specify the new Device Name.

This should solve a number of request to be able to import to another instance and rebind …

[quote=“RichardTSchaefer, post:13, topic:191538”]@xeinth

Do you have an example or a reference ?

I am not sure I fully understand what you are stating.

In particular I am interested in an example that shows how a state matrix simplifies the logic definition.[/quote]

Here is an example I came up with.

Basically the idea is a light tied to a motion sensor, but it only works at night or when the house is in night mode. A switch can be used to specify an override which extends a minute timeout to 30minutes, but ONLY when in night mode, not when its merely dark outside. The motion detector can reset the state and resume checking for the current dark/house mode condition to reset the timers. What makes this a big hard for PLEG today is these states are all mutually exclusive, and you can’t get to certain states without progressing thru other first. It ensures order of operations, if you will.

You’d still need inputs defined on one page, and actions associated to states. Otherwise you just need to specify the transition table. This basically recreates the flow you are describing graphically, so perhaps its redundant but at least I wanted to highlight the use case.

x

[quote=“RichardTSchaefer, post:14, topic:191538”]I will add to the list to save the export with references by NAME and allow rebinding do a new device ID on INPUT, and if the INPUT is not found it will allow you to specify the new Device Name.

This should solve a number of request to be able to import to another instance and rebind …[/quote]

Yes, this will be awesome. I imagine I’m not alone in wanting a library of pleg recipes that other users post on the forum, import that and just get prompted for which devices to bind to on my system.

I couldn’t see this asked or answered elsewhere.

Will this be an update that will keep our existing pleg functions working or do we have to start again?

Always backwards compatible.
You may have to open Each PLEG/PLTS in the editor to upgrade it.

^^^
This is so teasing…
I doubt I’ll have any fingernails left…

Ace!

I feel just a little sad, sad that I’m so excited about this lol