NestGen2.Gesture (nest_gen2 v0.6.6)

Copy Markdown View Source

Clicks, double clicks and long presses, from the button's raw :down and :up events. Subscribe to :gesture to receive:

{:nest_gen2, :gesture, :click}
{:nest_gen2, :gesture, :double_click}
{:nest_gen2, :gesture, :long_press}

Timings (config, in ms):

  • button_double_click_ms (default 300): a second press starting within this long of the first release makes a double click. A single click is only known once this window has passed, so :click arrives that much after the release. Set it to nil for no double clicks and an immediate :click. Measured on a real Nest, a natural double click leaves 98 to 229 ms (mean 142) between the release and the second press, so 300 ms catches the slow ones while keeping a single click's delay short.
  • button_long_press_ms (default 800): held this long, :long_press is sent while the button is still down, and its release sends nothing more. Keep it well under 10 s: holding the display that long restarts the Nest. Ordinary presses measured 120 to 291 ms.

:button keeps sending :down and :up as they happen, for anything that must respond at once.

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(_)