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

[openweathermap] Bridge status set to ONLINE when no attached things #11360

Merged
merged 1 commit into from
Oct 11, 2021
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import static org.openhab.binding.openweathermap.internal.OpenWeatherMapBindingConstants.*;

import java.util.List;
import java.util.Set;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -151,21 +152,29 @@ public void childHandlerDisposed(ThingHandler childHandler, Thing childThing) {
}

private void determineBridgeStatus() {
ThingStatus status = ThingStatus.OFFLINE;
for (Thing thing : getThing().getThings()) {
if (ThingStatus.ONLINE.equals(thing.getStatus())) {
status = ThingStatus.ONLINE;
break;
ThingStatus status = ThingStatus.ONLINE;
List<Thing> childs = getThing().getThings();
if (!childs.isEmpty()) {
status = ThingStatus.OFFLINE;
for (Thing thing : childs) {
if (ThingStatus.ONLINE.equals(thing.getStatus())) {
status = ThingStatus.ONLINE;
break;
}
}
}
updateStatus(status);
}

private void updateThings() {
ThingStatus status = ThingStatus.OFFLINE;
for (Thing thing : getThing().getThings()) {
if (ThingStatus.ONLINE.equals(updateThing((AbstractOpenWeatherMapHandler) thing.getHandler(), thing))) {
status = ThingStatus.ONLINE;
ThingStatus status = ThingStatus.ONLINE;
List<Thing> childs = getThing().getThings();
if (!childs.isEmpty()) {
status = ThingStatus.OFFLINE;
for (Thing thing : childs) {
if (ThingStatus.ONLINE.equals(updateThing((AbstractOpenWeatherMapHandler) thing.getHandler(), thing))) {
status = ThingStatus.ONLINE;
}
}
}
updateStatus(status);
Expand Down