How to run complex rules/routines

Hi,

I’m using OH3 and I’m planing to control a rather huge implementation of switches and sensors which is devided into smaller, better to control, parts/areas. So fare, so good.

Now, my question. How can I implement the following:
if(start) {
run area#1 for 10 min
stop area#1

run area#2 for 15 min
stop area#2

run area#3 for 5 min
stop area#3

run …
stop …
}

As you can see, I’m stuck with the “diff times” per section/area in one rule/script/routine. Does anyone has an idea how to implement it?

It’s important that once it starts, it runs through all the areas and OH is not stuck or bussy while waiting to complet the complex rule.

I appologies already if the answer is too simple.
Thanks in advanced
-D

It’s not very clear if you want these areas to act one after the other,or just for different times.
Sounds like

From your description I don’t really know what you want to do. Either cascading the areas or start all at once and stop them at different times.

  1. If the areas should cascade: I suggest using a state machine, where every state represents an area which is on. Starting with the default OFF state and then cascading through every other state. In each state set the corresponding outputs to ON and all other outputs to OFF and start a timer, which switches the state of the statemachine after the desired duration to the next state. With this approach you can separate the two problems. First what to do in each state and when to switch from one state to another state.

  2. If starting all at once: Create for every area a timer with the corresponding duration and the an appropriate command to send after the timer has finished. For example send OFF to the corresponding switch item.

I do have, let’s say, 8 different items (8 Shellies; Power ON/OFF) which defines a program. Now, I like to say “Start Program X” and what OH should do is

Item #1 - Power ON for 10 min
next / wait / pause / …
Item #1 - Power OFF
Item #2 - Power ON for 10 min
next / wait / pause / …
Item #2 - Power OFF
Item #3 - Power ON for 6 min
next / wait / pause / …
Item #3 - Power OFF
Item #4 - Power ON for 12 min
next / wait / pause / …

Program X is a virual Item, define as a Switch (TRUE/FALSE) and if I set it to TRUE, all 8 Switches should be processed but only one after the other with a different ON time.

I like to manage my home installed irrigation system, it has 8 different circuits which have to run next to each other. Some circuites do have a rather huge area to water, others don’t. That’s why I called it a program and I don’t have Shellies which I have to control but a HLK-SW16K which I can conroll by scripts but that is all fine for me.

I only need to know the best approach for “executing the program” which has to start/stop 8 circuits but with a different run time. Super important, OH should not be stuck while executing the huge program.

Did you look at the example at all? What doesn’t it do, that you want?

I have to be honest, I didn’t got it at the first quick view.
Now, after reading it twice, THATS the answer :star_struck:

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.