-
-
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
[keba] Robustness improvements on communication error #10399
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
70da552
Merge pull request #1 from openhab/main
MikeTheTux 4703aad
do not send binding offline on (temporary) communication errors
MikeTheTux 618efc4
Robustness improvements on communication error
MikeTheTux f7c251a
Robustness improvements on communication error
MikeTheTux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually believe that this is the issue. The handler is unregistered here, but never registered again afterwards.
Have you tried adding
at the top of the else branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I did. In this case the runnable seems to be executed to early. It throws the following exception during startup:
In the solution provided by this PR, the Handler is never unregistered. Thereby it is also not required to register it again, once the connection is re-established.
Only drawback of the current solution: Thing status is not set to offline on communication errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As already mentioned: This is not really acceptable and we need to find a solution for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the PR with a proper solution.
It changes the state to OFFLINE and back to ONLINE, when the communication is re-established.
My comment #10399 (comment) was crap. The error was caused by the JsonParser update openhab/openhab-core#2244 done on TRUNK while I tested the solution using OH3.0.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the solution again :-|
The used UDP communication is not 100% reliable. Even in a switched network, some of the report polling requests do not receive a response. In order to avoid the sporadic OFFLINE/ONLINE events, I introduced
isKebaReachable()
in the polling runnable again. This function checks the presence of the TCP port (reliable). Only if the TCP port cannot be reached, the Binding goes OFFLINE. It tries to go ONLINE again in the next polling round. In order to change back to ONLINEisKebaReachable()
must be successful AND data via UDP must be received.On UDP timeouts, only a debug message is logged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds sensible to me.