Skip to content
This repository has been archived by the owner on Sep 21, 2023. It is now read-only.

Commit

Permalink
hold button down for 1 second to trigger Assistant
Browse files Browse the repository at this point in the history
  • Loading branch information
xtools-at committed Jun 14, 2017
1 parent c1aaf53 commit 86b1fcd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/alexapi/triggers/platformtrigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ def run(self):
def platform_callback(self, platform_continuous_callback=None):
if self._enabled:
self._platform_continuous_callback = platform_continuous_callback
self._trigger_callback(self, "")
# self._trigger_callback(self, "")

if self._platform_continuous_callback and self.long_press_setup:
# if self._platform_continuous_callback and self.long_press_setup:
if self.long_press_setup:
long_press_thread = threading.Thread(target=self.long_press)
long_press_thread.daemon = True
long_press_thread.start()
Expand Down Expand Up @@ -81,12 +82,16 @@ def long_press(self):
if isinstance(assistant_phrase, list):
assistant_phrase = assistant_phrase[0]
self._trigger_callback(self, assistant_phrase)
else
else:
logger.info("Error: Phrase Assistant was None")
###
break

time.sleep(.1)
###
if (time.time() - start_time < self._tconfig['long_press']['duration']):
self._trigger_callback(self, "")
###

def enable(self):
self._enabled = True
Expand Down
4 changes: 2 additions & 2 deletions src/config.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ triggers:
voice_confirm: false

# one of: oneshot-vad, continuous, continuous-vad
event_type: "oneshot-vad"
event_type: "continuous-vad"

# only for "continuous" event_types
long_press:
Expand All @@ -77,7 +77,7 @@ triggers:
command: "" # deprecated, long-press launches Assistant now

# duration in seconds
duration: 2
duration: 1

# CURRENTLY DISABLED
# optional audio file to play before executing the command
Expand Down

0 comments on commit 86b1fcd

Please sign in to comment.