-
-
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
[gree] Use GCM encryption when bind fails #17398
Conversation
Change the encryption mode to GCM if different when binding to AC device fails with SocketTimeoutException and try again. Detect if device version is bigger than or equal to 2 and set encryption to GCM Fixes openhab#16911 Signed-off-by: Zhivka Dimova <[email protected]>
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.
Some minor typo's.
Would be nice if @markus7017 can comment on the functionality.
...org.openhab.binding.gree/src/main/java/org/openhab/binding/gree/internal/GreeCryptoUtil.java
Outdated
Show resolved
Hide resolved
...org.openhab.binding.gree/src/main/java/org/openhab/binding/gree/internal/GreeCryptoUtil.java
Outdated
Show resolved
Hide resolved
...org.openhab.binding.gree/src/main/java/org/openhab/binding/gree/internal/GreeCryptoUtil.java
Outdated
Show resolved
Hide resolved
...nhab.binding.gree/src/main/java/org/openhab/binding/gree/internal/handler/GreeAirDevice.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Zhivka Dimova <[email protected]>
@lsiepel Thank you for noticing my typo's I didn't pay so much attention to the debug messages, because I was thinking that may be there are a bit too much, but I wanted to keep them for testing purposes until some of the people reporting the problem test the change |
Would be nice if @markus7017 can comment |
Remove the use of version property of scan response for specifying the encryption method Signed-off-by: Zhivka Dimova <[email protected]>
For old Gree device there is an exception thrown, which is strange since it fails before your code change.
|
I see you are also an author that implemented GreeCryptoUtil. Seems there have to be something strange with DTO mapping. The response for scan package I had received from Gree device was:
The only |
I see same problem is for new gree device:
|
@gliter Please confirm this issue is introduced by this PR by using a 4.3.0M1 (or snapshot) version of the binding and see if that has the same issue or not. Otherwise it would be a regression or atleast a new unrelated bug, that should be recorded in a seperate issue (and PR) Edit: I can't related this PR with the version exception. |
@gliter @lsiepel |
@lovery thank you for quick explanation. Yes I will test it in the evening (UTC+2 timezones). |
@lovery unfortunetly it doesn't seem to work. It does discover the device and there are no more logs (on trace or higher level)
so I guess it still hangs on Maybe instead of fallback to GCM the encryption type could be an option to be set in |
Move code that changes the encType for binding with device to a broader catch statement Signed-off-by: Zhivka Dimova <[email protected]>
@gliter Thank you for your help, I really appreciate it! Can you try again, I've uploaded a new version of the jar file? |
@lovery initially had some issues but it turned out the device was disabled in my OpenHab UI, even thou I configure everythng in files. Feel free to incorporate it in your PR: Probably some documentation have to be updated as well. With those changes I was able to connect to new Gree device. |
Add option to change the enctription type used for communicating with the AC device by the user Signed-off-by: Zhivka Dimova <[email protected]>
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.
Left some textual suggestions.
....openhab.binding.gree/src/main/java/org/openhab/binding/gree/internal/GreeConfiguration.java
Outdated
Show resolved
Hide resolved
...nhab.binding.gree/src/main/java/org/openhab/binding/gree/internal/handler/GreeAirDevice.java
Outdated
Show resolved
Hide resolved
...enhab.binding.gree/src/main/java/org/openhab/binding/gree/internal/GreeBindingConstants.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Zhivka Dimova <[email protected]>
Signed-off-by: Zhivka Dimova <[email protected]>
Signed-off-by: Zhivka Dimova <[email protected]>
@lsiepel yeah, my suggestions were incorporates so we can config encryption directly in config. I have approved PR. |
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, LGTM
* [gree]: use GCM encryption when binding fails Signed-off-by: Zhivka Dimova <[email protected]>
* [gree]: use GCM encryption when binding fails Signed-off-by: Zhivka Dimova <[email protected]>
Change the encryption mode to GCM if different when binding to AC device fails with SocketTimeoutException and try again. Detect if device version is bigger than or equal to 2 and set encryption to GCM
Fixes #16911
Additional info:
There are gree devices that on scan request responds with package encrypted with ECB encryption using the old key, but expects GCM encryption bind request in response. Such behavior is described in #16911
Also in openhab community forum a few people are saying that they have the same problem.
Not sure which approach is better to change the encryption mode to GCM when SocketTimeoutException was catched and try again or try to determine is the AC expects GCM encryption bind request base on the value of
ver
property of the scan response, so I am leaving them both and I am open to suggestion.Testing
Builded jar file can be found here.