Skip to content

Add skill to disable/enable listening for wake word#286

Merged
Stypox merged 3 commits intoStypox:masterfrom
celskeggs:cskeggs-patch-1
Jun 29, 2025
Merged

Add skill to disable/enable listening for wake word#286
Stypox merged 3 commits intoStypox:masterfrom
celskeggs:cskeggs-patch-1

Conversation

@celskeggs
Copy link
Contributor

Hello!

This pull request contains a simple skill to enable and disable wake word detection. The use case is that sometimes I may be at a location where it would be very problematic to have my phone's microphone activated, and it would make me feel more comfortable if I could easily disable Dicio's wake word detection feature.

I want to be able to easily say, "Hey Dicio, stop listening," and then have it no longer listen for the wake word until I go into the app and explicitly re-enable it. That could either be in the settings page or by manually triggering Dicio and saying "Start listening." This is what I've implemented. I also included some other aliases, such as "mute microphone" and "unmute microphone." (I also included "on mute microphone" as an alias for "unmute microphone" because the Speech-to-Text algorithm interprets my accent that way.)

Some quick background: I'm interested in building some complex voice assistant skills that aren't available on commercially available assistants. Dicio looks like a good platform to use for this, but since I only started learning Android development and Kotlin three hours ago, I figured I'd try some building some simpler skills first.

I would like to contribute back this skill and potentially any other skills I make, but I'm not sure whether they would be useful to a wider audience. If not, I'm happy to keep them in my own fork.

I'm not totally happy with how I implemented this skill, particularly the SettingsAccess proxy, so if you have any feedback on the code and/or design, I would be very interested in hearing it.

Thank you for your time!

@celskeggs
Copy link
Contributor Author

Rebased against latest version and cleaned up.

Copy link
Owner

@Stypox Stypox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this can be quite useful!

The value in the settings is used to set which wakeword engine to use (although now there is only OpenWakeWord), and might be on even if there is no wakeword service running (e.g. if the model has not been downloaded yet, or if the user STOPped it before).

So I would prefer if this was implemented by just sending an intent to start/stop the service. The STOP button in the notification already sends the stop intent, so you can look at that. When Dicio is reopened from scratch, the service will start again automatically.

Even if you were to implement a settings-based approach in the end, I would avoid having too many abstractions and just pass DataStore directly to skills.

Comment on lines +3 to +4
- mute
- mute microphone
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can compress these with "mute microphone?"

Comment on lines +9 to +12
- unmute
- on mute
- unmute microphone
- on mute microphone
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And these with "unmute|(on mute) microphone?"

<string name="skill_listening_started_listening">Okay, I\'ll listen for the wake word</string>
<string name="skill_listening_not_listening">I wasn\'t listening</string>
<string name="skill_listening_stop_listening">Okay</string>
<string name="skill_name_listening">Control listening</string>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<string name="skill_name_listening">Control listening</string>
<string name="skill_name_listening">Control wake word listening</string>

@celskeggs
Copy link
Contributor Author

Thanks! I will make these changes. Note that there was a reason I didn't pass the DataStore<UserSettings> directly to skills: I would have had to move UserSettings to the skill/ module, which seems even worse than moving InteractionLog.

@Stypox
Copy link
Owner

Stypox commented Mar 1, 2025

Thanks! I will make these changes. Note that there was a reason I didn't pass the DataStore directly to skills: I would have had to move UserSettings to the skill/ module, which seems even worse than moving InteractionLog.

That's true. One alternative would be to add @Singleton on the ListeningInfo class, making it injectable by Hilt, and add a DataStore<UserSettings> parameter in the constructor of ListeningInfo. Then you could add a listeningInfo: ListeningInfo parameter to the constructor of SkillHandler which will be injected automatically. This way the ListeningInfo would get hold of DataStore<UserSettings> and could use it to build ListeningSkill.

@celskeggs celskeggs requested a review from Stypox April 4, 2025 21:31
@celskeggs
Copy link
Contributor Author

I believe I have made the requested changes!

Copy link
Owner

@Stypox Stypox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool, thank you! I made a few additional small changes which I pushed directly to master as I did not have permission to push here

@Stypox Stypox merged commit 92fba42 into Stypox:master Jun 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants