-
-
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
[ipcamera] Add Reolink API support #14728
Conversation
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
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.
Thanks for the enhancements. Only a few minor comments from my side.
The hardcoded JSON/URL approach seems quite error-prone, but I understand this is the current approach in this binding. However, it would be worth to consider refactoring this when doing more work on this binding.
...ng.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/handler/IpCameraHandler.java
Outdated
Show resolved
Hide resolved
...ng.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/handler/IpCameraHandler.java
Outdated
Show resolved
Hide resolved
...ding.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/onvif/OnvifConnection.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
…/binding/ipcamera/internal/handler/IpCameraHandler.java Co-authored-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com>
@jlaur Thank you for your suggestions which should be all addressed now.... I do not understand your hard coding comment above, perhaps because I am self taught and still learning basic coding concepts. The URL's are defined in an API and the binding is implementing the API as documented. If you could elaborate on what the potential issue is or the better way? Do you mean using constants to define the urls in the one place/file, in case the API changes in the future to reduce the workload changing many lines of code? |
...hab.binding.ipcamera/src/main/java/org/openhab/binding/ipcamera/internal/ReolinkHandler.java
Show resolved
Hide resolved
What I'm referring to is code like this: ipCameraHandler.sendHttpPOST("/api.cgi?cmd=AudioAlarmPlay" + ipCameraHandler.reolinkAuth,
"[{\"cmd\": \"AudioAlarmPlay\", \"param\": {\"alarm_mode\": \"manul\", \"manual_switch\": 1, \"channel\": "
+ ipCameraHandler.cameraConfig.getNvrChannel() + " }}]"); While it will probably work perfectly well, it's hard to read, and for the same reason trivial bugs (like syntax errors) could easily be introduced unnoticed. If this JSON would be serialized from a DTO, it would be easier to read and the risk of syntax errors would be eliminated. |
Signed-off-by: Matthew Skinner <matt@pcmus.com>
Thank you for the suggestions and I believe I have completed all requested changes. Regarding your non requested suggestion of DTO, I did a quick look and do not wish to go that route, but someone in future can do it. Considering that I do not own one of these brands to do any testing with, I do not have the time when this basic method is going to suit 99% of people just fine and most of it is already tested by end users. There are at least 2 users of Reolink cameras that can code in Java that are waiting for this to be merged so they can take over and move it forward so it is possible someone will make that change that is able to do tests on real hardware. |
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.
LGTM
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/ipcamera-binding-cant-connect-to-d-link-dcs-8627lh/145438/9 |
Signed-off-by: Matthew Skinner <matt@pcmus.com> Signed-off-by: Thomas Burri <thomas.burri@alstomgroup.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com> Signed-off-by: Matt Myers <mmyers75@icloud.com>
Signed-off-by: Matthew Skinner <matt@pcmus.com> Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
These changes add Reolink support which a lot of users have requested and been testing and giving feedback already in the forum here:
https://community.openhab.org/t/adding-reolink-api-to-the-ipcamera-binding-beta-testers-needed/142202
This pull request will automatically be built and available under the following links if anyone wants to test:
https://openhab.jfrog.io/ui/native/libs-pullrequest-local/org/openhab/addons/bundles/
https://openhab.jfrog.io/ui/native/libs-pullrequest-local/org/openhab/addons/bundles/org.openhab.binding.ipcamera/4.0.0-SNAPSHOT/org.openhab.binding.ipcamera-4.0.0-SNAPSHOT.jar
Signed-off-by: Matthew Skinner matt@pcmus.com