-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[netatmo] Bridge status out of sync #16518
Comments
I did a very primitive test, but did not manage yet to reproduce this from the suggestions above. In private final LocalTime startTime = LocalTime.now();
private boolean bugReproduced = false; In beginning of if (LocalTime.now().isAfter(startTime.plusMinutes(2)) && !bugReproduced) {
bugReproduced = true;
startAuthorizationFlow();
prepareReconnection(null, null);
throw new NetatmoException("Not authenticated");
} This simulated a single occurrence of a communication problem in Line 184 in 51b63f3
So I currently don't have a theory on how one weather station came back online while the account bridge stayed offline. |
I missed that private final LocalTime startTime = LocalTime.now();
private int bugReproducedCounter = 0; and in the first lines of private boolean authenticate(@Nullable String code, @Nullable String redirectUri) {
if (LocalTime.now().isAfter(startTime.plusMinutes(2)) && bugReproducedCounter < 2) {
bugReproducedCounter++;
startAuthorizationFlow();
return false;
} This time I was able to reproduce it. I will run another test with a fix and provide a draft PR for that. It will take some time to verify because reconnection is scheduled to 15 minutes and openHAB restarts are needed because of undisposed jobs, so probably I won't have final results until tomorrow. |
Fixes openhab#16518 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This part I'm leaving for another issue, and it might not even be in this repository. I was quite puzzled about how it ended up being logged like this:
At first glance I would have expected this to have resulted in So actually it is throwing throw new OAuthException("Bad http response, http code " + statusCode); This is then caught, wrapped and rethrown just below: } catch (Exception e) {
// Dont know what exception it is, wrap it up and throw it out
throw new OAuthException(
"Exception in oauth communication, grant type " + grantType + ": " + e.getMessage(), e);
} It is still |
With the very small provided fix in the linked PR, the binding is now able to recover after multiple OAuth failures, i.e. the bridge will come back online and allow other child weather stations to come back online as well. There are several other problems to look into as well. Especially I'm experiencing problems with jobs not being disposed and |
Fixes #16518 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Fixes #16518 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Fixes openhab#16518 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
Fixes openhab#16518 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Two weather stations went offline:
Because of service unavailability (HTTP code 503):
The status for both weather stations is correct, but the description is debatable (service unavailability probably shouldn't result in configuration error).
After that follows the same - either HTTP status 500 or 503. I noticed also:
Then suddenly:
Event log:
Shortly later the external modules came online as well:
The problem with the last two series of status updates is that one of the weather stations went offline while the API bridge was still offline:
This is inconsistent. And also, the other weather station never came online until I later restarted the binding.
Expected Behavior
When a weather station is online, its parent bridge should also be online.
Current Behavior
A weather station thing came be online and working without the bridge being online, and while another hierarchy remains offline altogether:
Possible Solution
Account bridge must have been marked offline here:
openhab-addons/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/ApiBridgeHandler.java
Lines 234 to 235 in 51b63f3
and most likely triggered from
executeUri
:openhab-addons/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/ApiBridgeHandler.java
Lines 309 to 312 in 51b63f3
In this case, will it ever come back online if the next call succeeds?
openhab-addons/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/ApiBridgeHandler.java
Lines 342 to 344 in 51b63f3
Perhaps what is missing is:
As a consequence, maybe the other weather station is kept offline:
openhab-addons/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/CommonInterface.java
Lines 221 to 222 in 51b63f3
Steps to Reproduce
Context
This is part of general stability issues since OH 4.1. See also #16485.
Your Environment
The text was updated successfully, but these errors were encountered: