mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[haywardomnilogic] Fix bridge thing status upon re-establishing server comms (#10371)
* Update HaywardBridgeHandler to set thingstatus online upon succesful getTelemetryData Signed-off-by: matchews <mmyers75@icloud.com> * updated default endpoint url Signed-off-by: matchews <mmyers75@icloud.com> * Bug fixes. Prevent bridge status toggling if a single request fails. Don't evaluate xml if http response if != 200 Signed-off-by: matchews <mmyers75@icloud.com>
This commit is contained in:
parent
f8f0d8972b
commit
089ee3227a
@ -101,7 +101,6 @@ public class HaywardBridgeHandler extends BaseBridgeHandler {
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
updateStatus(ThingStatus.UNKNOWN);
|
||||
initializeFuture = scheduler.schedule(this::scheduledInitialize, 1, TimeUnit.SECONDS);
|
||||
return;
|
||||
}
|
||||
@ -143,7 +142,10 @@ public class HaywardBridgeHandler extends BaseBridgeHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
if (this.thing.getStatus() != ThingStatus.ONLINE) {
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
}
|
||||
|
||||
logger.debug("Succesfully opened connection to Hayward's server: {} Username:{}", config.endpointUrl,
|
||||
config.username);
|
||||
|
||||
@ -350,6 +352,7 @@ public class HaywardBridgeHandler extends BaseBridgeHandler {
|
||||
commFailureCount++;
|
||||
return;
|
||||
}
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
} catch (HaywardException e) {
|
||||
logger.debug("Hayward Connection thing: Exception during poll: {}", e.getMessage());
|
||||
} catch (InterruptedException e) {
|
||||
@ -424,15 +427,15 @@ public class HaywardBridgeHandler extends BaseBridgeHandler {
|
||||
int status = httpResponse.getStatus();
|
||||
String xmlResponse = httpResponse.getContentAsString();
|
||||
|
||||
List<String> statusMessages = evaluateXPath("/Response/Parameters//Parameter[@name='StatusMessage']/text()",
|
||||
xmlResponse);
|
||||
if (!(statusMessages.isEmpty())) {
|
||||
statusMessage = statusMessages.get(0);
|
||||
} else {
|
||||
statusMessage = httpResponse.getReason();
|
||||
}
|
||||
|
||||
if (status == 200) {
|
||||
List<String> statusMessages = evaluateXPath(
|
||||
"/Response/Parameters//Parameter[@name='StatusMessage']/text()", xmlResponse);
|
||||
if (!(statusMessages.isEmpty())) {
|
||||
statusMessage = statusMessages.get(0);
|
||||
} else {
|
||||
statusMessage = httpResponse.getReason();
|
||||
}
|
||||
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Hayward Connection thing: {} Hayward http command: {}", getCallingMethod(),
|
||||
urlParameters);
|
||||
@ -444,7 +447,8 @@ public class HaywardBridgeHandler extends BaseBridgeHandler {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Hayward Connection thing: {} Hayward http command: {}", getCallingMethod(),
|
||||
urlParameters);
|
||||
logger.debug("Hayward Connection thing: {} Hayward http response: {}", getCallingMethod(), status);
|
||||
logger.debug("Hayward Connection thing: {} Hayward http response: {} {}", getCallingMethod(),
|
||||
status, xmlResponse);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
<parameter name="endpointUrl" type="text" required="true">
|
||||
<context>url</context>
|
||||
<label>Endpoint URL</label>
|
||||
<default>https://app1.haywardomnilogic.com/HAAPI/HomeAutomation/API.ashx</default>
|
||||
<default>https://www.haywardomnilogic.com/HAAPI/HomeAutomation/API.ashx</default>
|
||||
<description>The URL of the Hayward API Server</description>
|
||||
</parameter>
|
||||
<parameter name="username" type="text" required="true">
|
||||
|
Loading…
Reference in New Issue
Block a user