Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thing status description clickable link to binding's url #2447

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
13 changes: 11 additions & 2 deletions developers/bindings/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ If the device or service is not working correctly, the binding should change the
The status can be updated via an inherited method from the BaseThingHandler class by calling:

```java
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR);
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
```

The second argument of the method takes a `ThingStatusDetail` enumeration value, which further specifies the current status situation.
Expand All @@ -332,7 +332,16 @@ The binding should also provide additional status description, if available.
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):

```java
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR, "HTTP 403 - Access denied");
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "HTTP 403 - Access denied");
```

Some bindings may need to collect further configurations or login credentials through its servlet, hosted by openHAB.
A link can be included in the status description when it starts with `http(s)://<YOUROPENHAB>:<YOURPORT>/` followed by binding-specific path.
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.
For example:

```java
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Please login through: http(s)://<YOUROPENHAB>:<YOURPORT>/mybinding/" + getThing().getUID().getId());
```

After the thing is created, the framework calls the `initialize` method of the handler.
Expand Down
Loading