Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions configuration/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ All HTTP Actions can have a last `timeout` parameter added in ms. eg. `sendHttpP

For example:

```javascript
val headers = newHashMap("Cache-control" -> "no-cache")
```java
val headers = #{"Cache-control" -> "no-cache"}
val output = sendHttpGetRequest("https://example.com/?id=1", headers, 1000)
```

Expand Down Expand Up @@ -189,7 +189,7 @@ The Timer object supports the following methods:
The result is of type `ThingStatusInfo`.
It contains [Thing Status]({{base}}/concepts/things.html), [Status Details]({{base}}/concepts/things.html) and [Status Description]({{base}}/concepts/things.html).
Refer to [Thing Status API]({{base}}/concepts/things.html) for how to get those information.
If you just want to know the status, you can use `thingStatusInfo.getStatus().toString()` and the result will be one of the values in [Thing Status]({{base}}/concepts/things.html).
If you just want to know the status, you can use `thingStatusInfo.status.toString` and the result will be one of the values in [Thing Status]({{base}}/concepts/things.html).

> If the thing is removed or it's not added yet, it'll return null.

Expand All @@ -198,7 +198,7 @@ For example:
```java
var thingStatusInfo = getThingStatusInfo("zwave:device:c5155aa4:node2")

if ((thingStatusInfo !== null) && (thingStatusInfo.getStatus().toString() == "ONLINE")) {
if (thingStatusInfo?.status?.toString == "ONLINE") {
logInfo("ThingStatus", "The thing is online.")
} else {
logError("ThingStatus", "The thing is offline or doesn't exist.")
Expand Down
10 changes: 5 additions & 5 deletions configuration/rules-dsl.md
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ var DecimalType parsedResult = new DecimalType(Long.parseLong(hex_code, 16))
var myTemperature = 20|°C

// get units in text
var myUnits = myTemperature.getUnit.toString // gives "°C"
var myUnits = myTemperature.unit.toString // gives "°C"

// convert a quantity state into a different unit:
var fahrenheit = myTemperature.toUnit("°F") // will contain quantity 68°F
Expand Down Expand Up @@ -804,10 +804,10 @@ Caveat: Please note the semicolon after the return statement which terminates th
If a rule is explicitly run from another script, rule, a Main UI widget, etc., instead of a trigger, the rule can be started before the current execution has ended.
It may be necessary to guard against concurrency.

```javascript
```java
import java.util.concurrent.locks.ReentrantLock

val ReentrantLock lock = new ReentrantLock
val lock = new ReentrantLock

rule ConcurrentCode
when
Expand Down Expand Up @@ -859,7 +859,7 @@ try {
var temperature = transformRaw("JSONPATH", "$.temperature", jsonstring)
}
catch(TransformationException e) {
logError("Error", "Some bad stuff happened in my rule: " + e.getMessage)
logError("Error", "Some bad stuff happened in my rule: " + e.message)
}
finally {
// always runs even if there was an error, good place for cleanup
Expand Down Expand Up @@ -947,7 +947,7 @@ rule "Start wake up light on sunrise"
when
Channel "astro:sun:home:rise#event" triggered
then
switch(receivedEvent) {
switch receivedEvent {
case "START": {
Light.sendCommand(ON)
}
Expand Down