[sensibo] Fix initialization for half-included devices - #20169
Conversation
Signed-off-by: Arne Seime <arne.seime@gmail.com>
0ad3a98 to
8be3d93
Compare
|
|
||
| public Map<String, ModeCapabilityDTO> getRemoteCapabilities() { | ||
| return remoteCapabilities.modes; | ||
| return remoteCapabilities != null ? remoteCapabilities.modes : null; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
remoteCapabilitiesfield inPodDetailsDTO.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.
|
Gentle ping @seime could you look at the open comments? |
|
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. |
Signed-off-by: Arne Seime <arne.seime@gmail.com>
* Fix openhab#18018 Signed-off-by: Arne Seime <arne.seime@gmail.com>
* Fix openhab#18018 Signed-off-by: Arne Seime <arne.seime@gmail.com>
* Fix openhab#18018 Signed-off-by: Arne Seime <arne.seime@gmail.com>
* Fix openhab#18018 Signed-off-by: Arne Seime <arne.seime@gmail.com> Signed-off-by: olemr <olemr@olemr.com>
* Fix openhab#18018 Signed-off-by: Arne Seime <arne.seime@gmail.com> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
Fix #18018
Improve testcase.