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.
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.
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”.
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.