You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: configuration/items.md
+38-4Lines changed: 38 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -674,22 +674,34 @@ This parameter allows to post an update or command to an item after a period of
674
674
675
675
The expiration timer is started or restarted every time an item receives an update or a command _other than_ the specified "expire" update/command.
676
676
Any future expiring update or command is cancelled, if the item receives an update or command that matches the "expire" update/command.
677
+
See `ignoreStateUpdate` and `ignoreCommands`[configurations](#configurations-for-expire) below.
677
678
678
-
The parameter accepts a duration of time that can be a combination of hours, minutes and seconds in the format
679
+
The parameter accepts a duration of time that can be a combination of days, hours, minutes and seconds in the format `Xd Xh Xm Xs` where X is a _long_ integer.
680
+
Every part is optional, but all parts present must be in the given order (days, hours, minutes, seconds).
681
+
Whitespaces are allowed between the sections.
679
682
680
683
```shell
681
684
expire="1h 30m 45s"
682
685
expire="1h05s"
683
686
expire="55h 59m 12s"
687
+
expire="2d 7h 59m 12s"
684
688
```
685
689
686
-
Every part is optional, but all parts present must be in the given order (hours, minutes, seconds).
687
-
Whitespaces are allowed between the sections.
690
+
A non-negative expiry value can be specified using the [ISO8601 Duration format](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/Duration.html#parse(java.lang.CharSequence)).
691
+
Java's `Duration` class supports days, hours, minutes, and seconds.
692
+
Note that while the ISO8601 format allows for fractional seconds, the openHAB `expire` feature only supports durations with a minimum granularity of one second.
693
+
694
+
```shell
695
+
expire="PT1H30M45S"
696
+
expire="PT1H5S"
697
+
expire="PT55H59M12S"
698
+
expire="P2DT7H59M12S"
699
+
```
688
700
689
701
This duration can optionally be followed by a comma and the state or command to post, when the timer expires.
690
702
If this optional section is not present, it defaults to the Undefined (`UnDefType.UNDEF`) state.
691
703
692
-
```shell
704
+
```java
693
705
PlayerMyPlayer { expire="1h,command=STOP" } // send STOP command after one hour
694
706
NumberMyChannel { channel="xxx", expire="5m,state=0" } // update state to 0 after five minutes
695
707
StringMyMessage { channel="xxx", expire="3m12s,Hello" } // update state to Hello after three minutes and 12 seconds
@@ -701,6 +713,28 @@ Note that the `state=` part is optional.
701
713
In the special case of a String item, it is possible to define a state/command as the string "UNDEF" or "NULL" by putting it into single quotes (e.g. "1m,state='UNDEF'").
702
714
Without the quotes, the state would be the system type `UNDEF`.
703
715
716
+
###### Configurations for `expire`
717
+
718
+
The `expire` parameter is stored as an item metadata which supports the following configurations:
Copy file name to clipboardExpand all lines: configuration/rules-dsl.md
+18-15Lines changed: 18 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -765,21 +765,24 @@ MyItem will automatically apply the method that corresponds to the argument type
765
765
766
766
Besides the implicitly available variables for items and commands/states, rules can have additional pre-defined variables, depending on their triggers:
767
767
768
-
-`receivedCommand` - implicitly available in every rule that has at least one command event trigger.
769
-
-`previousState` - implicitly available in every rule that has at least one status change event trigger.
770
-
-`newState` - implicitly available in every rule that has at least one status update or status change event trigger.
771
-
-`triggeringItemName` - implicitly available in every rule that has at least one status update, status change or command event trigger.
772
-
-`triggeringItem` - implicitly available in every rule that has a "Member of" trigger.
773
-
-`triggeringGroupName` - implicitly available in every rule that has a "Member of" trigger.
774
-
-`triggeringGroup` - implicitly available in every rule that has a "Member of" trigger.
775
-
-`receivedEvent` - implicitly available in every rule that has a channel-based trigger.
776
-
-`triggeringChannel` - implicitly available in every rule that has a channel-based trigger.
777
-
-`triggeringThing` - implicitly available in every rule that has a thing-based trigger.
778
-
-`previousThingStatus` - implicitly available in every rule that has a thing-based trigger.
779
-
-`newThingStatus` - implicitly available in every rule that has a thing-based trigger.
780
-
781
-
-`sharedCache` - a cache that is shared between all rules and all scripting languages
782
-
-`privateCache` - a cache private to the script/rule that requests it
|`receivedCommand`| implicitly available in every rule that has at least one command event trigger. |
771
+
|`previousState`| implicitly available in every rule that has at least one status change event trigger. |
772
+
|`newState`| implicitly available in every rule that has at least one status update or status change event trigger. |
773
+
|`lastStateUpdate`| implicitly available in every rule that has at least one status update or status change event trigger. This variable contains the time when the last state update occurred prior to the current one. |
774
+
|`lastStateChange`| implicitly available in every rule that has at least one status change event trigger. This variable contains the time when the last state change occurred prior to the current one. |
775
+
|`triggeringItemName`| implicitly available in every rule that has at least one status update, status change or command event trigger. |
776
+
|`triggeringItem`| implicitly available in every rule that has a "Member of" trigger. |
777
+
|`triggeringGroupName`| implicitly available in every rule that has a "Member of" trigger. |
778
+
|`triggeringGroup`| implicitly available in every rule that has a "Member of" trigger. |
779
+
|`receivedEvent`| implicitly available in every rule that has a channel-based trigger. |
780
+
|`triggeringChannel`| implicitly available in every rule that has a channel-based trigger. |
781
+
|`triggeringThing`| implicitly available in every rule that has a thing-based trigger. |
782
+
|`previousThingStatus`| implicitly available in every rule that has a thing-based trigger. |
783
+
|`newThingStatus`| implicitly available in every rule that has a thing-based trigger. |
784
+
|`sharedCache`| a cache that is shared between all rules and all scripting languages |
785
+
|`privateCache`| a cache private to the script/rule that requests it |
783
786
784
787
For further documentation on using the cache see [here](jsr223.html#cache-preset).
0 commit comments