Skip to content

Commit

Permalink
[netatmo] Fix getActiveChildren (openhab#12830)
Browse files Browse the repository at this point in the history
Wait for the thing being initialized properly by the thing manager
before considering it as an active children

Fix openhab#12809

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
  • Loading branch information
lolodomo authored and andrasU committed Nov 12, 2022
1 parent b79225f commit a0a94c2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@ default Optional<CommonInterface> getHomeHandler() {
default List<CommonInterface> getActiveChildren() {
Thing thing = getThing();
if (thing instanceof Bridge) {
return ((Bridge) thing).getThings().stream().filter(Thing::isEnabled).map(Thing::getHandler)
.filter(Objects::nonNull).map(CommonInterface.class::cast).collect(Collectors.toList());
return ((Bridge) thing).getThings().stream().filter(Thing::isEnabled)
.filter(th -> th.getStatusInfo().getStatusDetail() != ThingStatusDetail.BRIDGE_OFFLINE)
.map(Thing::getHandler).filter(Objects::nonNull).map(CommonInterface.class::cast)
.collect(Collectors.toList());
}
return List.of();
}
Expand Down

0 comments on commit a0a94c2

Please sign in to comment.