Stypox / dicio-android

Dicio assistant app for Android
GNU General Public License v3.0
807 stars 72 forks source link

Feature request: Tasker plugin #40

Open Shura0 opened 2 years ago

Shura0 commented 2 years ago

It would be great to have a tasker plugin that can recognise text and pass it to tasker variable. With such thing lot of people will be able to write tasker scripts with offline voice recognition without needs of Dicio recompilation.

Tasker: https://tasker.joaoapps.com Yes, it's not opensource or even free, but it's quite popular utility for android automation.

Stypox commented 2 years ago

This could be implemented as a fallback skill that the user can choose to use. So if they chose Tasker as the fallback skill, when no "normal" skill matches the user input, the input is passed to Tasker. It should be pretty straightforward to do, though I never used Tasker, nor similar apps. If someone else wants to implement support for Tasker though, I would accept it

mister-monster commented 2 years ago

https://github.com/renyuneyun/Easer

There's a FOSS task scheduler app similar to tasker that's in active development and pretty mature.

Shura0 commented 2 years ago

@Stypox No, it should work from other side. Tasker calls Dicio plugin, dicio recognizes user voice and then returns recognized text back to tasker. No actions needed.

Stypox commented 2 years ago

Mmmh, Dicio does not currently aim to be a speech to text service usable by other apps, though I see this could come in handy. Maybe there are even some Google STT intents that can be overridden so that any app with the microphone button using Google STT, would use Dicio (i.e. Vosk) instead (when Google STT is not available, obviously)

sudomain commented 2 years ago

I don't use Tasker but it was requested that I add my thoughts about 3rd party automation-related app integration in #45.

Termux is a terminal emulator for Android that has packages for Python, openjdk, and other languages. It also has a version of am for sending intents to other apps and Tasker plugin for running scripts in the Termux environment. For Dicio to interact with Termux (thus also Tasker?) It could send a RUN_COMMAND intent to Termux,.

There are other automation related apps that I use which send and receive intents to do different things such as modify device settings:

KeyMapper - trigger keymaps from other apps

Easer - I can't find good docs for this app, but it has a Recieve Broadcast event condition in which users can specify received actions and categories. It can then be used to trigger what Easer calls "profiles" which are sets of actions such as toggling WiFi/Bluetooth, starting services of other apps, and sending other broadcasts.

dp0s commented 2 years ago

I would appreciate a tasker plugin definitely. Tasker could then be used to handle the trigger, call Dicio to obtain a voice command and evaluate the output itself. Other similar apps like Automate and Macrodroid are also capable of using tasker plugins.

On the other hand, these mentioned apps are all non-free. So staying with the FOSS idea, using intents/broadcasts is probably the better way. It's not as comfortable as a Tasker plugin, but it allows direct interfacing with Termux and other FOSS apps.

thebiblelover7 commented 2 years ago

Integrating Easer would be great, as right now it does not have many features and connecting it to Easer would allow for that.

nebkrid commented 1 year ago

Mmmh, Dicio does not currently aim to be a speech to text service usable by other apps, though I see this could come in handy. Maybe there are even some Google STT intents that can be overridden so that any app with the microphone button using Google STT, would use Dicio (i.e. Vosk) instead (when Google STT is not available, obviously)

Hi, yes there is a STT intent which can be used for this purpose (and then should also be able somehow be useable by tasker using these intents). I actually found your app when searching for exactly such an app: An offline STT which just provide the STT functionality to other apps. I couldn't find one yet, but experimented a bit with intents using your app. The intent structure itself is not complicated (just calling an ActivityForResult with "RecognizerIntent.ACTION_RECOGNIZE_SPEECH"), and I now got it working with your app. I would like to contribute this, but although I am already Android programming since some time for myself, it would be the first time to publish something. Therefore, before I confuse someone or violate any code of conduct: Can I just commit these files using Android Studio or what do I have to do? Maybe you can hint me to an explanation page?

Stypox commented 1 year ago

@nebkrid Yes, you can just commit the files and create a Pull Request. Thank you for sharing!

nebkrid commented 1 year ago

When trying this I get an error: grafik The setting of branches is like this: grafik

I already tried to fork the project (in case I cannot directly put the pull request to your project), but I didn't figured out how to change this in android studio to my fork... Sorry for this beginner questions...

Stypox commented 1 year ago

If you have access to a terminal I think you can just do this:

git remote set-url origin https://github.com/nebkrid/dicio-android.git

Otherwise in Android Studio I think you can do it from Git -> Manage remotes, and replace the Stypox in the url to the right of origin with nebkrid

nebkrid commented 1 year ago

Thanks, Git -> Manage remotes worked. :) I tried to understand and follow the skill-structure. However I had to made one main decision in main activity, as a different app don't provide any "capture sentences" (and especially is not interested in the skills which are provided by dicio) but just need to get the complete spoken text. Maybe there is a more elegant way to handle this than the new "SimpleForwardRecognizer", but I didn't figured out how exactly your word capturing worked to get the complete text, and therefore this was the most easy way to go in order to get it working for the first time.