Document lastStateUpdate and lastStateChange for RulesDSL (#2480)

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
Co-authored-by: stefan-hoehn <mail@stefanhoehn.com>
pull/2495/head
jimtng 2025-05-07 23:39:43 +10:00 committed by GitHub
parent 48cd9ce3a7
commit 7b513dc289
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 15 deletions

View File

@ -765,21 +765,24 @@ MyItem will automatically apply the method that corresponds to the argument type
Besides the implicitly available variables for items and commands/states, rules can have additional pre-defined variables, depending on their triggers:
- `receivedCommand` - implicitly available in every rule that has at least one command event trigger.
- `previousState` - implicitly available in every rule that has at least one status change event trigger.
- `newState` - implicitly available in every rule that has at least one status update or status change event trigger.
- `triggeringItemName` - implicitly available in every rule that has at least one status update, status change or command event trigger.
- `triggeringItem` - implicitly available in every rule that has a "Member of" trigger.
- `triggeringGroupName` - implicitly available in every rule that has a "Member of" trigger.
- `triggeringGroup` - implicitly available in every rule that has a "Member of" trigger.
- `receivedEvent` - implicitly available in every rule that has a channel-based trigger.
- `triggeringChannel` - implicitly available in every rule that has a channel-based trigger.
- `triggeringThing` - implicitly available in every rule that has a thing-based trigger.
- `previousThingStatus` - implicitly available in every rule that has a thing-based trigger.
- `newThingStatus` - implicitly available in every rule that has a thing-based trigger.
- `sharedCache` - a cache that is shared between all rules and all scripting languages
- `privateCache` - a cache private to the script/rule that requests it
| Variable | Description |
| :-------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `receivedCommand` | implicitly available in every rule that has at least one command event trigger. |
| `previousState` | implicitly available in every rule that has at least one status change event trigger. |
| `newState` | implicitly available in every rule that has at least one status update or status change event trigger. |
| `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. |
| `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. |
| `triggeringItemName` | implicitly available in every rule that has at least one status update, status change or command event trigger. |
| `triggeringItem` | implicitly available in every rule that has a "Member of" trigger. |
| `triggeringGroupName` | implicitly available in every rule that has a "Member of" trigger. |
| `triggeringGroup` | implicitly available in every rule that has a "Member of" trigger. |
| `receivedEvent` | implicitly available in every rule that has a channel-based trigger. |
| `triggeringChannel` | implicitly available in every rule that has a channel-based trigger. |
| `triggeringThing` | implicitly available in every rule that has a thing-based trigger. |
| `previousThingStatus` | implicitly available in every rule that has a thing-based trigger. |
| `newThingStatus` | implicitly available in every rule that has a thing-based trigger. |
| `sharedCache` | a cache that is shared between all rules and all scripting languages |
| `privateCache` | a cache private to the script/rule that requests it |
For further documentation on using the cache see [here](jsr223.html#cache-preset).