-
Notifications
You must be signed in to change notification settings - Fork 191
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
Group control #514
Comments
Not easily. You basically have to pre-open persistent connections to every device in the group and then send the commands as needed. If no data is received in ~29 seconds the devices close the connection, so a keep-alive/heartbeat must be implemented as well. The quick-n-dirty way of doing this uses a thread for each device, though I personally don't like doing that and instead use non-blocking sockets and dump them all into select() with a timeout. |
Thanks @uzlonewolf. My usecase. I use 5 RGB LED bulbs in my darkroom app (https://github.com/measwel/darkroom). I switch these off, before I switch on the enlarger (via smart outlet). They go out one by one and sometimes not all are off when the enlarger switches on. It would be useful to: (1) switch them all off in one go. As to (1) could you perhaps show some example code? |
Unfortunately I don't have any simple code to demonstrate it, the best I got is the "multiserver" I was working on https://github.com/uzlonewolf/tinytuya/blob/socket-server/multiserver/multiserver.py#L777 . It still has some rough edges such as lag when it's attempting to (re-)connect devices, but it otherwise works. As long as the connections are persistent the devices should send async status updates whenever their state changes, so it shouldn't be too hard to just track the last state received. |
Hi, I’m experiencing the same issue using Tuya Local, which is based on TinyTuya. When trying to turn off 14 lights simultaneously, I see a similar result as the one shown make-all/tuya-local#1323 (comment). Any advice or solutions for this problem would be absolutely amazing! |
Hi,
Would it be possible to control a group of devices like with the smartlife app? The app controls the devices in a group practically simultanously. When I try the same with tinytuya, I need to send commands to each device separately and I get a delay for each device. Sorry if the question has been asked before.
The text was updated successfully, but these errors were encountered: