Author Topic: Communication with Voxcommando outside local network with voice feedback  (Read 7344 times)

0 Members and 1 Guest are viewing this topic.

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
this does take a decent amount of setup but when finished you will be able to communicate with Voxcommando from inside and outside your local network with voice feedback

what you need

Extra Android device (More Below)
Tasker Full Version
AutoVoice Full Version
AutoRemoteFull Version
UDP sennder


the extra android device will need to be on your local network at all times(When ever you want to use this setup anyways), if it is a tablet or phone you will most likely need the screen to be on for this to work as most tablets cut wifi connection when the screen is off for an extended period,

NOTE:: it may be possible to use the Autoremote Evenghost plugin (I tried using it after I had this method setup, but I didn't have any luck. I may have been doing something wrong)

Just an update on this: I cannot send a message from our Android mobile device to the Eventghost plugin unless there's a local network connection. So, while I haven't been able to properly test a remote connection I strongly believe that anyone who wants to use the Eventghost option on their PC will need to use port forwarding if they want to send messages to their computer from a remote location.

... it is probably much simpler and more reliable to use the TCP plugin with a forwarded port to receive messages or commands from devices outside your LAN, or to use the mobile device solution if you don't mind running an Android device all the time...

this will also require redoing all of your TTS.Speak and TTS.SpeakSync Actions and converting them into a VC.TriggerEvent action (more on this below)

now that all the information to help you determin if it is worth doing is out of the way, here is a video showing a very quick demo and a full walk though on how to set things up on your two android devices:




In VC you will need to convert all of your TTS.Speak and TTS.Speaksync to-
Quote
VC.Triggerevent (Eventname) Speak {1} {Var.Sender} {2} TTS Method, {3} Text to speak
there are two examples in the "Example TTS / AutoRemote Event" command attached below

description of the attached commands:

"AutoRemote Map Setup Example" an example of how to setup your AutoRemote map tablet in VC

"Sender" this sets the Variable Sender to the name of the sender i.e. peglegs phone

"Sender Reset" this is used to set the sender back to PC

"TTS > PC/Phone" this action will either send AutoRemote message or TTS.speak/sync depending on the Sender

"Example TTS / AutoRemote Message" examples of how to setup VC.TriggerEvent for TTS and AutoRemote Messages


Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.6-->
<commandGroup open="True" name="AutoRemote to VC Communication" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="1417" name="AutoRemote Map Setup Example" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Map.CreateTable</cmdType>
      <params>
        <param>AutoRemote</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>AutoRemote</param>
        <param>your phone</param>
        <param>Your AutoRemote API Key for your phone Goes HERE</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>AutoRemote</param>
        <param>other AutoRemote Device</param>
        <param>Your AutoRemote API Key for other device Goes HERE</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
  </command>
  <command id="1056" name="Sender" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>Sender</param>
        <param>{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.SetEventTimer</cmdType>
      <params>
        <param>30s</param>
        <param>Sender.Reset</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Sender</event>
  </command>
  <command id="1040" name="Sender Reset" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>Sender</param>
        <param>PC</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Sender.Reset</event>
  </command>
  <command id="1020" name="TTS &gt; PC/Phone" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="The First AutoRemote message is a blank, to make sure that Autoremote and tasker receive the message ">
    <if ifBlockDisabled="False" ifNot="True">
      <ifType>(A)==(B)</ifType>
      <ifParams>{Var.Sender}&amp;&amp;PC</ifParams>
      <then>
        <action>
          <cmdType>Scrape</cmdType>
          <params>
            <param>https://autoremotejoaomgcd.appspot.com/sendmessage?key={M:AutoRemote.{1}}&amp;message= </param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Scrape</cmdType>
          <params>
            <param>https://autoremotejoaomgcd.appspot.com/sendmessage?key={M:AutoRemote.{1}}&amp;message=VCSay=:={3}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.SetEventTimer</cmdType>
          <params>
            <param>30s</param>
            <param>Sender.Reset</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.StopMacro</cmdType>
          <params />
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)==(B)</ifType>
      <ifParams>TTS&amp;&amp;{2}</ifParams>
      <then>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>{3}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>TTS.SpeakSync</cmdType>
          <params>
            <param>{3}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <event>Speak</event>
  </command>
  <command id="1041" name="Example TTS / AutoRemote Message" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>VC.TriggerEvent</cmdType>
      <params>
        <param>Speak</param>
        <param>{Var.Sender}</param>
        <param>TTS</param>
        <param>text to be spoken</param>
      </params>
      <cmdRepeat>0</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.TriggerEvent</cmdType>
      <params>
        <param>Speak</param>
        <param>{Var.Sender}</param>
        <param>TTSync</param>
        <param>text to be spoken</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
  </command>
</commandGroup>
« Last Edit: May 03, 2017, 10:36:46 AM by PegLegTV »

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Communication with Voxcommando outside local network with voice feedback
« Reply #1 on: February 26, 2016, 07:31:26 PM »
Attached below are the two tasker projects that I showed how to create in the video above

Tasker Import Project: once you have the projects on your android device's open tasker and long press on a project at the bottom (if your new to Tasker Long press the house in the bottom left corner) and select import, then navigate to the file and select it

Import "On2VC.prj.xml" to the Android device you plan to leave on your local network

once it is imported you will need to edit the following:


      HTTP Get > add your VC IP:Port where it says "put.your.IP.and:port#here"

      UDP Sender Replace "192.168.1.10" with your VC IP Address

Import "PhoneVC.prj.xml" to your other android devices you plan to use

once it is imported you will need to edit the following:

Under Home / Away
Wifi Connected where it says "put your SSID here" replace that with your Routers SSID

Under Phone2VC
click Phone2VC Task > click HTTP Get, add your IP:port where it says "put.your.IP.and:port#here"
   change the second payload where it says "phone name here" to your phones name
                  (the name you gave in in autoremote)

UDP Sender change "192.168.1.10" to your VC IP

Under Phone2Android
click Phone2Android Task, click AutoRemote Message and select device at the top and choose your
android device that is staying one your local network
       
« Last Edit: February 26, 2016, 07:56:12 PM by PegLegTV »

squatingyeti

  • Jr. Member
  • **
  • Posts: 40
  • Karma: 1
    • View Profile
Sorry I just kind of scanned over this, but I have VC setup to determine if the command came from my phone remotely or was issued locally at the computer. If it was sent via my phone, VC will send an autoremote message to my phone, which will be passed to tasker and my phone can actually speak responses that would have been local. No need for a local device. Straight from VC to the phone. Is there something I'm missing here that requires that second device?

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
the second device (or Eventghost with AutoRemote plugin) is needed to receive the AutoRemote message from your phone when you are outside your local network, as there is no AutoRemote plugin for Voxcommando

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Actually, I believe you should be able to send messages from VC to autoremote directly even if it is not local, using Scrape actions. Autoremote has its own webserver that accepts http get requests.

http://autoremotejoaomgcd.appspot.com/

You need to know your autoremote key, and the syntax that autoremote requires. Along the lines of:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.7-->
<command id="1158" name="send a message to autoremote" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="You'll need to look up the autoremote syntax to get the variables right in the Scrape URL string.">
  <action>
    <cmdType>TTS.Speak</cmdType>
    <params>
      <param>{1}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Scrape</cmdType>
    <params>
      <param>http://autoremotejoaomgcd.appspot.com/sendmessage?key={M:API.autoremoteKey}&amp;message={1}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>autoremote.send</event>
  <phrase>Send autoremote the message</phrase>
  <payloadList>Jarvis are you there,Your home is secure</payloadList>
</command>
« Last Edit: February 28, 2017, 10:28:58 AM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Edit: Ah. I see what you're saying now. You're talking about sending Autoremote messages *to* VC, not the other way around?

Sorry. I didn't process that properly.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Quote
Actually, I believe you should be able to send messages from VC to autoremote directly even if it is not local, using Scrape actions. Autoremote has its own webserver that accepts http get requests.

Yes you can send AutoRemote from VC to your phone but  NOT from your phone to VC,

the *second device is ONLY  needed to receive AutoRemote messages when outside your local network

so

Communication setup

in network
from phone to VC = HTTP
from VC to phone = Scrape (AutoRemote message)

Outside network
from Phone to *second device = AutoRemote Message
From second device to VC = HTTP
From VC to Phone = Scrape (AutoRemote message)


* also includes Eventghost with AutoRemote Plugin

EDIT (nime5ter posted while I was replying)

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
my approach is I call VC on skype .... I switch the input/output of VC to connect to skype input/output using virtual cables ... then I talk to it ... when call ends ... VC switch the audio back to its standard config.
it works for non-android users :)
When Voice command gets tough, use hand gestures

squatingyeti

  • Jr. Member
  • **
  • Posts: 40
  • Karma: 1
    • View Profile
the second device (or Eventghost with AutoRemote plugin) is needed to receive the AutoRemote message from your phone when you are outside your local network, as there is no AutoRemote plugin for Voxcommando

ahhh gotcha. Yeah, I just go with Eventghost and the AutoRemote plugin. Wasn't thinking about how to do it without that.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
the second device (or Eventghost with AutoRemote plugin) is needed to receive the AutoRemote message from your phone when you are outside your local network, as there is no AutoRemote plugin for Voxcommando

@PegLegTV, this is an old thread I know, but I had a question about the Eventghost plugin option. Do you use that plugin?

My impression is that one would need to enable port forwarding on the home network in order to send the Eventghost Autoremote plugin a message from a remote location. Is that the case?
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Hey nime5ter, I do not use the plugin,

I don't think you would need to portforward as autoremote defaults to using the cloud, unless you turned on autoremote wifi option.

But if you're having problems with communication from outside your network, It looks like the default port for autoremote eventghost plugin is 1818, so you could try forwarding that port and see if it helps

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Thanks. I actually have no way to test it outside the local network, so it wasn't clear to me whether it was using the LAN or not. It is working, though.

I posted this question on the Tasker guy's site months ago and no one ever responded. Not quite the communication and support we're used to around here. ;-)
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Yeah I've noticed the same, most of the time it's trial and error, 

right now I'm using my remote tablet, so I have to remember to plug it in before we go anywhere (remote is setup to keep the display on while charging) but soon we'll have a wall mounted tablet that will be on all the time, but I think the best way to do this over all would be with an android set top box with kodi on it

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Just an update on this: I cannot send a message from our Android mobile device to the Eventghost plugin unless there's a local network connection. So, while I haven't been able to properly test a remote connection I strongly believe that anyone who wants to use the Eventghost option on their PC will need to use port forwarding if they want to send messages to their computer from a remote location.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
If that is the case then it is probably much simpler and more reliable to use the TCP plugin with a forwarded port to receive messages or commands from devices outside your LAN, or to use the mobile device solution if you don't mind running an Android device all the time.  I can't see any advantage to bringing EventGhost into the mix unless you are already using it this way to do other EventGhosty things.