Author Topic: Commands and Responses - I just moved over from VA.  (Read 5261 times)

0 Members and 3 Guests are viewing this topic.

Cassan0va

  • Jr. Member
  • **
  • Posts: 11
  • Karma: 0
    • View Profile
Commands and Responses - I just moved over from VA.
« on: June 09, 2016, 05:42:15 PM »
So what im trying to do (havnt found any CLEAR documentation on this) is that i drop a commando to get a response, random and fixed.

Example 1:

- Sarah, how are you today?
-- Im fine thank you; Could be better; Im a robot what do i know [Multiple responses that are used randomly]

Responses are either prerecorded WAVs or TTS, undecided.


Now i ask the same thing again shortly after, but since i already asked i would get a different response.

- Sarah, how are you today?
-- Same as last time you asked; Age hitting you that hard?; You already asked me that.

Example 2:

- Sarah, lock the door.
-- [Wait 5sec] Door is now locked.

Now i ask the same thing again shortly after, but since i already asked i would get a different response.

- Sarah, lock the door.
-- Door is already locked, would you like me to unlock it?

This triggers the next step which is a global [Yes] tied to this but it could also be tied to multiple phrases.
IE, Would you like me to unlock? Would you like me to turn on the lights? Would you like me to turn on the TV.

All of these questions should have the same simple answer of yes and no but tied to each phrase as a sub?

Thats basicly what im trying to do right now.
Another thing ive been thinking of is if after ive asked her to lock the door i can ask "Is the door locked".

Anyhow hope you understand what im getting at, currently working on homeseer setup to get this working properly, VA worked alright but this software seems like it was aimed towards what i want to achieve.

If you dont want to answer with examples atleast point me in the right direction.

Best regards Conny

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Commands and Responses - I just moved over from VA.
« Reply #1 on: June 10, 2016, 08:53:55 AM »
Hi Conny and welcome to the Forum.


I think we can't give you the complete commands, but here is a start for your first example.


This command mirroring exact your example 1 - hard to explain each action.
It create also a event timer (clear answer) which will clear the last answer from your computer after 20 seconds otherwise it will answer you random "Same as last time you asked"; "Age hitting you that hard"; "You already asked me that!". The time start over and over again as long as the 20 seconds not past.
You can edit the timer action to your needs and also the text file.


I hope this will help you.


Copy and paste the following command group in your VC command tree - save the "randomAnswer.txt" file in your VC main folder.


Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.9-->
<commandGroup open="True" name="example 1" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="351" name="how are you today" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="parameter (B) in the logic block contain a blank (space key) and is not empty!">
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)==(B)</ifType>
      <ifParams>{Var.lastAnswer}&amp;&amp; </ifParams>
      <then />
      <else>
        <action>
          <cmdType>VC.StopEventTimer</cmdType>
          <params>
            <param>clear answer</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>Same as last time you asked | Age hitting you that hard | You already asked me that!</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.SetEventTimer</cmdType>
          <params>
            <param>20</param>
            <param>clear answer</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.StopMacro</cmdType>
          <params />
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>randomAnswer.txt</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExSingle</cmdType>
      <params>
        <param>^(.*?)\r\n</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>{Match.1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>{Match.1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>^(.*?)\n</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.WriteLine</cmdType>
      <params>
        <param>randomAnswer.txt</param>
        <param>{LastResult}{CR}{Match.1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.GetLastText</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>lastAnswer</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.SetEventTimer</cmdType>
      <params>
        <param>15</param>
        <param>clear answer</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>how are you today</phrase>
  </command>
  <command id="352" name="clear event timer" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>VC.StopEventTimer</cmdType>
      <params>
        <param>clear answer</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>lastAnswer</param>
        <param><![CDATA[ ]]></param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>clear answer</event>
  </command>
</commandGroup>
***********  get excited and make things  **********

Cassan0va

  • Jr. Member
  • **
  • Posts: 11
  • Karma: 0
    • View Profile
Re: Commands and Responses - I just moved over from VA.
« Reply #2 on: June 10, 2016, 09:25:10 AM »
Hi Conny and welcome to the Forum.


I think we can't give you the complete commands, but here is a start for your first example.


This command mirroring exact your example 1 - hard to explain each action.
It create also a event timer (clear answer) which will clear the last answer from your computer after 20 seconds otherwise it will answer you random "Same as last time you asked"; "Age hitting you that hard"; "You already asked me that!". The time start over and over again as long as the 20 seconds not past.
You can edit the timer action to your needs and also the text file.


I hope this will help you.


Copy and paste the following command group in your VC command tree - save the "randomAnswer.txt" file in your VC main folder.


Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.9-->
<commandGroup open="True" name="example 1" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="351" name="how are you today" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="parameter (B) in the logic block contain a blank (space key) and is not empty!">
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)==(B)</ifType>
      <ifParams>{Var.lastAnswer}&amp;&amp; </ifParams>
      <then />
      <else>
        <action>
          <cmdType>VC.StopEventTimer</cmdType>
          <params>
            <param>clear answer</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>Same as last time you asked | Age hitting you that hard | You already asked me that!</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.SetEventTimer</cmdType>
          <params>
            <param>20</param>
            <param>clear answer</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.StopMacro</cmdType>
          <params />
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>randomAnswer.txt</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExSingle</cmdType>
      <params>
        <param>^(.*?)\r\n</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>{Match.1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>{Match.1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>^(.*?)\n</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.WriteLine</cmdType>
      <params>
        <param>randomAnswer.txt</param>
        <param>{LastResult}{CR}{Match.1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.GetLastText</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>lastAnswer</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.SetEventTimer</cmdType>
      <params>
        <param>15</param>
        <param>clear answer</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>how are you today</phrase>
  </command>
  <command id="352" name="clear event timer" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>VC.StopEventTimer</cmdType>
      <params>
        <param>clear answer</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>lastAnswer</param>
        <param><![CDATA[ ]]></param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>clear answer</event>
  </command>
</commandGroup>

Wow thanks a bunch, already starting to feel that the switch over here was the right one :)
Really quick turn around and simple to edit, just have to study it abit to figure out what each bit does.

Any databank with examples like that one you just posted?
If not it might be an idea so people dont have to reinvent the wheel :)

Cassan0va

  • Jr. Member
  • **
  • Posts: 11
  • Karma: 0
    • View Profile
Re: Commands and Responses - I just moved over from VA.
« Reply #3 on: June 10, 2016, 09:34:38 AM »
Any ideas to the Global yes problem?

IE:
-Lock the door.
-- Door is locked
-Lock the door.
-- Door is already locked would you like to open it?
-Yes [This here could become a problem unless its tied to a specific set of phrases or phrase ((it only recognize this yes in combination with a specific phrase?))]

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Commands and Responses - I just moved over from VA.
« Reply #4 on: June 10, 2016, 10:26:38 AM »
Yes I have a lot of ideas to do this - I will take a look on it later.
I know VC need a bit of learning how things work, but we have a lot of video tutorials and also a fantastic wiki documentation.


http://voxcommando.com/mediawiki/index.php?title=Main_Page
***********  get excited and make things  **********

Cassan0va

  • Jr. Member
  • **
  • Posts: 11
  • Karma: 0
    • View Profile
Re: Commands and Responses - I just moved over from VA.
« Reply #5 on: June 10, 2016, 10:54:15 AM »
Yes I have a lot of ideas to do this - I will take a look on it later.
I know VC need a bit of learning how things work, but we have a lot of video tutorials and also a fantastic wiki documentation.


http://voxcommando.com/mediawiki/index.php?title=Main_Page

Will do that straight away thanks :)

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Commands and Responses - I just moved over from VA.
« Reply #6 on: June 10, 2016, 11:57:14 AM »
I've a question about the door lock: Which command do you use to lock/unlook the door (sending a http request?)? It would be nice to get a response from the door lock, to be sure the command has worked. Maybe we can request the state from the door lock  or the door lock send an event - is this possible?


This would make a lot of things easier to create. We have (for example) the Vera HA plugin in VC, maybe your HA works in a similar way.


Your second example demonstrate not really how HA works, because VC doesn't know when the door is unlocked by hand or maybe the light was turn on by hand  ::hmm



« Last Edit: June 10, 2016, 12:52:35 PM by Kalle »
***********  get excited and make things  **********

Cassan0va

  • Jr. Member
  • **
  • Posts: 11
  • Karma: 0
    • View Profile
Re: Commands and Responses - I just moved over from VA.
« Reply #7 on: June 10, 2016, 03:17:59 PM »
I've a question about the door lock: Which command do you use to lock/unlook the door (sending a http request?)? It would be nice to get a response from the door lock, to be sure the command has worked. Maybe we can request the state from the door lock  or the door lock send an event - is this possible?


This would make a lot of things easier to create. We have (for example) the Vera HA plugin in VC, maybe your HA works in a similar way.


Your second example demonstrate not really how HA works, because VC doesn't know when the door is unlocked by hand or maybe the light was turn on by hand  ::hmm

The idea is to get it to work in VA, then have VA read a state from the scraper in homeseer as a URL.
Well in theory, have yet to test it.

The reason i want to get it to work in VC first is because it can be applied to a multitude of instances and not just a door.
« Last Edit: June 10, 2016, 03:29:12 PM by Cassan0va »

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Commands and Responses - I just moved over from VA.
« Reply #8 on: June 10, 2016, 03:21:27 PM »
Only a hint - VC has also scrape actions  ;)
***********  get excited and make things  **********

Cassan0va

  • Jr. Member
  • **
  • Posts: 11
  • Karma: 0
    • View Profile
Re: Commands and Responses - I just moved over from VA.
« Reply #9 on: June 10, 2016, 03:28:53 PM »
Only a hint - VC has also scrape actions  ;)

Edit: I ment VC  :P

Yeah i know, thats one of the main reasons it caught my eye.
And now loads of stuff just keep popping up thats pretty awesome, its just completely differant from VA, while its a huge setback trying to get everything over to VC i think the positive ways over the negative.

Been looking over the wiki it feels like a huge slap in the face, if you are not sure what you are looking for its hard to find... Searching kinda works but still confusing.

Was looking at profile switching for the voice recognition, i guess its tied to the windows login profiles? I guess it has to be because of the training.

Best way is to setup new login profiles to get the speech recognition profiles and start training those then run the command inside VC to switch profile?
« Last Edit: June 10, 2016, 03:32:51 PM by Cassan0va »

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Commands and Responses - I just moved over from VA.
« Reply #10 on: June 10, 2016, 04:26:26 PM »
You looking for a command "action" to switch to a other profile?


If yes, take a look in the in the Wiki at Actions: http://voxcommando.com/mediawiki/index.php?title=Actions#SetProfile

http://voxcommando.com/forum/index.php?topic=1482.msg12876#msg12876

Also a search here in the forum with: "set speech profile" or "train speech profile" will give you good results.
Yes I know, there are a lot of information in the Wiki - but VC need a bit of learning curve and I'm sure you will find out fast how all the things work in VC.
« Last Edit: June 10, 2016, 04:30:26 PM by Kalle »
***********  get excited and make things  **********

Cassan0va

  • Jr. Member
  • **
  • Posts: 11
  • Karma: 0
    • View Profile
Re: Commands and Responses - I just moved over from VA.
« Reply #11 on: June 10, 2016, 05:02:34 PM »
found the command, setprofile. Yeah i tried looking over those topics, but as i said it links to the windows profiles right?

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Commands and Responses - I just moved over from VA.
« Reply #12 on: June 10, 2016, 05:11:35 PM »
yes, that is correct - it use the windows speech profiles.
***********  get excited and make things  **********

Cassan0va

  • Jr. Member
  • **
  • Posts: 11
  • Karma: 0
    • View Profile
Re: Commands and Responses - I just moved over from VA.
« Reply #13 on: June 10, 2016, 06:44:08 PM »
The way the door thing was done in VA was something like this.

Quote
"Lock the Door".
If  [doorstatus] = 1
run "toggle door" command
Set [doorstatus] = 2
End Condition - Exit when condition met
If [doorstatus] = 2
Run "Door is already locked" sound file.
End Condition - Exit when condition met


"open the door"
If [doorstatus] = 1
run "Door is already unlocked" sound file
End Condition - Exit when condition met
If [doorstatus] = 2
run "toggle door" command
Set [doorstatus] = 1
End Condition - Exit when condition met

Not the exact code but the gist of it, cant figure out how to recreate it here

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Commands and Responses - I just moved over from VA.
« Reply #14 on: June 11, 2016, 05:32:29 AM »
There is no Homeseer plugin in VC, so you'll have to handle some of the black box magic yourself (if it's possible with Homeseer).

For most users, it's easier to start learning VC's command structure, terminology, and UI by installing a standard configuration and exploring the existing commands for a while, rather than trying to build a customized command set from nothing.

Are you using HS2 or HS3 or is there something else now?
HS2: http://voxcommando.com/forum/index.php?topic=1405.msg12143
HS3: http://voxcommando.com/forum/index.php?topic=1395.msg12019#msg12019

Either way, it will be something like:

1. Scrape Homeseer to get status information back about the lock state.
2. Evaluate the information that comes back using a regular expression followed by one or more logic blocks. You can use 2 logic blocks if you like, as you describe above.

Hint: Use the action VC.StopMacro to exit the command when condition is met in your logic block, but before the last line of the command.

The get status and set door status will require knowing the correct URL, which is not determined by VC. This will require consulting the documentation for whatever Homeseer http querying solution you're using.

In general, it's a good idea in VC to become familiar with the terminology used in the program (a command is made up of a set of actions). The command is the macro as a whole, in other words.

And to spend some time scanning core actions and relevant plugin actions, which can be done within the program via the Action Selection Tree, or in the wiki.

Core actions page of the wiki: http://voxcommando.com/mediawiki/index.php?title=Actions
Plugin actions are found on individual plugin pages.

Also very important: get familiar with VC variables, such as {LastResult}.
http://voxcommando.com/mediawiki/index.php?title=Variables

Generally we use the TTS (or TTSMS) plugins for text-to-speech announcements. If you want to record sound files for every announcement, that's up to you. There are various actions in VC for playing audio files.

Eventually, you may want to learn how to integrate payloads and payload XML so that you don't have to duplicate the same command over and over for each device and each device state. But I would start more simply and work up to that.
« Last Edit: June 11, 2016, 09:15:04 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)