Skip to content
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

[epsonprojector] Fix ONLINE status reporting #10266

Merged
merged 2 commits into from
Mar 2, 2021

Conversation

mlobstein
Copy link
Contributor

Fix issue with the Epson projector binding reporting the thing status as ONLINE even when no valid responses were being received. When connecting the binding to a serial port that generated any response, the thing would show as being ONLINE. The fix checks for valid responses and will only switch the thing to ONLINE when a valid response is received.

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
Comment on lines 162 to 164
if (state != UnDefType.UNDEF && getThing().getStatus() != ThingStatus.ONLINE) {
updateStatus(ThingStatus.ONLINE);
}
Copy link
Contributor

@cpmeister cpmeister Mar 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally I think the thing should go online prior to any status updates, but that might just be a preference since I'm not aware of any documentation dictating that it must be done that way.

Another thing worth mentioning is that you don't need to check the existing thing status before updating it since that will automatically be checked by the updateStatus implementation.

Suggested change
if (state != UnDefType.UNDEF && getThing().getStatus() != ThingStatus.ONLINE) {
updateStatus(ThingStatus.ONLINE);
}
if (state != UnDefType.UNDEF) {
updateStatus(ThingStatus.ONLINE);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Thanks!

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
@cpmeister cpmeister merged commit 51ddbdb into openhab:main Mar 2, 2021
@cpmeister cpmeister added this to the 3.1 milestone Mar 2, 2021
@cpmeister cpmeister added the bug An unexpected problem or unintended behavior of an add-on label Mar 2, 2021
@mlobstein mlobstein deleted the Epson_thingstatusfix branch March 2, 2021 22:49
themillhousegroup pushed a commit to themillhousegroup/openhab2-addons that referenced this pull request May 10, 2021
* Epsonprojector - Fix ONLINE status reporting
* review changes

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
Signed-off-by: John Marshall <john.marshall.au@gmail.com>
computergeek1507 pushed a commit to computergeek1507/openhab-addons that referenced this pull request Jul 13, 2021
* Epsonprojector - Fix ONLINE status reporting
* review changes

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
thinkingstone pushed a commit to thinkingstone/openhab-addons that referenced this pull request Nov 7, 2021
* Epsonprojector - Fix ONLINE status reporting
* review changes

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
marcfischerboschio pushed a commit to bosch-io/openhab-addons that referenced this pull request May 5, 2022
* Epsonprojector - Fix ONLINE status reporting
* review changes

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants