vroy / python-sengled-client

A simple Python client to control Sengled [light] accessories.
MIT License
23 stars 4 forks source link

Faster delivery of commands #3

Closed ColbyJack1134 closed 4 years ago

ColbyJack1134 commented 4 years ago

This python library so far is really great and I've been able to get so much more use out of my lights than when I first bought them

One thing I've been trying to do though is smoothly transition between two colors by sending commands to increase the rgb values by a small number until it gets to the right color. One problem I've noticed with this is that it takes anywhere from 0.5 seconds to like 0.8 seconds to send a command to the bulbs and wait for a response which creates a huge bottleneck in the time it takes to change from one color to another without being too choppy. I know this might be a problem with the bulbs themselves but I was wondering if you know of any way to speed up the delivery of multiple commands like maybe by queueing up a bunch of commands in one packet rather than sending a new packet each time.

I've already tried threading the command to send a request so that I didn't have to wait for a response but this just caused the commands to be sent out of order.

vroy commented 4 years ago

Hi @GuyMan1020,

I'm really glad to hear that you found this library useful, thanks!

Unfortunately the requests that we send are HTTP requests toSengled servers in the cloud. These requests cannot include multiple queued commands (as far as I know) and so this client cannot support multiple queued commands. I believe the problem is really on the server side and the delay is the time it takes for the request to be handled on the Sengled servers and send a command back down to your lights. When you send multiple commands in parallel or very fast, what likely happens is that different servers may be able to process the requests faster than others, and so the requests are sent back down to your bulbs out of order.

I hope that makes sense. I'm sorry I don't have an answer for you.

ColbyJack1134 commented 4 years ago

Thanks for the response @vroy,

I figured the problem was probably due to the way the bulbs were built but I thought it was worth a shot asking. I might just try and buy a zigbee stick to directly communicate with the bulbs then, but thank you again for the library!