Rules-ng: Timer / cron-like definition

a i read, next-gen rules are experimental and no or less documentation exist, therefor i have a question:

how rules can be triggered by certain time intervals ? every minute / every 5 minutes ?

Thanks in advance


Try using a Cron based trigger rule


rule "Cron based rule"
Time cron "	0 0/15 * 1/1 * ? *" // Trigger every 15 minutes
// Actions and commands
// You could put a Switch or IF statement in here to condition the commands


Unless you mean the Experimental Rules Engine, in which case I’m sure there is an option to fire rules at times of day, with options for the days.

I did use this Experimental Rules Engine, but after it completely lost my rules for the third time, I have learnt how to write (very basic) rules using text files.

thank you MDAR,

yes i know, but how to place that in ng-rule in HabPanel ? How to place in rules in the configuration files i know…

do you know how to configure that ?

thanks in advance


ng-rule in HabPanel, JavaScripts I believe, is it something you must use? I never used or noticed those as being exposed to user. The regular text based rules go in your openhab’s conf/rules dir. ng-rules wont have a direct integration with openhab’s artifacts. You can make them work by querying/invoking OH REST apis, but you have to write a lot of boiler plate JS code to get your use case working. I would suggest you try Rules DSL, if that is practical option for your scenario.

I am pasting the contents of Readme.txt file in conf/rules dir

Your rules go here.
All rule files have to have the ".rules" file extension and must follow a special syntax.

Check out the openHAB documentation for more details:

I am a beginner with an OpenHub.
I want to turn on a valve at 4am so I wrote a rule as follows

rule "Podlewanie"
    Time cron "0 0 4 * * ? *"

Unfortunately nothing happens. When I use Rule Engine, valve is not switched on also. I don’t know what I do wrong.

After Openhab restart rule and other also started to work.