DeeeeLAN / homebridge-sleepiq

SleepIQ Homebridge plugin
18 stars 10 forks source link

If adjusting foundation, wait until complete before adjusting additional foundation control #20

Closed mmahler closed 3 years ago

mmahler commented 4 years ago

Hey there, first off I want to say thank you for putting this out there. I think if an API call goes out before the previous action completes, my base does not complete the first action. For example, I set a scene in home kit to move the head and foot of my base to 0%. The head starts to move a little, then the foot lowers completely. If my scene controls only one element the action completes as expected. I can experiment a little, and if I flip the dimmer of the head from 0 to 100%, and while it is moving I try to control the foot, it stops movement on the head and instead controls the foot. I think there is some lock on the API side that the bed can only be doing one thing at a time.

DeeeeLAN commented 4 years ago

Yeah this one is hard for me to test because I don’t have a power base. Assuming what you want to do is possible through the app, it is theoretically possible for me to do too. The issue is HomeKit only sends one command at a time so it might be tricky to bundle multiple HomeKit commands into a single API call.

But yes it would maybe be easier to check if the base is already moving and if it is, wait on a second command until the first completes.

mmahler commented 4 years ago

Hrm. Good question. Let me test a few things and get back to you, I think in the app you can have presets like "watch tv" and "flat" which control both. Let me set up a miim proxy and see what the app is actually doing in those cases.

mmahler commented 4 years ago

Looks like what the app does is check the foundation status for "isMoving" and just loops querying that delayed by a second before firing the command. Let me see if I can whip up a change.

DeeeeLAN commented 4 years ago

Does the preset move both things at once or does it move them sequentially?

mmahler commented 4 years ago

Sequentially

On May 13, 2020, at 3:18 PM, DeeeeLAN notifications@github.com wrote:

 Does the preset move both things at once or does it move them sequentially?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

DeeeeLAN commented 4 years ago

Okay, that should be simple enough to replicate then. If you get it working file a pull request. You have the base for testing so that will make things a lot easier for me.

DeeeeLAN commented 3 years ago

if you can actually just send me a debug log, it might include the data I need and I can get the delay added. I just need to see the data structure where isMoving is located, so I can pull it accurately.

DeeeeLAN commented 3 years ago

I added an attempt in a separate branch, delayFlex (db961e7). If anybody tries it out, I would love to know the results.