bwp91 / homebridge-govee

Homebridge plugin to integrate Govee devices into HomeKit.
MIT License
470 stars 48 forks source link

New API timing doesn't work with fast applications #46

Closed radiocolin closed 3 years ago

radiocolin commented 3 years ago

What issue do you have? Please be as thorough and explicit as possible.

The new 7.5 second timing results in some events not firing if a scene is turned on and then off quickly.

For example, I have two lightstrips in a closet which turn on as part of a scene when the door opens. I will often close the door before the second light has turned on, and then the turn off events won't fire correctly and the lights remain on.

I wasn't having this issue prior to the timing change in the most recent version.

Details of your setup.

Homebridge + configui

1.3.0 beta 53

Raspi 4 Node.js Version v14.15.4 NPM version v6.14.10

2.9.0

Yes

Three H6141 light strips.

Please paste any relevant logs below.

[07/02/2021, 19:46:07] [deCONz] Wardrobe Right Door: set homekit contact from 1 to 0
[07/02/2021, 19:46:07] [Govee] [Wardrobe Right Top] current state [off].
[07/02/2021, 19:46:14] [Govee] [Wardrobe Right Bottom] current state [off].
[07/02/2021, 20:04:19] [deCONz] Wardrobe Right Door: set homekit contact from 0 to 1
[07/02/2021, 20:04:20] [Govee] [Wardrobe Right Top] current state [on].
[07/02/2021, 20:04:27] [Govee] [Wardrobe Right Bottom] current state [on].
[07/02/2021, 20:04:38] [Govee] [Wardrobe Right Top] current CCT via adaptive lighting [5376K].
[07/02/2021, 20:04:40] [deCONz] Wardrobe Right Door: set homekit contact from 1 to 0
[07/02/2021, 20:04:45] [Govee] [Wardrobe Right Bottom] current CCT via adaptive lighting [5376K].
[07/02/2021, 20:04:53] [Govee] [Wardrobe Right Top] current state [off].
[07/02/2021, 20:05:00] [Govee] [Wardrobe Right Bottom] current state [off].

In the above logs, the door is opened, and the lights are waiting to come on. By time they come on, the door has closed. When the door is opened again, the lights turn off.

bwp91 commented 3 years ago

Hi @radiocolin

I appreciate the 7.5 second delay between requests seems a very long time, but many users were finding that updates in quick succession were sometimes being ignored by Govee even though the response from their server was a success. I have been testing multiple updates in quick succession with my own lights (through scenes) and I found anything less than this 7.5 value was not always reliable. This API is a pain in the ass to work with!

Moving forward...

If you are happy to install the latest beta of the plugin I have just pushed (v2.10.0-0), I have added a new config option to change this 7500ms delay (you'll find it in the Optional Settings part of the plugin settings screen). Note that the value has a minimum of 500 and is in milliseconds.

This gives you the flexibility to reduce it down to a number that would work for you with your automation, but, I can't guarantee that the lights will always behave if the updates are sent in quick succession.

Hope this helps!

radiocolin commented 3 years ago

That will do nicely, can you tell me what the old value was? That seemed to work well for me.

bwp91 commented 3 years ago

Before was a slightly different method,

If you found it worked well before then you could try the minimum value of 500ms and see how you get on .

bwp91 commented 3 years ago

Just released v2.10.0 which, in some ways, reverts the changes I made in v2.9.0.

The default value for the new controlInterval setting is now 500ms, of course with the option of increasing it if anyone experiences connectivity issues.

Trying to make this plugin work well for everyone one way or another!

github-actions[bot] commented 3 years ago

This issue has been marked as complete as I believe the original query has been fixed/answered or will not be actioned. The issue will be closed in three days. If you feel the issue requires further attention then please let me know. Thanks!

no-response[bot] commented 3 years ago

This issue has been automatically closed as it was marked as complete and has had no further responses within three days. If you are still experiencing problems related to the original issue then please reply to this message and the issue will be reopened if necessary. Thank you.