ebaauw / homebridge-hue

Homebridge plugin for Philips Hue
Apache License 2.0
901 stars 91 forks source link

Add artificially delay before turning off a scene switch #1170

Closed maxileith closed 1 year ago

maxileith commented 1 year ago

Issue

When using the scene switches as a trigger for automations, the automations are not triggered reliably. I have observed this issue now quiet some time and it looks like the automations are triggered correctly when the scene switch is turned on like for >2 seconds. However, most of the time the scene switches are turned off almost immediately. I would like to see a configuration option to add an artificially delay for the scene switch to turn off.

Log Messages

Debug Files

ebaauw commented 1 year ago

The time to wait before resetting the “switch” is already configurable through resetTimeout. Default is 500ms, it can be set between 10 and 2000ms. Looks like this setting is missing from the UI Settings form and from the Wiki page, but you should be able to add it manually to config.json.

Note that recalling a scene is write-only, very much like Identify. Unfortunately, I haven’t been able to find a way to make a HomeKit app display a push button, hence the trick to display it as self-resetting switch. I use a similar trick for Brightness Change. These self-resetting characteristics are really meant to be write-only, and probably shouldn’t be used as triggers for HomeKit automations. Depending on your use case, best use a HomeKit scene, combining the automation actions and the switch for the Zigbee scene, or create a CLIPGenericFlag sensor and expose that as dummy switch to base your automation on.

maxileith commented 1 year ago

Thank you for the quick response. I was not aware of the resetTimeout in the configuration. The hint was the solution for me. Write-only is no problem for my use-case since I trigger the zigbee scenes always with the switches anyway. So there is no need to detect when I change scenes from another source, e.g. the Hue app because I don't use any other service to control the light.