[Documentation] Markdown improvements f to m (#13866)

Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
This commit is contained in:
Jerome Luckenbach
2022-12-08 21:36:05 +01:00
committed by GitHub
parent 3c236b3103
commit 0e68936663
122 changed files with 3490 additions and 3662 deletions

View File

@@ -26,14 +26,14 @@ It can be extended with different channels.
| `headers` | yes | - | Additional headers that are sent along with the request. Format is "header=value". Multiple values can be stored as `headers="key1=value1", "key2=value2", "key3=value3",`. When using text based configuration include at minimum 2 headers to avoid parsing errors.|
| `ignoreSSLErrors` | no | false | If set to true ignores invalid SSL certificate errors. This is potentially dangerous.|
*Note:* Optional "no" means that you have to configure a value unless a default is provided and you are ok with that setting.
_Note:_ Optional "no" means that you have to configure a value unless a default is provided and you are ok with that setting.
*Note:* The `BASIC_PREEMPTIVE` mode adds basic authentication headers even if the server did not request authentication.
_Note:_ The `BASIC_PREEMPTIVE` mode adds basic authentication headers even if the server did not request authentication.
This is dangerous and might be misused.
The option exists to be able to authenticate when the server is not sending the proper 401/Unauthorized code.
Authentication might fail if redirections are involved as headers are stripper prior to redirection.
*Note:* If you rate-limit requests by using the `delay` parameter you have to make sure that the time between two refreshes is larger than the time needed for one refresh cycle.
_Note:_ If you rate-limit requests by using the `delay` parameter you have to make sure that the time between two refreshes is larger than the time needed for one refresh cycle.
**Attention:** `baseUrl` (and `stateExtension`/`commandExtension`) should not normally use escaping (e.g. `%22` instead of `"` or `%2c` instead of `,`).
URLs are properly escaped by the binding itself before the request is sent.
@@ -52,7 +52,7 @@ The `image` channel-type supports `stateExtension`, `stateContent` and `escapedU
|-------------------------|----------|-------------|-------------|
| `stateExtension` | yes | - | Appended to the `baseURL` for requesting states. |
| `commandExtension` | yes | - | Appended to the `baseURL` for sending commands. If empty, same as `stateExtension`. |
| `stateTransformation ` | yes | - | One or more transformation applied to received values before updating channel. |
| `stateTransformation` | yes | - | One or more transformation applied to received values before updating channel. |
| `commandTransformation` | yes | - | One or more transformation applied to channel value before sending to a remote. |
| `escapedUrl` | yes | - | This specifies whether the URL is already escaped. |
| `stateContent` | yes | - | Content for state requests (if method is `PUT` or `POST`) |
@@ -163,13 +163,13 @@ After the parameter reference the format needs to be appended.
See the link above for more information about the available format parameters (e.g. to use the string representation, you need to append `s` to the reference, for a timestamp `t`).
When sending an OFF command on 2020-07-06, the URL
```
```text
http://www.domain.org/home/lights/23871/?status=%2$s&date=%1$tY-%1$tm-%1$td
```
is transformed to
```
```text
http://www.domain.org/home/lights/23871/?status=OFF&date=2020-07-06
```
@@ -177,12 +177,12 @@ http://www.domain.org/home/lights/23871/?status=OFF&date=2020-07-06
### `demo.things`
```
```java
Thing http:url:foo "Foo" [
baseURL="https://example.com/api/v1/metadata-api/web/metadata",
headers="key1=value1", "key2=value2", "key3=value3",
refresh=15] {
Channels:
Type string : text "Text" [ stateTransformation="JSONPATH:$.metadata.data" ]
baseURL="https://example.com/api/v1/metadata-api/web/metadata",
headers="key1=value1", "key2=value2", "key3=value3",
refresh=15] {
Channels:
Type string : text "Text" [ stateTransformation="JSONPATH:$.metadata.data" ]
}
```

View File

@@ -1,7 +1,10 @@
## Vito WIFI (https://github.com/openhab/openhab-addons/issues/9480#issuecomment-751335696)
# Xtend Examples
## Vito WIFI (<https://github.com/openhab/openhab-addons/issues/9480#issuecomment-751335696>)
### .things
```
```java
Thing http:url:vitowifi "VitoWifi" @ "1stfloor" [baseURL="http://192.168.1.61/", commandMethod="POST", delay="1000", refresh="90", timeout="900"] {
Channels:
@@ -13,21 +16,21 @@ Thing http:url:vitowifi "VitoWifi" @ "1stfloor" [baseURL="http://192.168.1.61/",
### .items
```
```java
Number Vito_ID "Vito_ID" <switch> (gHeating) {channel="http:url:vitowifi:Channel_Vito_ID" , expire="5m" }
Number Vito_Mode "Vito_Mode" <switch> (gHeating) {channel="http:url:vitowifi:Channel_Vito_Mode" , expire="5m" }// 0= Off 1= WW 2= WW+heat 0x42 (66)=party
Number Vito_OnOff "ONOFF Switch" <switch> (gHeating) {channel="http:url:vitowifi:Channel_Vito_OnOff" , expire="5m" }
```
## Feinstaubsensor (https://community.openhab.org/t/http-binding-openhab-3-version/101851/235)
## Feinstaubsensor (<https://community.openhab.org/t/http-binding-openhab-3-version/101851/235>)
The http request http://feinstaubsensor-14255834/data.json is answering with a JSON string.
The http request `http://feinstaubsensor-14255834/data.json` is answering with a JSON string.
So I need some simple JSONPATH transformation and one java script transformation.
Data is polled every 10 seconds.
### .things
```
```java
Thing http:url:feinstaub "Feinstaub" [ baseURL="http://feinstaubsensor-14255834/data.json", refresh=10] {
Channels:
Type number : SDS_PM10 [ stateTransformation="JSONPATH:$.sensordatavalues[0].value" ]
@@ -40,7 +43,7 @@ Thing http:url:feinstaub "Feinstaub" [ baseURL="http://feinstaubsensor-14255834/
### .items
```
```java
/* **************************
* Feinstaub sensor data
* ************************** */
@@ -55,9 +58,9 @@ Thing http:url:feinstaub "Feinstaub" [ baseURL="http://feinstaubsensor-14255834/
I have a BME2080 sensor connected. The Humidity must be diveded by 100 to show hPa.
```
```javascript
(function(x) {
var json = JSON.parse(x);
return json.sensordatavalues[3].value/100;
})(input)
```
```