-
Notifications
You must be signed in to change notification settings - Fork 26
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
[tuya] Add support for gateway and sub devices #497
Conversation
dec3266
to
69062a8
Compare
@J-N-K, will you have time to take a look? |
I hope I'll find time at the weekend. |
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 again and sorry for letting you wait.
I have some general questions:
- Why do we need the
TuyaDeviceManager
? - As far as I can see the
TuyaGatewayHandler
does nothing, except distributing the device status messages to the child handlers and passing the disconnected messages. Is that really needed or could we integrate that in theTuyaDevice
and thing handler itself?
* @author Vitalii Herhel - Initial contribution | ||
*/ | ||
@Component(service = SchemaRegistry.class, configurationPid = "tuya.schemaService") | ||
public class SchemaRegistry { |
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.
What is the benefit over using the Storage
directly?
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.
This change is not mandatory. It's an attempt to extract a clear interface for schema storage. Before that, we operated on storage directly and serialised/deserialised objects while interacting with it. Now, we see what type of objects can be stored here and we don't need to bridge Gson object along with the Storage.
Thanks for the review! |
@J-N-K Please, review my answers |
Thanks, I'll try to have a look this weekend. |
Sorry again for letting you wait so long for a good review. I have thought a lot about the design and there are several things that can't (or shouldn't) be done the way it is implemented now. One thing is that Instead of the bridge/thing design I would like to propose a different approach that also solves the issue with the multiple connections. We create a service called
The manager checks if the already have a The gateway id is the same as the device id for ordinary devices, and the id of the gateway for sub devices. It can be set during discovery (as a new config parameter). If it is not set, it is considered to be the same as the device id, that makes it backward compatible. The This should all be possible with about 2050 lines of code. The only addition needed then is in WDYT? |
@J-N-K Thanks for the deep review. From your answer, I see two concerns:
|
Any updates here? |
Hi, has this been solved in any way? |
@edsonaj It's fully functional in this branch, I have used it for several months |
@presidentio but your branch is for 3.2, right? not 4.0 |
I have a branch for 4.x https://github.com/presidentio/addons/tree/4.0.x-tuya-gateway-support, but didn't create a PR as this one doesn't have progress |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Any update on that feature? What is missing for the merge? |
I would also like to ask if this has been addressed. This binding is great, but I really miss subdevices support. |
I'd also like support for this :) |
This PR resolves #483 and #493
First of all, @J-N-K thank you for a great binding. It works well, and UX is great. Everything is discovered automatically.
Most of my Tuya things are ZigBee based and communicate through the gateway. In this PR I added support for them
End-user changes:
I had to refactor/extract code from existing classes to avoid code duplication. I tried to do not change the existing logic.
I've tested it with read-only devices: water leak sensor, motion sensor, door/window opening sensor
Please, let me know if you have any concerns or suggestions, and I will try to resolve them