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

[nikohomecontrol] Check bridge status when thing ready to go online. #8428

Merged
merged 2 commits into from
Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public void initialize() {
// We need to do this in a separate thread because we may have to wait for the communication to become active
scheduler.submit(() -> {
if (!nhcComm.communicationActive()) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE,
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
"Niko Home Control: no connection with Niko Home Control, could not initialize action "
+ actionId);
return;
Expand All @@ -221,6 +221,13 @@ public void initialize() {
actionEvent(nhcAction.getState());

logger.debug("Niko Home Control: action initialized {}", actionId);

Bridge bridge = getBridge();
if ((bridge != null) && (bridge.getStatus() == ThingStatus.ONLINE)) {
updateStatus(ThingStatus.ONLINE);
} else {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE);
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ public void initialize() {

updateStatus(ThingStatus.ONLINE);
logger.debug("Niko Home Control: energy meter intialized {}", energyMeterId);

Bridge bridge = getBridge();
if ((bridge != null) && (bridge.getStatus() == ThingStatus.ONLINE)) {
updateStatus(ThingStatus.ONLINE);
} else {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE);
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ public void initialize() {
nhcThermostat.getOverrule(), nhcThermostat.getDemand());

logger.debug("Niko Home Control: thermostat intialized {}", thermostatId);

Bridge bridge = getBridge();
if ((bridge != null) && (bridge.getStatus() == ThingStatus.ONLINE)) {
updateStatus(ThingStatus.ONLINE);
} else {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE);
}
});
}

Expand Down