ASR start Listening at button press and stop listening at button release

Hello snips…

First of all, thanks for the snips developers, very impressive :smile:

I am experimenting with raspberry pi3, My intension is to use a button for my project instead of wakeword. I can only be able to actiavte wakeword at button press, but i want snips ASR to listen when i press the button and when i release it ASR should stop listening. Can you please let me know how can i do that.

 def button_press():
            publish.single("hermes/hotword/default/detected", payload =json.dumps({"siteId":"default", "modelId":"hey_snips", "modelVersion":" ","modelType":"universal","currentSensitivity":0.5}, hostname="localhost", port=1883)
            publish.single("hermes/asr/startListening", payload =json.dumps({"siteId":"default"}, hostname="localhost", port=1883)
def button_release():
            publish.single("hermes/asr/stoptListening", payload =json.dumps({"siteId":"default"}, hostname="localhost", port=1883)

if __name__ == "__main__":
        mqtt =mqtt.Client()
        mqtt.on_connect = on_connect
        mqtt.on_message = on_message

        button.when_pressed = button_press
        button.when_released = button_release


there is no stop… the asr will stop when it hears no more being said

I don’t know what you try to accomplish exactly.

If you try to start a dialog via a push-button, looking at my project my help.

In my bootcontrol project ( I deactivated the hotword detection completely.

Instead I use exclusively the button to start a dialog-session.