- if changer_thread is None or not changer_thread.is_alive():
- if changer_thread is None:
- logger.info("watchdog: Starting up the current page changer thread...")
- else:
- logger.warning(
- "watchdog: The current page changer thread seems to have died; restarting it and hoping for the best."
+ with logging_utils.LoggingContext(logger, prefix="watchdog:"):
+ while True:
+ if hotword_thread is None or not hotword_thread.is_alive():
+ if hotword_thread is None:
+ logger.info("Starting up the hotword detector thread...")
+ else:
+ logger.warning(
+ "The hotword detector thread seems to have died; restarting it and hoping for the best."
+ )
+ keyword_paths = [pvporcupine.KEYWORD_PATHS[x] for x in ["bumblebee"]]
+
+ # Sensitivity is the parameter that enables trading
+ # miss rate for the false alarm rate. It is a floating
+ # point number within [0, 1]. A higher sensitivity
+ # reduces the miss rate at the cost of increased false
+ # alarm rate.
+ sensitivities = [0.4] * len(keyword_paths)
+ listener = listen.HotwordListener(
+ command_queue,
+ keyword_paths,
+ sensitivities,