Skip to content

Commit

Permalink
[openweathermap] Bridge status set to UNKNOWN when no attached things
Browse files Browse the repository at this point in the history
Fix #11191

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
  • Loading branch information
lolodomo committed Oct 9, 2021
1 parent 6fab062 commit 38271f2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ public void childHandlerDisposed(ThingHandler childHandler, Thing childThing) {
}

private void determineBridgeStatus() {
if (getThing().getThings().size() == 0) {
updateStatus(ThingStatus.UNKNOWN, ThingStatusDetail.NONE, "@text/unknown.waiting-for-things-setup");
return;
}
ThingStatus status = ThingStatus.OFFLINE;
for (Thing thing : getThing().getThings()) {
if (ThingStatus.ONLINE.equals(thing.getStatus())) {
Expand All @@ -162,6 +166,10 @@ private void determineBridgeStatus() {
}

private void updateThings() {
if (getThing().getThings().size() == 0) {
updateStatus(ThingStatus.UNKNOWN, ThingStatusDetail.NONE, "@text/unknown.waiting-for-things-setup");
return;
}
ThingStatus status = ThingStatus.OFFLINE;
for (Thing thing : getThing().getThings()) {
if (ThingStatus.ONLINE.equals(updateThing((AbstractOpenWeatherMapHandler) thing.getHandler(), thing))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ offline.conf-error-not-supported-onecall-number-of-hours = The 'forecastHours' p
offline.conf-error-not-supported-onecall-number-of-days = The 'forecastDays' parameter must be between 0 and 7.
offline.conf-error-not-supported-onecall-number-of-alerts = The 'numberOfAlerts' parameter must be greater than or equals to 0.

unknown.waiting-for-things-setup = Waiting for setup of at least one thing.

# discovery result
discovery.openweathermap.weather-and-forecast.api.local.label = Local Weather And Forecast
discovery.openweathermap.air-pollution.api.local.label = Local Air Pollution
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ offline.conf-error-not-supported-onecall-number-of-hours = Der Parameter 'foreca
offline.conf-error-not-supported-onecall-number-of-days = Der Parameter 'forecastDays' muss zwischen 0 und 7 liegen.
offline.conf-error-not-supported-onecall-number-of-alerts = Der Parameter 'numberOfAlerts' muss größer oder gleich 0 sein.

unknown.waiting-for-things-setup = Warten auf Einrichtung von mindestens einer Sache.

# discovery result
discovery.openweathermap.weather-and-forecast.api.local.label = Lokales Wetter und Wettervorhersage
discovery.openweathermap.air-pollution.api.local.label = Lokale Luftqualität
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ offline.conf-error-not-supported-onecall-number-of-minutes = Le paramètre 'fore
offline.conf-error-not-supported-onecall-number-of-hours = Le paramètre 'forecastHours' doit être compris entre 0 et 48.
offline.conf-error-not-supported-onecall-number-of-days = Le paramètre 'forecastDays' doit être compris entre 0 et 7.

unknown.waiting-for-things-setup = En attente de la configuration d''au moins une "thing".

# discovery result
discovery.openweathermap.weather-and-forecast.api.local.label = Météo locale et prévisions
discovery.openweathermap.uvindex.api.local.label = Indice UV local

0 comments on commit 38271f2

Please sign in to comment.