Skip to content

[sensibo] Fix initialization for half-included devices - #20169

Merged
lsiepel merged 3 commits into
openhab:mainfrom
seime:sensibo_partial_setup
May 18, 2026
Merged

[sensibo] Fix initialization for half-included devices#20169
lsiepel merged 3 commits into
openhab:mainfrom
seime:sensibo_partial_setup

Conversation

@seime

@seime seime commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

Fix #18018

Improve testcase.

Signed-off-by: Arne Seime <arne.seime@gmail.com>

public Map<String, ModeCapabilityDTO> getRemoteCapabilities() {
return remoteCapabilities.modes;
return remoteCapabilities != null ? remoteCapabilities.modes : null;

@lsiepel lsiepel Feb 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To prevent null issues, you could choose to add @nullable annotations or return an empty list. You might need to check how the logic handles those cases.

@lsiepel lsiepel added the bug An unexpected problem or unintended behavior of an add-on label Feb 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes a NullPointerException that occurs when Sensibo devices are only partially set up or disconnected, which lack the remoteCapabilities field in the API response. The fix adds a null-safety check in the DTO getter method and improves test coverage to prevent this regression in the future.

Changes:

  • Added null-safety check for remoteCapabilities field in PodDetailsDTO.getRemoteCapabilities()
  • Enhanced test suite with better async handling using Awaitility library
  • Added comprehensive test data representing devices without remoteCapabilities (partially configured/disconnected devices)

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
bundles/org.openhab.binding.sensibo/src/main/java/org/openhab/binding/sensibo/internal/dto/poddetails/PodDetailsDTO.java Added null check to prevent NPE when remoteCapabilities is absent from API response
bundles/org.openhab.binding.sensibo/src/test/java/org/openhab/binding/sensibo/internal/handler/SensiboAccountHandlerTest.java Improved test implementation using Awaitility for async operations, removed unused test parameter, and added test case for issue #18018
bundles/org.openhab.binding.sensibo/src/test/resources/get_pods_response_partial_setup.json Added realistic test data with 4 devices including one without remoteCapabilities field to reproduce the bug scenario
bundles/org.openhab.binding.sensibo/src/test/resources/logback-test.xml Added test logging configuration for debugging test execution
bundles/org.openhab.binding.sensibo/pom.xml Added test dependencies for logback-classic and awaitility to support improved test implementation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lsiepel

lsiepel commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Gentle ping @seime could you look at the open comments?

@lsiepel lsiepel added the awaiting feedback Awaiting feedback from the pull request author label Apr 28, 2026
@lsiepel

lsiepel commented May 16, 2026

Copy link
Copy Markdown
Contributor

Gentle ping @seime we have about 4-5 weeks left before code freeze for the next stable release. Would be nice to have this added before.

seime added 2 commits May 17, 2026 22:24
Signed-off-by: Arne Seime <arne.seime@gmail.com>

@lsiepel lsiepel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks LGTM

@lsiepel
lsiepel merged commit 1dc6319 into openhab:main May 18, 2026
1 of 2 checks passed
@lsiepel lsiepel removed the awaiting feedback Awaiting feedback from the pull request author label May 18, 2026
@lsiepel lsiepel added this to the 5.2 milestone May 18, 2026
markus7017 pushed a commit to markus7017/openhab-addons that referenced this pull request May 19, 2026
markus7017 pushed a commit to markus7017/openhab-addons that referenced this pull request Jun 13, 2026
darkscout pushed a commit to darkscout/openhab-addons that referenced this pull request Jul 5, 2026
olemr pushed a commit to olemr/openhab2-addons that referenced this pull request Aug 8, 2026
* Fix openhab#18018

Signed-off-by: Arne Seime <arne.seime@gmail.com>
Signed-off-by: olemr <olemr@olemr.com>
cipianpascu pushed a commit to cipianpascu/openhab-addons that referenced this pull request Aug 16, 2026
* Fix openhab#18018

Signed-off-by: Arne Seime <arne.seime@gmail.com>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
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.

[sensibo] Since upgrading to OpenHab 4.3, sensibo API thing no longer works

3 participants