Rule without time

I try to create a rule on openhab 3 but I see that rule works only with a time condition on “When” space. I want to create a rule that works always without determining a time to work. if possible this??

Rules are triggered based on an event. There has to be some sort of event that causes the rule to run. That even can be an update or command or change on an Item, a certain time, etc. But rules don’t just run all the time. Some event must cause them to run.

I want to explain a little bit, what is my problem. I have one device, that communicates with openhab with MQTT that I read a value of a temperature sensor. I want that when this temperature goes down to 5°c the rule command a switch. I can’t implement a condition when the sensor goes down to 5°c. what I can do it?

Trigger a rule when your Item changes, then test its state to see what ii is, and then choose to do whatever it is you want - or not.

Like Rossko57 Indicated. In the UI you don’t need to even write code at all.

  • For the trigger use an Item Event and set it to changes on that temperature Item

  • For the action use an Item Command and command the Switch to ON

  • For the condition (“But only if…” section) use an Item condition and test that the Switch isn’t already on and a second item condition to test that the temperature is <= 5 °C

I think you may be misinterpreting “When” to always be “When it’s this time”. It’s actually “When something happens”:

  • When it’s 12:00
  • When a sensor updates or changes
  • When you turn a switch on
  • When 4 hours have passed (e.g. every 4 hours)

As Rich says, your trigger to start the rule will be “when the sensor item changes”, and then you’ll have an IF condition to check if it’s below 5°C.

1 Like