-
Notifications
You must be signed in to change notification settings - Fork 583
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
Issue with Multiple BLE Lamp Instances Creating Delays When Linked with Tuya Gateway #1323
Comments
This has been solved in the fork mentioned in #1581, pending pull request. |
@make-all good news! I'm really looking forward to the PR and then I can test it with my devices. I have quite a few BLE devices - 23. Only if I understand correctly PR will have a number of major changes. In that case, I would perhaps appreciate you reviewing and commenting on it first. Then we can move on to the testing phase. |
@mariustt, in my case, I have several thermostats behind one hub. I haven't try control them in one group, thus not sure whether any improvement in the delay can happen. However, I can describe what has been changed to help better understand what may cause the delay you observed, whether my change may help some improvement, or what further changes may needed to improve the delay. Firstly, how the device status update, e.g. turn on light, is implemented in tuya-local internally. @make-all, please correct me if my description below is not correct. Secondly, what has changed in my fork. However, this still means, depending on the current implementation of |
@grayyang Thank you for your very detailed reply! Considering that the logic itself has remained the same: one device -> one team, there might not be much change in the delay. However, your observation about TCP overuse is very good. In practice, as far as I've come across, opening a connection takes some time. If I understood correctly from the information you gave, the same TCP connection will be used to transfer information between all devices. As a consequence, we should save time in setting up the connection. In addition, it is not yet clear how the gateway interprets a single parent device. Perhaps at its level the requests will be aggregated and sent to the end-devices, because as far as the tuya API is concerned, the API itself does not have access to the BLE devices, which means that the gateway has to do this job. In any case, I look forward to the PR and I am eager to contribute to the testing. If the delay problem is not solved, then at least I will be able to get rid of 2 unnecessary gateways out of the 3 that I would use to control 9 lights. |
@mariustt |
My equipment set includes:
I tried about 10 different gateways and they all only supported max 3 devices. The only one I could find that supports more than three devices is the Moes Wired Multi-mode Gateway. However, I have a problem with it which is described in this issue. |
@mariustt Thank you. Yes, I can also only add 3 devices (lights). And when the tracks are on, do you see the BLE devices on your phone, for example through the nRF Connect app? |
@almirus I have not tried the nRF Connect app. To tell you the truth, I have never heard of it. However, I reach all devices directly via BLE (without a gateway) via tuya or the smart life app. |
Just chiming in: Tuya has an excellent websockets based LAN control API for gateways: https://developer.tuya.com/en/docs/connect-subdevices-to-gateways/quick-start?id=Kd0g2gbi56ott @make-all would you like me to take a stab at implementing this sort of protocol? I'm not a python dev (I work with Scala mainly), but I can give it a try. |
It seems like unnecessary bloat to add a completely different protocol to this integration. It would probably be better as a separate integration. |
@zalatnaicsongor a very interesting solution, which in principle can be implemented simply through homeassistant RESTful. The only problem with this is that you can't completely abandon the cloud? Because if you want to get an access token you have to make a request to a cloud endpoint which has to be accessible from the cloud? |
It surely can be, but it'd be to share device definitions and other parts like home assistant integration between the two components. It's just merely adding a new transport, it doesn't really change the underlying logical protocol (data points, mappings, etc.) @mariustt you are right, the usefullness of this depends on the lifetime of the access token. I'll investigate further. |
@zalatnaicsongor if you decide to explore this issue further and perhaps even create a separate lib, please share. I think this should open up full support for all datapoints via BLE, as my understanding is that this would be a kind of local tuya cloud. :) |
Would this issue also relate to the "invalid key" errors with the BLE solar lights despite them having the correct key for the hub and being semi controllable when they're willing to respond which is like 50% of the time as mentioned in the previous issue raised? The issue does appear to be between the connection between tuya and the integration as the app still controls them well or is it something else? |
Description:
When using a Tuya gateway to connect BLE lamps as sub-devices in Home Assistant, each lamp is added as a separate instance. This creates a noticeable delay when a single switch is used to turn on multiple lamps simultaneously. However, this issue is not present when operating the lamps directly through the Tuya app.
Steps to reproduce the behavior:
Expected behavior:
The expected behavior is to have all BLE lamps turn on simultaneously without delay when operated through Home Assistant, similar to their behavior when controlled via the Tuya app.
Additional context
The delay is not present when operating the lamps directly through the Tuya app, suggesting the issue lies in the communication between the Tuya gateway and Home Assistant when handling multiple instances. A possible solution could be to allow the addition of all sub-device IDs upon device pairing, enabling them to be added as a single instance in Home Assistant.
Linked discussion: Tuya Local Discussion
Screenshots
The text was updated successfully, but these errors were encountered: