[netatmo] Fix getActiveChildren (#12830)

Wait for the thing being initialized properly by the thing manager
before considering it as an active children

Fix #12809

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
lolodomo 2022-05-27 19:47:13 +02:00 committed by GitHub
parent d83a036e1a
commit 1aeaccfe04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -126,8 +126,10 @@ public interface CommonInterface {
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();
}