Priority selection in Basic UI

  • Platform information:
    • Hardware: Rasberry Pi 3B
    • openHAB version: OH 2.5

I would like to include a priority list into my Basic UI to choose a certain priority for some (on/off) Items.

Today I chose:
Gadget A - Prio 1
Gadget B - Prio 2
Gadget C - Prio 3

Tomorrow it is:
Gadget A - Prio 3
Gadget B - Prio 1
Gadget C - Prio 2

In the background this selection should be given to a rule, that will act out of this order and set gradually (with other conditions: e.g. actuel consumption) in the state for the Items to “ON” until every Gadget was once ON.

Each day I would like to choose a different Priority for the Gadgets with the Basic UI.

Question: Does anyone have programmed already something like that? How have you implemented it in Openhab? Would be great if you could give me some code exemples.

Could this work with the “Selection” or “Setpoint”? Do you recommend to use ProxyItems for this? Or is there a better way in OH?

Thanks.

This is going to be so much work to make work in BasicUI that it is frankly not worth the effort. Sitemaps are not dynamic like that. Assuming you have three Gadgets you’d need to create nine copies of the three lines that represent the Gadgets, one for each of the possible combinations of the three.

Then you need to somehow have an Item that can be used to set the visibility of only those elements that have the order that you care about right now and hide the other eight. And that just addresses the UI.

In your rule you’ll need to code this order yet again to look at that same Item to select the right priority order.

I read it as about controlling some sequence of actions, rather than a display requirement.
i.e. choose “A-B-C” at UI, rule running later does action A, action B etc.

It’s quite a good puzzle if you get beyond a few limited pre-selected choices. How many combinations are really required here?

It’s exactly this.

Controlling a sequence of actions. For now there are only three pre-selected Things (A, B, C) that are required to be controlled in sequence. Possible combinations are: “ABC”, “ACB”, BAC", “BCA”, “CAB”, “CBA”.

How would you implement it?

Think I’d use a dummy string Item to represent the desired sequence.
Then there’s two areas to work out;
The UI - you’d want maybe a selection widget, and pre-populate the Item metadata with command options like “A,B,C” with label “Sequence ABC”.
So clicking gets you state “A,B,C” in the Item.
Later, when the rule runs it can parse that state, split it down, and start task A, start a timer for task B, start a longer timer for task C etc.