Skip to content

Commit 0914868

Browse files
committed
Thing status description clickable link to binding's url
See openhab/openhab-webui#2996 Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
1 parent 673da56 commit 0914868

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

developers/bindings/index.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ If the device or service is not working correctly, the binding should change the
322322
The status can be updated via an inherited method from the BaseThingHandler class by calling:
323323

324324
```java
325-
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR);
325+
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
326326
```
327327

328328
The second argument of the method takes a `ThingStatusDetail` enumeration value, which further specifies the current status situation.
@@ -332,7 +332,16 @@ The binding should also provide additional status description, if available.
332332
This description might contain technical information (e.g. an HTTP status code, or any other protocol specific information, which helps to identify the current problem):
333333

334334
```java
335-
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR, "HTTP 403 - Access denied");
335+
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "HTTP 403 - Access denied");
336+
```
337+
338+
Some bindings may need to collect further configurations or login credentials through its servlet, hosted by openHAB.
339+
A link can be included in the status description when it starts with: `http(s)://<YOUROPENHAB>:<YOURPORT>/` followed by binding-specific path.
340+
This special string will be converted in Main UI into a clickable link with the same openhab host and port that Main UI is connected to.
341+
For example:
342+
343+
```java
344+
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Please login through: http(s)://<YOUROPENHAB>:<YOURPORT>/mybinding/" + getThing().getUID().getId());
336345
```
337346

338347
After the thing is created, the framework calls the `initialize` method of the handler.

0 commit comments

Comments
 (0)