More then, less then (> = <) rules

Hello,
i would like to create a rule in which i receive a notification when a device falls below a certain watt number. how can i set this with the graphical interface of OH3?

Add Conditions to the rule. The “But only if…” section.

Would look like this:


1 triggers:
2  - id: "1"
3  configuration:
4  itemName: Power_solar
5  type: core.ItemStateChangeTrigger
6 conditions:
7  - inputs: {}
8    id: "3"
9    configuration:
10      itemName: Power_solar
11      state: "50"
12      operator: <=
13    type: core.ItemStateCondition
14 actions:
15  - inputs: {}
16    id: "2"
17    configuration:
18      message: Below Limit 50W
19    type: notification.SendBroadcastNotification

I will test it. Thank you!

is there any way to tell if item1 is lower than item2?

Not without using a Script Condition. You’ll have to write code for rules eventually.

ok thank you.

i would like to execute a rule depending on a past time. unfortunately it doesn’t work like in the picture. how can I set it in addition to <= 100?

The given times are unrealistic, I.e. it is never between x and identical x… What are you trying to do?

It is very unclear what you are trying to do. As rossko57 said, the times in the condition must be different times. Furthermore, these are clock times. So between 00:15 and 00:30 means if the current time is after fifteen minutes after midnight and before thirty minutes after midnight.

If what you are really after is triggering the rule only if the Item has been <= 100 for 15 minutes you will need persistence set up and you will have to write code.

I would like the switch to go off as soon as power <= 100 AND that it then waits 15 seconds before doing this.

That’s a timer and this again is something you’d have to do in code.

And that’s going to be put into a Script Action, not the condition.

OH is event driven, not state driven. An event happens (trigger), the conditions are checked based on the states of Items right now. But Conditions do not support “wait for 15 seconds and then check.” You have to implement that yourself in a Script Condition/Action.

You can use Thread.sleep(15000) or you can use createTimer. The sleep is going to block the rule and if the rule is triggered while it’s blocked, it will add that trigger to a queue which is going to back up. So using a Timer will be a better approach.

ok. how can I add this in my rule? (I’m sorry but I’m a beginner)

Choose Script Action, choose Rules DSL as the action and:

Give it a try and if you run into specific problems come back and we will try to help.

You can do it without coding, only with the gui. You only need another item and a second rule.

Create another item (eg Power2) and add the metadata expiration timer with set to 15 sec command OFF.
Create a rule „when Power 1 changed then send ON to Power2 but only if Power <= 100“.
Create a second rule „when Power2 changed from ON to OFF send command OFF to your power outlet“

thx dirk, I will test it =)