-
-
Notifications
You must be signed in to change notification settings - Fork 705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[blockly] persistence documentation update #2427
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,40 +34,49 @@ More about that topic can be viewed at ![youtube](../images/blockly/youtube-logo | |
|
||
![statistical-value](../images/blockly/blockly-persistence-get-statistical-value.png) | ||
|
||
_Function:_ computes any of the below functions for the given item since the time provided by _ZonedDateTime_-Block | ||
_Function:_ computes any of the below functions for the given item since the time provided by _ZonedDateTime_-Block, until the time provided by _ZonedDateTime_-Block, or between 2 timepoints provided by _ZonedDateTime_-Blocks. | ||
|
||
openHAB supports history and future values. | ||
A typical example for future values is a weather forecast. | ||
Due to adding future values in openHAB the amount of attributes has been vastly increased and the names had to be renamed to become more specific in terms of historic and future states. | ||
|
||
For each of the functions, you can choose the output type: | ||
|
||
- String: output as a string value | ||
- Quantity: output as a quantity type with unit | ||
- Number: output as a number | ||
- Timestamp: time of the persisted value (when applicable) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True, although not all functions have it, but I will replace it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah OK, thought I had an image in for that, but didn't. The point is: Timestamp is only relevant for some of the analytic actions. E.g., it is not for sum, average, medium..., but it is for getting a persisted state, getting the last update, next update, minimum, maximum... as these results are at a specific point in time. Only when Timestamp is relevant, it is shown in the list. I didn't want to explicitely document this, is the UI should be very much self explaining. And Timestamp will be there when it is relevant. I can put in an image, but not sure it adds much. |
||
|
||
**Important:** **Due to a breaking change of the internal methods in openHAB 4.2, Blockly rules that use persistence methods need to be migrated once.** | ||
This does not happen automatically but needs to be done opening the blockly rule once and re-save it. | ||
Blockly then automatically rewrites the rule to be compatible. | ||
When opening the rule, you will be warned it has been created using an older version. | ||
|
||
Values: | ||
|
||
The following values are available as _historic_ and _future_ representations. | ||
- persisted state: gets the persisted state at a certain point in time (can be historic or future) | ||
|
||
- persisted state: gets the persisted state at a certain point in time | ||
- average: gets the average value of the State of a persisted Item since a certain point in time. | ||
The following values are available as _historic_, _future_ and _between_ representations. | ||
|
||
- average: gets the average value of the State of a persisted Item. | ||
This method uses a time-weighted average calculation | ||
- delta: gets the difference in value of the State of a given Item since a certain point in time | ||
- deviation: gets the standard deviation of the state of the given Item since a certain point in time | ||
- variance: gets the variance of the state of the given item since a certain point in time | ||
- evolution rate: gets the evolution rate of the state of the given Item in percent since a certain point in time (may be positive or negative) | ||
- minimum: gets the minimum value of the State of the given Item since a certain point in time | ||
- maximum: gets the maximum value of the State of the given Item since a certain point in time | ||
- sum: gets the sum of the State of the given Item since a certain point in time | ||
- median: gets the median value of the State of a persisted Item | ||
- delta: gets the difference in value of the State of a given Item | ||
- deviation: gets the standard deviation of the state of the given Item | ||
- variance: gets the variance of the state of the given item | ||
- evolution rate: gets the evolution rate of the state of the given Item in percent (may be positive or negative) | ||
- minimum: gets the minimum value of the State of the given Item | ||
- maximum: gets the maximum value of the State of the given Item | ||
- sum: gets the sum of the State of the given Item | ||
- state updates count: gets the count of State updates of the given Item | ||
- state changes count: gets the count of State changes of the given Item | ||
- all states: gets all States of the given Item | ||
|
||
In the case of the following two functions the block changes its appearance by replacing the time with an option to chose if the equal value should be skipped or not: | ||
|
||
![previous-block](../images/blockly/blockly-persistence-get-previous.png) | ||
|
||
- previous state value: Gets the previous state with option to skip to different value as current | ||
- next state value: Gets the next state with option to skip to different value as current | ||
- previous state numeric value: same as above but directly returns a number without a unit | ||
- previous state value time: Gets the time when previous state last occurred with option to skip to different value as current | ||
- next state value time: Gets the time for which the next state is available with option to skip to different value as current | ||
- previous state value: gets the previous state with option to skip to different value as current | ||
- next state value: gets the next state with option to skip to different value as current | ||
|
||
The persistence dropdown allows to select the persistence storage from which the value should be retrieved. | ||
It automatically shows only the storage types that are currently installed on your openHAB instance. | ||
|
@@ -84,20 +93,44 @@ Notes: in case no or 0 values are retrieved, make sure that the item in question | |
|
||
![previous-example](../images/blockly/blockly-persistence-get-previous-example.png) | ||
|
||
### Check item change / update since a point in time | ||
### Check item change / update | ||
|
||
![item-change](../images/blockly/blockly-persistence-get-item-change.png) | ||
|
||
_Function:_ checks if an item was updated or changed since a certain point in time | ||
_Function:_ checks if an item was updated or changed since the time provided by _ZonedDateTime_-Block, will be updated or changed until the time provided by _ZonedDateTime_-Block, or between 2 timepoints provided by _ZonedDateTime_-Blocks. | ||
|
||
Type: boolean `true` or `false` | ||
|
||
### Provide last updated date of an Item | ||
### Provide last or next updated or changed date of an Item | ||
|
||
![item-updated-date](../images/blockly/blockly-persistence-updated-date.png) | ||
|
||
_Function:_ Provides the last updated date (including time) of an Item | ||
_Function:_ Provides the last or next updated or changed date (including time) of an Item | ||
Type: ZonedDateTime | ||
|
||
### Persist State or States for an Item | ||
|
||
Persist State or States for an Item. | ||
|
||
Multiple options are available: | ||
|
||
- state (at current time): persist given State at the current time | ||
|
||
Following options are not supported by all persistence services (for example the standard rrd4j does _not_ support this). | ||
|
||
- state (at specific time): persist given State at given time | ||
- list of states (adding): persist list of States, not replacing the already persisted States | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mind giving a example where this needed or helpful of if explained somewhere else link to it? I don't even know what that is for (sorry 😬) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like documentation to link to is meager at best. This has been introduced in the context of the forecast persistence strategy, where it became useful to persist/retrieve a series of persisted values, not just one. I will try to formulate something to make it clearer. |
||
- list of states (replacing): persist list of States, replacing the already persisted States in the same time period | ||
|
||
The _list of states_ input is a Blockly _List_ of _List_. | ||
The inner _List_ represent pairs of time provided by a _ZonedDateTime_-Block and a _String_ representation of the State. | ||
|
||
### Remove all States for an Item | ||
|
||
Remove all States for an Item since the time provided by _ZonedDateTime_-Block, until the time provided by _ZonedDateTime_-Block, or between 2 timepoints provided by _ZonedDateTime_-Blocks.. | ||
|
||
This is not supported by all persistence services (for example the standard rrd4j does _not_ support this). | ||
|
||
## Return to Blockly Reference | ||
|
||
[return to Blockly Reference](index.html#persistence) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an image like this that demonstrates "between"?