Merge commit '31306459472cd365ebb13b2c60762d5f6f8bad48' into HEAD

pull/1969/head
openHAB Build Server 2022-12-18 09:12:19 +00:00
commit 0cc8e2056d
16 changed files with 86 additions and 11 deletions

View File

@ -204,6 +204,7 @@ This section explains only the blocks that have been added to the standard block
[![openHAB Extensions to the standard](../images/blockly/blockly-text-overview-small.png "openHAB Extensions to the Standard")
](rules-blockly-standard-ext.html)[![openHAB Extensions to the standard](../images/blockly/blockly-colors-overview-small.png "openHAB Extensions to the Standard")
](rules-blockly-standard-ext.html)[![openHAB Extensions to the standard](../images/blockly/blockly-lists-dictionary-overview-small.png "openHAB Extensions to the Standard")
![lists-overview-concat](../images/blockly/blockly-lists-concatenate.png)
](rules-blockly-standard-ext.html)
See [openHAB Extensions to the standard](rules-blockly-standard-ext.html) section.

View File

@ -80,6 +80,8 @@ Type: _ZonedDateTime_
This block will return the date as _ZonedDateTime_ based on the given String.
The String may be one of the following formats (since 3.3) the following formats are supported)
- HH:mm
- HH:mm:ss
- yyyy-MM-dd
- yyyy-MM-dd HH:mm
- yyyy-MM-dd HH:mm:ss
@ -93,7 +95,11 @@ The String may be one of the following formats (since 3.3) the following formats
The input String may also be provided via variable-block or a date from an item state.
In case parts of the date are not provided due to shorter pattern, the others are set to 0
Tip: if you want to create a datetime with your time zone use the "copy of"-block and overwrite its values
:::tip
if you want to create a datetime with your time zone use the "copy of"-block and overwrite its values
:::
More about that topic can be viewed at ![youtube](../images/blockly/youtube-logo-small.png) [Creating Datetimes and other datetime blocks](https://youtu.be/KwhYKy1_qVk?t=2010)
@ -112,7 +118,11 @@ Creates a ZonedDateTime by providing all necessary six values
- minute of time
- second of time
Tip: if you want to create a datetime with your time zone use the "copy of"-block and overwrite its values
:::tip
if you want to create a datetime with your time zone use the "copy of"-block and overwrite its values
:::
### Create Datetime based on a specific date ("Copy Of")

View File

@ -42,8 +42,13 @@ See a video introduction at ![youtube](../images/blockly/youtube-logo-small.png)
Function: Retrieves a specific **Item** or **Group** for use in other item related functions.
- **Tip:** never use this block alone as it only returns the items name which alone does not make sense.
:::tip
never use this block alone as it only returns the items name which alone does not make sense.
Instead use the get-Item-Block below.
:::
- Clicking 'MyItem' displays a list of **Items** to pick from
- Technically this block returns the _name_ of the item as a String.
- As a result, this block can be used wherever the item name is required as a String.
@ -76,7 +81,11 @@ Function: Get the current state of an **Item** or **Group**
Note that most of the states can and will be directly **converted automatically to a String** but be careful that some of the **more complex states may instead return a complex object instead**.
**Tip:** it is recommended in this case to assign this to a variable and use the "String-Append-Text" with an empty "" to convert it into a String for further processing.
:::tip
it is recommended in this case to assign this to a variable and use the "String-Append-Text" with an empty "" to convert it into a String for further processing.
:::
See the [Item-State documentation](https://www.openhab.org/docs/configuration/items.html#state) for more information
@ -102,6 +111,22 @@ The following example depicts the above possibilities:
![blockly-getMembersExample](../images/blockly/blockly-getMembersExample.png)
### Get Items with Tag
![blockly-getMembers](../images/blockly/blockly-getitemswithtag.png)
Function: Gets all items with the given tags which you can iterate over via a loop
- returns a collection of items which have the given tags
- multiple tags can be provided which then need to be separared with a comma
- if multiple tags are given, the item must have all of the tags ("and"-condition)
:::tip
If you need an item that has one of multiple tags, then you need to use one block of each and then use the ["concatenate list block"](https://www.openhab.org/docs/configuration/blockly/rules-blockly-standard-ext.html#concatenate-list) to combine the results.
:::
### Get particular attributes of an item
![blockly-getItemAttributes](../images/blockly/blockly-getItemAttributes.png)

View File

@ -46,7 +46,22 @@ This method uses a time-weighted average calculation
- maximum: gets the maximum value of the State of the given Item since a certain point in time
- maximum: gets the sum of the State of the given Item since a certain point in time
Note: in case no or 0 values are retrieved, make sure that the item in question is actually persisted.
In the case of the following two functions the block changes its appearence 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
- previous state value time: Gets the time when previous state last occurred with option to skip to different value as current
The skip option set to true allows to search for first state that is different from the current state.
_Important:_ This option is not supported by all persistence databases and may throw an error in that case (for example the standard rrd4j does _not_ support it while influxdb does support it).
Notes: in case no or 0 values are retrieved, make sure that the item in question is actually persisted.
**Previous State Example**
![previous-example](../images/blockly/blockly-persistence-get-previous-example.png)
### Check item change / update since a point in time

View File

@ -27,8 +27,6 @@ More about that topic can be viewed at ![youtube](../images/blockly/youtube-logo
### CRLF
Since OpenHAB 3.3.0M6
CRLF stands for carriage-return / line-feed which is a technical term for adding a new line in a string
![crlf](../images/blockly/blockly-text-overview.png)
@ -39,6 +37,17 @@ _Function:_ return a newline character to be added to a string.
![crlf](../images/blockly/blockly-text-crlf-example.png)
### Text Replace
![text-replace](../images/blockly/blockly-text-replace.png)
_Function:_ Allows to replace something that is defined by the _pattern_ in the _origin_-text with what is provided in _replacement_.
Note that the pattern can be just a text or also regex expression.
**Example:**
![text-replace example](../images/blockly/blockly-text-replace-example.png)
## Colors
More about that topic can be viewed at ![youtube](../images/blockly/youtube-logo-small.png) [Using Color-Blocks and HSB-Conversion](https://youtu.be/EdllUlJ7p6k?t=1366)
@ -77,7 +86,11 @@ _Function:_ Returns a color by mixing the given values in a range from 0 - 255 f
_Function:_ Blends two colors chosen via a color picker into one color by the given ratio.
Tip: this could be used for example with a loop that changes the ratio from 0 to 1 to blend the first color into a second
:::tip
this could be used for example with a loop that changes the ratio from 0 to 1 to blend the first color into a second
:::
### Create HSB-color from RGB color (openHAB)
@ -97,13 +110,14 @@ _Function:_ This a special openHAB block that converts a hexadecimal color code
- use that block and connect one of the above blocks into that one to be able to retrieve the HSB value of that block.
**Example:**
Example
![get-hsb-of-example](../images/blockly/blockly-colors-hsbof-example.png)
## Lists
![lists-overview](../images/blockly/blockly-lists-dictionary-overview.png)
![lists-overview-concat](../images/blockly/blockly-lists-concatenate.png)
### Dictionary for managing key / value pairs
@ -115,7 +129,7 @@ Then drag the key block on the upper left into the key/value bracket on the righ
Rename the keys as required and then add any value block type to the related key:
Example:
**Example:**
![dictionary-example](../images/blockly/blockly-lists-dictionary-example.png)
@ -125,10 +139,20 @@ Example:
_Function:_ Retrieves the value of the key in the given directory
Example:
**Example:**
![dictionary-getkey-example](../images/blockly/blockly-lists-dictionary-getkey-example.png)
### Concatenate lists
![lists-overview-concat](../images/blockly/blockly-lists-concatenate.png)
_Function:_ adds the second list to the first list and returns a new list
Example:
![lists-overview-concat](../images/blockly/blockly-lists-concatenate-example.png)
## Loops
Even though there a no specialized openHAB blocks provided, loops are used rather often.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 KiB

After

Width:  |  Height:  |  Size: 304 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB