VoxCommando

VoxNastics (User Guides and Mods) => Tips and Tricks => Topic started by: rebelmaveric19 on May 06, 2014, 01:43:46 AM

Title: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: rebelmaveric19 on May 06, 2014, 01:43:46 AM
My version of getting tasker on android in conjuction with autovoice and autoremote to use as a speaker and mic for VC. I am not very good at writing tutorials and probably not really good at making video tutorials......I hopw you all can make something of this......

https://www.youtube.com/watch?v=cNvryvgGeEI&feature=youtu.be

Some thoughts after using it a few days:
1. Sometimes dosent seem like I get a response back......trying to figure out why
2. VC webserver has no kind of authentication (if using outside of lan it is a problem).............maybe james can help or tell me some simple way to provide authentication
3. My brain is going a million mph thinking of possibilities and cant sleep
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: jitterjames on May 06, 2014, 08:45:42 AM
This video has been removed because it is too long.  :(
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: rebelmaveric19 on May 06, 2014, 08:50:49 AM
Had to verify my account.? Why didn't it ask BEFORE I uploaded the video. Don't understand some of google's way.......... video works now.
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: jitterjames on May 06, 2014, 10:45:57 AM
It works for me now.

Title: Re:
Post by: rebelmaveric19 on May 06, 2014, 07:02:46 PM
Does that video make any sense to y'all. I know you (james and nime5ter) probably understand it already.
Title: Re:
Post by: keithj69 on May 06, 2014, 08:00:08 PM
Does that video make any sense to y'all. I know you probably understand it already.

As an extremely new user to vc, I thank you for the video.  It answered 1) can i use tasker with vc somehow?  2)  can i do it remotely with tasker? 3) what can i do with eventghost? (lack of looking on my part). 4) can autovoice/vc understand one if they have a dip in?  :biglaugh
 
as a side comment, you could always set up to icon to turn on autovoice and one to tun it off.  I usually have autovoice on at night to send commands to my vera, just in case.

In all seriousness, thanks for the video.
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: rebelmaveric19 on May 06, 2014, 10:26:54 PM
Thank you keith for the nice words....

By the way I do have a quick tile shortcut for av continuous and I do the same thing at night, have a profile at night called alarm clock and turns on av continuous so I can tell it to shut up in the morning.
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: jitterjames on May 06, 2014, 11:07:29 PM
Hey looks very promising.  I've been up to my ears in code yesterday and today so I have not been able to watch the entire video from end to end but I did jump through most of it and it looks interesting.

I'm trying to figure out if there is a way to get the second "alternate" from autovoice.  I notice that a lot of the time the recognition fails because it is using Google's recognition which does not know what the correct phrases are, so for example, when you say "Jarvis no" it just makes a wild guess that you said "Jarvis know" which VC would never do.  This is why VoxWav and VoxCommando generally work a lot better, but since you are trying to do this remotely I can see that it is worth trying to make it work an alternate way.  It may be possible to send VoxCommando multiple recognition phrases and it will go through them until it finds a valid phrase.  Most likely Google is returning both "Jarvis know" and "Jarvis no" as possible phrases, but guessing wrong about which one is the most likely match. I am going to try to take a look at autovoice to see if there is another variable that can be used.  I notice that avcomm is the "first match" or something which would imply that there are more possible matches.  Do you know if these are available to Tasker as variables?

When I first started making VoxWav I created an app called VoxCommandroid which used the Google recognition engine.  It employed this technique of sending multiple matches to VoxCommando.  I ultimately did not continue development though because I was not impressed by the poor results I was getting compared to a microphone with the VC engine so I switched to steaming audio which was much more difficult to code but ultimately yielded the results I was looking for.

For now your setup looks like a good choice for anyone that wants to talk to VC from a remote location, but it would be nice if we could increase the accuracy a bit.
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: rebelmaveric19 on May 07, 2014, 12:15:00 AM
I am going to try to take a look at autovoice to see if there is another variable that can be used.  I notice that avcomm is the "first match" or something which would imply that there are more possible matches.  Do you know if these are available to Tasker as variables?
Yes it is %avcomms()

Also is there anyway to setup some sort of authentication on the webserver? Or should I worry about it?
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: jitterjames on May 07, 2014, 12:39:36 AM
There is no way to do this in VC at the moment.  I don't know if you should worry or not...  I guess it depends on what kind of commands you have in place but you probably have reasonable security through obscurity at the moment.

I don't know if there is some other way to secure this.  I guess you could set up a vpn or something but I don't know much about that stuff.
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: jitterjames on May 07, 2014, 12:58:21 AM
I have it working but after I send the http get to VC from tasker I get an error:

java.io.EOFException

Do you also get that error?  Is there a way to turn off the error popups, or better yet do you know how to fix it?  I can't find anything online about this error for tasker http get actions.
Title: Re:
Post by: rebelmaveric19 on May 07, 2014, 07:35:25 AM
Yea just turn on "continue task after error" in the http get command and it quits popping up that error.
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: jitterjames on May 07, 2014, 09:31:27 AM
Thanks.  I was not seeing that option until I turned off beginner mode.

Here is my task which sends multiple phrases to VC. It still isn't perfect, but you are more likely to get a hit.

EDIT added 21-11-2015 (nime5ter):
For an official VC tutorial on using Tasker w/ VC, please see: http://voxcommando.com/mediawiki/index.php?title=Using_Tasker_with_VoxCommando
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: rebelmaveric19 on May 07, 2014, 11:08:27 AM
I think that error popups because VC simple server has no info on it. Somebody that knows java might be able to help more.....
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: PointCloud on May 07, 2014, 05:48:44 PM
Thanks for the video demo of this.  I like how you explained it can be used over the internet to gain controlled function and not just lan.   I also see a lot of potential with Tasker and Vox working together to make practical and useful tools.  I am going to sub to your channel if you decide to document more of your progress.  It is very useful information. 

cheers!
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: rebelmaveric19 on May 07, 2014, 07:20:22 PM
James that works alot better than only single command sent.
@pointcloud... I am going to make a tutorial later about using some of the capabilities of pstools in VC
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: mdsh on May 11, 2014, 03:36:58 AM
 :clap thank you so much for sharing this with us rebelmaveric19 ! It is really impressive and it hurts my brain trying to figure this all out but a really good demo\tutorial non the less. Im sure Ill get there one day.  ;D

Keep up the good work and please do keep us posted with some more awesome vids!
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: IKROWNI on September 08, 2014, 05:34:30 PM
Got everything up and working great so far except 1 issue I'm running into is that set volume for the pc volume doesn't seem to work. Is anyone else ha ING this issue or is this just a problem on my side?
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: nime5ter on September 08, 2014, 05:42:25 PM
What does "doesn't seem to work" mean.

Can you see whether VC receives the message? (i.e., what do you see in VC's history panel, if anything).
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: IKROWNI on September 09, 2014, 03:46:48 AM
well i guess my problem fixed itself. I had to do a restart on my pc and fter doing so i went to check the logs to see what vox was getting for a message when i would send the command. Voila working great now with no issues.Thanks OP for the great tutorial.
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: rebelmaveric19 on September 20, 2014, 10:07:20 AM
I have a Samsung gear live watch now and got commands for voxcommando working through google now. Would y'all like a tutorial on that.
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: nime5ter on September 20, 2014, 10:54:51 AM
If you have the time, sure. We all prefer posts that help us figure out how to do things! ;)
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: squatingyeti on November 06, 2014, 04:21:53 PM
Excellent work! I was just busy messing around with tasker, autoremote, autovoice, and yatse on a tablet to get things I wanted done. Then I said, yeti, cause I talk to myself in fake name 3rd person, there's got to be a way to do this all as well as going touchless and not needing my phone at all times. The voice commands brought me by VoxCommando and a quick search for tasker + VoxCommando brought me here. This very topic pushed me to go forward with purchasing. Great job on figuring out tasker integration and I can't say enough to James for VoxCommando.

PS, If anyone questions you about me, only provide blurry photos and wobbly video. Keeps the mystique up.
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: squatingyeti on November 09, 2014, 02:46:19 PM
Ok, I'm actually not able to get this working correctly. I've triple checked the settings and everything appears correct. When I use autovoice to send my payload to VoxCommando, I can see each time it does that Vox shows: Accepted new client! IP: xxx.xxx.x.x Port: xxxxx However, it never runs the command or even seems to receive the payload. Any ideas? The port is forwarded to the correct computer through my router and I have the TCP server plugin running. Running VoxCommando SP 2.1.0.3. I also noticed that when it says "Accepted new client" the port number is always different and not the designated port. I've tried using the task james posted and only editing my IP for the one listed as well as building the task with just the first command the way rebelmaveric19 did using just the first recognized command, avcomm()

Any help is greatly appreciated.
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: nime5ter on November 09, 2014, 04:19:41 PM
Have you tested that the VC web server is working for you on its own?

Can you enter the URL for a command in a web browser to trigger a command?

e.g. http://[yourip]:[yourVCwebserverport]/api/VC.TellVox&&Show Help

Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: rebelmaveric19 on November 09, 2014, 04:23:30 PM
Tell me how you have your tasker task setup. List out each line in a reply and edit your IP addresses. Also I would use avcomms() because when you speak a phrase in autovoice it may have multiple matches and with android.phrases in VC it will pick the correct one for you.
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: squatingyeti on November 09, 2014, 05:08:20 PM
Have you tested that the VC web server is working for you on its own?

Can you enter the URL for a command in a web browser to trigger a command?

e.g. http://[yourip]:[yourVCwebserverport]/api/VC.TellVox&&Show Help



Yes, if I go to my laptop and run that command everything functions. It even sends the voice response to my phone. Works if I use chrome from my phone as well. Must be something wrong in my Tasker task.

Rebelmaveric19, I'm currently using James' send task he posted earlier, but I've tried using the one you had in the video as well. Here it is:

Profile
Send Jarvis
-AutoVoice Recognized Event
Behaviour: true
Command: "jarvis"

Task
Autovoice2VC2

1. Variable Set
    - Name %vcmsg To %avcomms()

2. Variable Search Replace
    - Variable %vcmsg Search ,

3. HTTP Get
    - Server:Port http://myIP:myPort/api/android.phrases&&%vcmsg        (the // were missing before edit, but they were there in the task and I took out the [] to avoid confusion)



EDIT:
Just did some more testing and changed the HTTP Get in the task to http://myIP:myPort/api/VC.TellVox&&Show%20Help
That worked just fine. I have no idea why it's not working the other way with autovoice sending my commands :(
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: nime5ter on November 09, 2014, 06:01:59 PM
With the caveat that I have no idea what I'm talking about here because I don't use autovoice, in looking at the autovoice2VC2.tsk xml that James posted, I'm seeing one thing in his xml that I don't see in your description above.

His second action (which, possibly, is the Search Replace action?) shows a string of "&&" as the 7th argument. I don't know if that means that a comma is being replaced by &&, or what. Just thought I'd throw it out there. As I say, I have no idea what I'm talking about -- it's just an observation.

From his xml, the second action is:
Code: [Select]
<Action sr="act1" ve="5">
<code>598</code>
<Str sr="arg0" ve="3">%vcmsg</Str>
<Str sr="arg1" ve="3">,</Str>
<Int sr="arg2" val="1"/>
<Int sr="arg3" val="1"/>
<Int sr="arg4" val="0"/>
<Str sr="arg5" ve="3"/>
<Int sr="arg6" val="1"/>
<Str sr="arg7" ve="3">&amp;&amp;</Str>
</Action>
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: squatingyeti on November 09, 2014, 06:19:55 PM
With the caveat that I have no idea what I'm talking about here because I don't use autovoice, in looking at the autovoice2VC2.tsk xml that James posted, I'm seeing one thing in his xml that I don't see in your description above.

His second action (which, possibly, is the Search Replace action?) shows a string of "&&" as the 7th argument. I don't know if that means that a comma is being replaced by &&, or what. Just thought I'd throw it out there. As I say, I have no idea what I'm talking about -- it's just an observation.

From his xml, the second action is:
Code: [Select]
<Action sr="act1" ve="5">
<code>598</code>
<Str sr="arg0" ve="3">%vcmsg</Str>
<Str sr="arg1" ve="3">,</Str>
<Int sr="arg2" val="1"/>
<Int sr="arg3" val="1"/>
<Int sr="arg4" val="0"/>
<Str sr="arg5" ve="3"/>
<Int sr="arg6" val="1"/>
<Str sr="arg7" ve="3">&amp;&amp;</Str>
</Action>

Yeah, I believe that is where he's replacing commas in the second action of the task.

I tried removing both of the first two steps and changing the third to: http://myIP:myPort/api/VC.TellVox&&%arcomm (%arcomm is the first recognized result from autovoice when you speak) so if I say, jarvis show help, %arcomm would be show help if autovoice recognized that as what I most likely said. Now I know for sure that show help is what %arcomm is because I added some debug testing into my task.

If I change the task to just be http://myIP:my port/api/VC.TellVox&&Show%20help and then play the task without using autovoice, it works just fine. I'm absolutely baffled as to why it's not working when I insert the autovoice parameter %avcomm or when I use James' task. Brain pain lol
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: rebelmaveric19 on November 09, 2014, 06:29:33 PM
Yes you are correct....auto voice uses CSV values and it is replacing them with ampersands. You did check continue task after error under the http get task? You have to have beginner mode turned off to see it. Also you can use autonotification to make VC put custom notifications on your phone also. Helpful if you don't want your phone to talk but notify you instead.
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: squatingyeti on November 09, 2014, 06:51:24 PM
Yes you are correct....auto voice uses CSV values and it is replacing them with ampersands. You did check continue task after error under the http get task? You have to have beginner mode turned off to see it. Also you can use autonotification to make VC put custom notifications on your phone also. Helpful if you don't want your phone to talk but notify you instead.

Yep, checked continue after error :/ I'm just at a loss here.
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: nime5ter on November 09, 2014, 06:59:23 PM
@rebel -- What version of VC are you currently using?

@yeti -- It's not clear whether this is an issue, but the TCP plugin has been updated in recent versions. Since it seems as though you're able to send messages from Tasker to VC fine, up until you add autovoice to the mix, it's hard to imagine how this could be a TCP plugin problem, but it may be that.

If someone out there is currently using rebel's autovoice method with 2.103 or later, can you please verify that it's working for you?
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: nime5ter on November 09, 2014, 07:23:46 PM
OK, I think the problem may simply be spaces between words.

First, try creating a one-word command in VC, and then test whether you're able to send a one-word command using James's method (android.phrases ...)

If that works, you'll want to replace spaces in your autovoice command with %20 -- the same way as James replaces the comma with &&.
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: squatingyeti on November 09, 2014, 10:17:23 PM
OK, I think the problem may simply be spaces between words.

First, try creating a one-word command in VC, and then test whether you're able to send a one-word command using James's method (android.phrases ...)

If that works, you'll want to replace spaces in your autovoice command with %20 -- the same way as James replaces the comma with &&.

Uggghhh...that could possibly be it, but in my attempts to fix this problem I'm not sure what's going on now. I'm using the same task from James that I was using earlier and getting the "Accepted new client" event, but now it's not even getting that. I created a one word command called test, but I get nothing when I send it to VC now. I even tried using show help and I don't see any "accepted new client" event anymore. Frustrating because nothing has changed. I can still get to the system by doing http://myIP:myPort/api/VC.TellVox&&test or any other command. There may be an issue with the spaces, but I'm not sure what's caused this current issue now lol.

BTW, rebelmaveric19,
I switched the map and it's much easier to work with. My API map key for autoremote is now everything from beginning through jarvistalk=:= So what I'm saying is when I scrape now it says {Map:AutoRemoteAPIKey.KrisNexus5} and then the TTS message I want sent. That works great.
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: squatingyeti on November 10, 2014, 01:49:05 AM
Ooooo emmm jebus, I think I got it  :biglaugh soooo, do NOT put http:// in your HTTP Get action for autovoice...at least not for me. As soon as I left out the http:// and just entered my dynamic DNS, it worked. Maybe specific to my dynamic DNS, but no clue on that. I thought it shouldn't matter if http:// was there, but it did. ravings of a yeti that awoke from a deep slumber! Nothing to do with http:// and everything to do with me having a prefix and the space issue (%20) in the TCP plugin.

Now, I haven't tested it with an actual autovoice command yet because my gf might outright murder me if she finds out I woke up and started messing with it on my tablet in bed  :D However, adding a couple extra commands to simulate autovoice recognizing a command and inserting that has worked where it previously failed.

Lastly, nime5ter, you are correct about the error with spaces. Confirmed with my tests from above. Any command passed to VC through the TCP plugin will fail if there are spaces. Replacing said spaces with %20 solves the issue.

Extra lastly, I created a way to get random responses back ;)

Thank you all and I will double confirm that everything is working with spoken commands to autovoice tomorrow when my life would not be in peril. This is very dim screen discretely signing off.
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: nime5ter on November 10, 2014, 08:40:27 AM
Cool. Glad you figured it out.

Just to clarify: When you enter a get request in a browser, the browser is automatically encoding the spaces correctly, so it will work properly.

The issue with the space is that Tasker does not appear to be encoding spaces in phrases that it's getting from Autovoice properly before sending them onward. In this case, it's not a VC thing. I don't know if rebel was already taking care of the space problem in some other way, or whether Tasker or Autovoice have changed how they work, or what.
Title: Re: Tasker + VoxCommando=Practical Artificial Intelligence (tutorial)
Post by: squatingyeti on November 10, 2014, 10:08:33 AM
Oh I see. Yes that makes sense. I have tested with autovoice this morning and it is now receiving everything correctly. Thank you for the help!
Title: Re:
Post by: rebelmaveric19 on November 10, 2014, 06:13:21 PM
Glad you got it working. Also I don't use a map table anymore....I use a python script nimester helped me write. As I talk to "Jarvis" from my personal and work devices. I have a gear live watch with the google now api on my personal phone and a droid turbo for work so I don't even have to touch anything to talk to my "Jarvis".
Title: Re:
Post by: rebelmaveric19 on November 10, 2014, 06:15:44 PM
BTW I didn't have http;// in my task but it didn't click in my head when I read your response. Stuff like that drives me nuts too.
Title: Re:
Post by: squatingyeti on November 10, 2014, 08:17:21 PM
Glad you got it working. Also I don't use a map table anymore....I use a python script nimester helped me write. As I talk to "Jarvis" from my personal and work devices. I have a gear live watch with the google now api on my personal phone and a droid turbo for work so I don't even have to touch anything to talk to my "Jarvis".

Sounds interesting! I currently have it set to pass the speaking part back to my phone if it isn't connected to my network and to go the normal speaker route if it is. I feel tasked and VC are a perfect match for a ton of cool stuff.