Spent the evening doing some reading and still not sure the best way to attack this. Most everything I found dealt with a situation where you turn something on based on something that happened, check to see the state and act accordingly or expire after a certain time.
I just need a simple rule to run forever and ever of 3 minutes on and 15 minutes off and let me know in say 30 minutes of time if there has been an issue with the state. ie, it has not run.
Because expire can only set to one command (ON or OFF) i would combine a cron every 18 minutes to ON and a expire after 3 minutes to OFF. You can also use Timer.
For that part Iâd use a persistence service and present the data of the last xx minutes on a chart. Since you are interested in a limited time only, you probably are looking for a non-growing database. RRD4J would be a solution.
[vent.ItemStateChangedEvent] - inovelli_plug1 changed from NULL to OFF
Immediately after I get this:
[ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Tower Timer changed': The name 'Off' cannot be resolved to an item or type; line 12, column 32, length 3
Thatâs not entirely correct. You can configure expire to send any command, not just ON or OFF. For example, if you donât specify anything expire="2m" will set that Item to NULL after 2 minutes. If you have a Number Item you can use expire="2m,state=-1" which will set the Number Item to -1 using a postUpdate after 2 minutes without a change.
It is true that you can only specify one value that the expire binding sets the Item to.
If you are expecting the expire binding to turn the Item ON then you need to change it to expire="3m,command=ON". The last part of the binding config tells expire what to set the state to. The Item is already OFF so there is nothing for the expire binding to do with âcommand=OFFâ.
Depends on what you want to happen when the timer expires. The âcommand=OFFâ specifies the command that will get sent three minutes after the Item is set to any state that is not OFF.
Hey Rick, was just writing this up. Was all making sense now. The rule runs to turn the switch ON. Immediately the Expire Binding starts tracking that and after 3 minutes it turns the switch OFF. The switch uses a cron job to run for a total of 18 minutes. So after the switch runs for 3 minutes, it then turns OFF for 15 minutes when the rule then fires again to turn the switch ON.
So that said I think there must be an issue with the rule. This is what I have in the logâŠ
[INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'towers.rules'
[WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'towers.rules' is either empty or cannot be parsed correctly!
[INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'towers.rules'
Three minutes laterâŠ
[ome.event.ItemCommandEvent] - Item 'inovelli_plug1' received command OFF
[vent.ItemStateChangedEvent] - inovelli_plug1 changed from ON to OFF
at that point, the rule should fire again in 15 minutes to turn it back ON, but nothing happens.
Add logging to the rule to make sure it is firing.
Rebuild the Cron expression using the quartz Cron builder just to make sure there is nothing wrong with it. Iâm not good enough with Cron to tell just by eye.