Skip to content

Commit 0fb491a

Browse files
committed
Blockly: restructure and grammatical improvements
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
1 parent 1e8e0a3 commit 0fb491a

37 files changed

Lines changed: 294 additions & 361 deletions

configuration/blockly/index.md

Lines changed: 74 additions & 190 deletions
Large diffs are not rendered by default.

configuration/blockly/rules-blockly-date-handling.md

Lines changed: 116 additions & 89 deletions
Large diffs are not rendered by default.

configuration/blockly/rules-blockly-ephemeris.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: Rules Blockly - Ephemeris
66

77
# Ephemeris
88

9-
[return to Blockly Reference](index.html#ephemeris)
9+
[Return to Blockly Reference](index.html#ephemeris)
1010

1111
## Introduction
1212

@@ -61,4 +61,4 @@ Additional holidays must be configured in _ephemeris.cfg_.
6161

6262
## Return to Blockly Reference
6363

64-
[return to Blockly Reference](index.html#ephemeris)
64+
[Return to Blockly Reference](index.html#ephemeris)

configuration/blockly/rules-blockly-before-using.md renamed to configuration/blockly/rules-blockly-getting-started.md

Lines changed: 71 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
layout: documentation
3-
title: Rules Blockly - Before Using
3+
title: Rules Blockly - Getting Started
44
---
55
<!-- markdownlint-disable MD036 -->
66

7-
# Before using blockly in openHAB
7+
# Getting Started with Blockly in openHAB
88

9-
[return to Blockly Reference](index.html#before-using-blockly)
9+
[Return to Blockly Reference](index.html#getting-started)
1010

1111
## Preface
1212

@@ -17,34 +17,31 @@ Please read them carefully before asking questions in the forum.
1717

1818
[[toc]]
1919

20-
## **openHAB Configuration Files**
20+
## openHAB Configuration Files
2121

2222
Some openHAB blocks rely on particular configuration files found in the openHAB configuration folder.
23-
This folder is referred to as $OPENHAB\_CONF in this page, and the location of this folder for your setup can be found via the UI: _Help & About_ -> _Technical Information_ -> _Configuration folder_.
23+
This folder is referred to as `$OPENHAB_CONF` throughout this documentation.
24+
The location of this folder can be found via the UI when logged in as an admin: _Help & About_ -> _Technical Information_ -> _Configuration folder_.
2425

25-
- via mounting the files shares from the server to your client-PC.
26-
In the main UI as an admin you can go to _Help & About_ and will have the different folder locations under _Technical information_.
27-
- the exact configuration of the shares can be found on your server at [/etc/samba/smb.conf](https://github.com/openhab/openhabian/blob/main/includes/smb.conf).
28-
- Use the share _openHAB_-conf when mounting it from Windows or macOS
26+
When using openHABian, a [samba share](https://github.com/openhab/openhabian/blob/main/includes/smb.conf) called `openHAB-conf` is created for the configuration folder.
27+
This share can be mounted on your computer for easy access.
2928

30-
**Link the openHAB share in Windows**
29+
### Mounting the openHAB-conf share in Windows
3130

32-
- Find you openHAB-Server via the network share functionality
33-
- User the share _openHAB_-conf to assign it to a network drive
31+
- Find your openHAB-Server via the network share functionality
32+
- Find the `openHAB-conf` folder and assign it to a network drive
3433

35-
**Link the openHAB share in macOS**
34+
### Mounting the openHAB share in macOS
3635

3736
- Finder -> Go -> Connect to Server
38-
- Enter the username and server name to connect to the openHAB Server
39-
37+
- Enter the username and server name to connect to the openHAB Server
4038
![macos-share-1](../images/blockly/blockly-openhab-macos-share-1.png)
41-
- then choose the folder you want to mount
42-
39+
- Then choose the folder you want to mount
4340
![macos-share-2](../images/blockly/blockly-openhab-macos-share-2.png)
4441

45-
**Finding it on Linux**
42+
### Finding it on Linux
4643

47-
- Access the folder directly on the openHAB server at _/etc/openhab_
44+
- Access the folder directly on the openHAB server at `/etc/openhab`
4845

4946
All methods reveal the following folders
5047

@@ -61,29 +58,39 @@ All methods reveal the following folders
6158
- things
6259
- transform
6360

64-
## Creating a blockly rule via the UI
65-
66-
Also view ![youtube](../images/blockly/youtube-logo-small.png) [Creating a Blockly Rule](https://youtu.be/EdllUlJ7p6k?t=429)
67-
68-
- go to Settings -> Rules
69-
- press ![plus](../images/blockly/blockly-plus-small.png) on bottom right
70-
- enter a unique id and rule name for your new blockly rule
71-
- Under "When" click on "Add Trigger" to define a trigger for the rule (you may add multiple triggers which are perceived as any of those triggers may occurs which stands for an OR combination of the triggers)
72-
- choose a title for the rule
73-
- choose "item" (or something else) that should trigger the rule
74-
- select the item from your model and the click PICK on the upper right corner
75-
- choose "received a command", "was updated" or "changed"
76-
- Under "Then" click on "Add Action"
77-
- choose ![run-script-1](../images/blockly/blockly-run-script.png)
78-
- click on ![run-script-2](../images/blockly/blockly-run-script-2.png) und you should now see this screen
79-
![blockly-edit-screen](../images/blockly/blockly-edit-screen.png)
80-
- you can now click the ![toolbox-submenu](../images/blockly/blockly-arrow.png) to access all openHAB Blocks.
61+
## Creating a Blockly
62+
63+
Video tutorial ![youtube](../images/blockly/youtube-logo-small.png) [Creating a Blockly Rule](https://youtu.be/EdllUlJ7p6k?t=429)
64+
65+
Steps:
66+
67+
- Go to `Settings` -> `Rules`
68+
- Press ![plus](../images/blockly/blockly-plus-small.png) on bottom right
69+
- Enter a unique id and rule name for your new Blockly rule
70+
- Under `When`, click `Add Trigger` to define a trigger for the rule.
71+
- Choose `Item Event` (or something else) that should trigger the rule.
72+
- Select the item from your model and the click `Pick` on the upper right corner.
73+
- (Optional) Enter a title for the trigger. A suitable default title will used when none was provided.
74+
- Choose "received a command", "was updated" or "changed" accordingly.
75+
- Under `Then`, click `Add Action`
76+
- Click ![Inline Script](../images/blockly/blockly-run-script.png)
77+
- Click ![Design with Blockly](../images/blockly/blockly-design-with-blockly.png)
78+
- You should now see this screen:
79+
![blockly-edit-screen](../images/blockly/blockly-edit-screen.png)
8180
- Drag and Drop the blocks to the white area
82-
- Press `Ctrl-s` (Windows) or `Command-s` (macOS) to save your rule
83-
- Press `Ctrl-r` (Windows) or `Command-r` (macOS) to directly run your rule with the trigger
84-
- Press `Ctrl-d` (Windows) or `Command-d` (macOS) to disable / enable your rule.
85-
See the following video on ![youtube](../images/blockly/youtube-logo-small.png) [How to disable Rules](https://youtu.be/hSRfooBKn9A?t=1668)
86-
- **Click on** ![showblock](../images/blockly/blockly-workspace-showblocks.png) **on the lower right of the bottom toolbar to see the generated code** and will transition to ![showcode](../images/blockly/blockly-workspace-showcode.png)(click again to come back to the blocks).
81+
- Press <kbd>Ctrl</kbd>+<kbd>S</kbd> (Windows) or <kbd>Command</kbd>+<kbd>S</kbd> (macOS) to save your rule
82+
- Press <kbd>Ctrl</kbd>+<kbd>R</kbd> (Windows) or <kbd>Command</kbd>+<kbd>R</kbd> (macOS) to directly run your rule with the trigger
83+
- Press <kbd>Ctrl</kbd>+<kbd>D</kbd> (Windows) or <kbd>Command</kbd>+<kbd>D</kbd> (macOS) to disable / enable your rule.
84+
See the following video on ![youtube](../images/blockly/youtube-logo-small.png) [How to disable Rules](https://youtu.be/hSRfooBKn9A?t=1668)
85+
- **Click on** ![showblock](../images/blockly/blockly-workspace-showblocks.png) **on the lower right of the bottom toolbar to see the generated code** and it will transition to ![showcode](../images/blockly/blockly-workspace-showcode.png)(click again to come back to the blocks).
86+
87+
::: Note
88+
89+
Multiple triggers may be added to the rule.
90+
The rule will be executed once for each trigger that occurred.
91+
This means that if multiple trigger occurred, the rule will be executed multiple times.
92+
93+
:::
8794

8895
More about the topic of code generation can be viewed at ![youtube](../images/blockly/youtube-logo-small.png) [Blockly as an ECMA-Script code generator](https://youtu.be/EdllUlJ7p6k?t=1739)
8996

@@ -108,6 +115,21 @@ A context menu is available when right-clicking on a block.
108115
Right-clicking on an empty area in the workspace will pop up a slightly different context menu.
109116
In particular, `Clean up Blocks` will automatically move and arrange your blocks neatly.
110117

118+
### Getting Help
119+
120+
Each block offers a **Help** link in its [context menu](#context-menu).
121+
It will open a page that provides further information about the function of that particular block.
122+
123+
![context-help](../images/blockly/blockly-context-help.png)
124+
125+
There is also a help button available in each section of the toolbox that links to the documentation of the whole section.
126+
127+
![main-help-button](../images/blockly/blockly-main-help.png)
128+
129+
_When asking for help in the community forums, please include the respective code that is being generated._
130+
131+
See also: ![youtube](../images/blockly/youtube-logo-small.png) [Various Help Documentation available in openHAB Blocky](https://youtu.be/EdllUlJ7p6k?t=1589)
132+
111133
### Selecting Blocks
112134

113135
Click on a block to select it.
@@ -150,28 +172,28 @@ You can also copy a set of blocks into your clipboard, and paste them into anoth
150172

151173
### Searching the workspace
152174

153-
Sometimes blockly rules become pretty big, and it is hard to find particular blocks in the rule.
175+
Sometimes Blockly rules become pretty big, and it is hard to find particular blocks in the rule.
154176
Therefore, a search functionality has been provided by pressing Cmd/Ctrl-F which opens a small search window in the top right (just below the "save"-label).
155177
After pressing _Enter_ all found blocks that contain the search term are marked in black.
156178

157179
![blockly-search](../images/blockly/blockly-search.png)
158180

159181
## Use Frontail for viewing log files
160182

161-
During development the log-block is lot very often which writes information into the log files.
183+
The log block can be used to write information into the log file during development.
162184

163-
- To be able to conveniently view your log files it is recommended to setup _frontail_ which can be achieved easily via [openhabian-config](https://www.openhab.org/docs/installation/openhabian.html#optional-components)
185+
- To view the log file, it is recommended to setup _frontail_ which can be installed easily with [openhabian-config](https://www.openhab.org/docs/installation/openhabian.html#optional-components)
164186
- Start `openhabian-config` on your server and choose option 20 and then option 21
165187
- After installation you can view your logs under [openhabian-config](http://myopenhab-server:9001) (adapt the server name)
166-
- **see [how to log](https://www.openhab.org/docs/administration/logging.html)**
188+
- See [Logging in openHAB](https://www.openhab.org/docs/administration/logging.html) for more details.
167189

168190
More on that topic can be viewed at ![youtube](../images/blockly/youtube-logo-small.png) [Logging](https://youtu.be/EdllUlJ7p6k?t=670)
169191

170-
## Show an item status watch list besides the blockly rules
192+
## Show an item status watch list besides the Blockly rules
171193

172-
In the developer section there is the possibility to add a sidebar to the blockly rules development workspace that allows to watch live status of an item.
173-
View the chapter ![youtube](../images/blockly/youtube-logo-small.png) [Debugging Rules with openHAB Developer Tools to watch Item-Status](https://youtu.be/EdllUlJ7p6k?t=325) for more information
194+
In the developer section there is the possibility to add a sidebar to the Blockly rules development workspace that allows to watch live status of an item.
195+
View the chapter ![youtube](../images/blockly/youtube-logo-small.png) [Debugging Rules with openHAB Developer Tools to watch Item-Status](https://youtu.be/EdllUlJ7p6k?t=325) for more information.
174196

175197
## Return to Blockly Reference
176198

177-
[return to Blockly Reference](index.html#before-using-blockly)
199+
[Return to Blockly Reference](index.html#before-using-blockly)

configuration/blockly/rules-blockly-items-things.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: Rules Blockly - Items & Things
66

77
# Item & Things
88

9-
[return to Blockly Reference](index.html#items-and-things)
9+
[Return to Blockly Reference](index.html#items-and-things)
1010

1111
## Introduction
1212

@@ -305,4 +305,4 @@ Function: Gets a **Thing Status** for use in other Thing related functions
305305

306306
## Return to Blockly Reference
307307

308-
[return to Blockly Reference](index.html#items-and-things)
308+
[Return to Blockly Reference](index.html#items-and-things)

configuration/blockly/rules-blockly-logging.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: Rules Blockly - Logging
66

77
# Logging
88

9-
[return to Blockly Reference](index.html#logging)
9+
[Return to Blockly Reference](index.html#logging)
1010

1111
## Introduction
1212

@@ -46,4 +46,4 @@ _Function:_ creates a print statement with the given text in the rule that logs
4646

4747
## Return to Blockly Reference
4848

49-
[return to Blockly Reference](index.html#logging)
49+
[Return to Blockly Reference](index.html#logging)

configuration/blockly/rules-blockly-notifications.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: Rules Blockly - Notifications
66

77
# Notifications
88

9-
[return to Blockly Reference](index.html#notifications)
9+
[Return to Blockly Reference](index.html#notifications)
1010

1111
## Introduction
1212

@@ -61,4 +61,4 @@ _Function:_ Sends a notification to myopenhab.org only
6161

6262
## Return to Blockly Reference
6363

64-
[return to Blockly Reference](index.html#notifications)
64+
[Return to Blockly Reference](index.html#notifications)

configuration/blockly/rules-blockly-persistence.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: Rules Blockly - Persistence
66

77
# Persistence
88

9-
[return to Blockly Reference](index.html#persistence)
9+
[Return to Blockly Reference](index.html#persistence)
1010

1111
## Introduction
1212

@@ -86,4 +86,4 @@ Type: ZonedDateTime
8686

8787
## Return to Blockly Reference
8888

89-
[return to Blockly Reference](index.html#persistence)
89+
[Return to Blockly Reference](index.html#persistence)

configuration/blockly/rules-blockly-run-and-process.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: Rules Blockly - Run & Process and Transformations
66

77
# Run & Process (Rules and Scripts)
88

9-
[return to Blockly Reference](index.html#run-process-rules-and-scripts)
9+
[Return to Blockly Reference](index.html#run-process-rules-and-scripts)
1010

1111
## Introduction
1212

@@ -189,4 +189,4 @@ See also the short video part about ![youtube](../images/blockly/youtube-logo-sm
189189

190190
## Return to Blockly Reference
191191

192-
[return to Blockly Reference](index.html#run-process-rules-and-scripts)
192+
[Return to Blockly Reference](index.html#run-process-rules-and-scripts)

configuration/blockly/rules-blockly-standard-ext.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: Rules Blockly - openHAB Extensions to the Standard
66

77
# openHAB Extensions to the Standard
88

9-
[return to Blockly Reference](index.html#openhab-extensions-to-the-standard)
9+
[Return to Blockly Reference](index.html#openhab-extensions-to-the-standard)
1010

1111
## Introduction
1212

@@ -243,9 +243,9 @@ Therefore there is a good introduction to loops available which can be viewed at
243243

244244
## Functions
245245

246-
A more advanced feature for reusable blockly code is _functions_.
246+
A more advanced feature for reusable Blockly code is _functions_.
247247
More about that topic can be viewed at ![youtube](../images/blockly/youtube-logo-small.png) [Functions](https://youtu.be/hSRfooBKn9A?t=60) and [Parameters](https://youtu.be/hSRfooBKn9A?t=170).
248248

249249
## Return to Blockly Reference
250250

251-
[return to Blockly Reference](index.html#openhab-extensions-to-the-standard)
251+
[Return to Blockly Reference](index.html#openhab-extensions-to-the-standard)

0 commit comments

Comments
 (0)