mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[netatmo] Enhance bridge status reporting (#16571)
* Enhance bridge status reporting --------- Signed-off-by: clinique <gael@lhopital.org> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
4206dd811a
commit
b861c02386
@ -23,7 +23,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
public enum ConfigurationLevel {
|
||||
EMPTY_CLIENT_ID("@text/conf-error-no-client-id"),
|
||||
EMPTY_CLIENT_SECRET("@text/conf-error-no-client-secret"),
|
||||
REFRESH_TOKEN_NEEDED("@text/conf-error-grant-needed"),
|
||||
REFRESH_TOKEN_NEEDED("@text/conf-error-grant-needed [ \"%s\" ]"),
|
||||
COMPLETED("");
|
||||
|
||||
public String message;
|
||||
|
@ -232,7 +232,7 @@ public class ApiBridgeHandler extends BaseBridgeHandler {
|
||||
servlet.startListening();
|
||||
grantServlet = Optional.of(servlet);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
||||
ConfigurationLevel.REFRESH_TOKEN_NEEDED.message);
|
||||
ConfigurationLevel.REFRESH_TOKEN_NEEDED.message.formatted(servlet.getPath()));
|
||||
}
|
||||
|
||||
public ApiHandlerConfiguration getConfiguration() {
|
||||
|
@ -36,9 +36,9 @@ public abstract class NetatmoServlet extends HttpServlet {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
private final HttpService httpService;
|
||||
private final String path;
|
||||
|
||||
protected final ApiBridgeHandler handler;
|
||||
protected final String path;
|
||||
|
||||
public NetatmoServlet(ApiBridgeHandler handler, HttpService httpService, String localPath) {
|
||||
this.path = BASE_PATH + localPath + "/" + handler.getId();
|
||||
@ -60,4 +60,8 @@ public abstract class NetatmoServlet extends HttpServlet {
|
||||
httpService.unregister(path);
|
||||
this.destroy();
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public class WebhookServlet extends NetatmoServlet {
|
||||
@Override
|
||||
public void startListening() {
|
||||
super.startListening();
|
||||
URI uri = UriBuilder.fromUri(webHookUrl).path(path + webHookPostfix).build();
|
||||
URI uri = UriBuilder.fromUri(webHookUrl).path(getPath() + webHookPostfix).build();
|
||||
try {
|
||||
logger.info("Setting up WebHook at Netatmo to {}", uri.toString());
|
||||
hookSet = securityApi.addwebhook(uri);
|
||||
|
@ -459,7 +459,7 @@ config.refreshInterval.description = The refresh interval to poll Netatmo API (i
|
||||
|
||||
conf-error-no-client-id = Cannot connect to Netatmo bridge as no client id is available in the configuration
|
||||
conf-error-no-client-secret = Cannot connect to Netatmo bridge as no client secret is available in the configuration
|
||||
conf-error-grant-needed = Configuration incomplete, please grant the binding to Netatmo Connect.
|
||||
conf-error-grant-needed = Complete the configuration by granting the binding to Netatmo Connect: ''{0}''.
|
||||
status-bridge-offline = Bridge is not connected to Netatmo API
|
||||
device-not-connected = Thing is not reachable
|
||||
data-over-limit = Data seems quite old
|
||||
|
Loading…
Reference in New Issue
Block a user