Author Topic: What VC Action can I use?  (Read 3984 times)

0 Members and 1 Guest are viewing this topic.

ddl

  • Sr. Member
  • ****
  • Posts: 118
  • Karma: 0
    • View Profile
What VC Action can I use?
« on: January 23, 2016, 09:41:30 PM »
I have created a command in VC that listens for events from my ISY.  In summary my hope is to have VC activate my home security system via my ISY.  I have started to write a command and got stuck and need some assistance with identifying the next action that will cause VC to delay for a certain amount of time and or a confirmation requirement is met.  For example... "You have thirty seconds to provide the password before I call the police" 

Here is what I have written so far

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.0.9-->
<command id="478" name="Unusual Motion" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>ProcessRunning</ifType>
    <ifParams>Kodi&amp;&amp;</ifParams>
    <then>
      <action>
        <cmdType>XJson.Raw</cmdType>
        <params>
          <param>InputExecuteAction</param>
          <param>"action"."pause"</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Scrape</cmdType>
        <params>
          <param>http://127.0.0.1:8000/Agent?function=AgentStayonTop&amp;Auth={M:botpass.botpass}&amp;onTop=True</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Scrape</cmdType>
        <params>
          <param>http://127.0.0.1:8000/Agent?function=AgentShow&amp;Auth={M:botpass.botpass}&amp;STATE=WSMaximized</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Scrape</cmdType>
        <params>
          <param>http://127.0.0.1:8000/Agent?function=AgentResolution&amp;Auth={M:botpass.botpass}&amp;Resolution=1</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>Scrape</cmdType>
        <params>
          <param>http://127.0.0.1:8000/Agent?function=AgentShow&amp;Auth={M:botpass.botpass}&amp;STATE=WSMAXIMIZED</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Scrape</cmdType>
        <params>
          <param>http://127.0.0.1:8000/Agent?function=AgentResolution&amp;Auth={M:botpass.botpass}&amp;Resolution=0</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <action>
    <cmdType>VC.Pause</cmdType>
    <params>
      <param>1000</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Scrape</cmdType>
    <params>
      <param>http://127.0.0.1:8000/Agent?function=AgentSpeak&amp;Auth={M:botpass.botpass}&amp;Text=Excuse me!  I don't recognize you. Please identify yourself, You have thirty seconds before I call the police</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>UnMot</phrase>
  <event>UnMot.UnMot
</event>
</command>

The next action should be the start of the timer which will be thirty seconds.  If a confirmation is not given within this time.  The next action will be to execute via a scrape command a program in my ISY that will activate my home security system.

Any help with ideas to finish my code would be appreciated.

sainf

  • $upporter
  • Jr. Member
  • *****
  • Posts: 20
  • Karma: 0
  • Living In Ireland
    • View Profile
Re: What VC Action can I use?
« Reply #1 on: January 24, 2016, 06:14:44 AM »
I Tinkered with this idea, most people used eventghost. I tried eventghost it worked but It irritated me that I had to run eventghost and other plugins. I wanted evearything to work with vc  so what I done is when I give my password or type my password or send it through voxwav  it restarts vc thus stopping all actions.

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: What VC Action can I use?
« Reply #2 on: January 24, 2016, 06:19:38 AM »
Uhhhhhhhhhhhhhhhhh, this is easier as you think   :D


One thing before we start with your alarm command: I've create a command group at first to show you how you can let your Guile3Dbot speak in an easier way -so you need not all the time write the complete IP and authentification stuff.


Guile3dbot easy speak command group:


Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.0.9-->
<commandGroup open="False" name="Guile3D-bot speak-easy way" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="1316" name="bot speak easy" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="The bot will speak aloud which contains in the payload {1} from the VC.TriggerEvent action">
    <action>
      <cmdType>Scrape</cmdType>
      <params>
        <param>http://127.0.0.1:8000/Agent?function=AgentSpeak&amp;Auth={M:botpass.botpass}&amp;Text={1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>bot speak easy</event>
  </command>
  <command id="1317" name="let the bot speak" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="this command trigger the &quot;bot speak easy&quot; event with time as payload {1}. The payload is what the bot speak aloud - you can use any text or value. This command is then similar to the TTS.Speak action but only for the Guile3D bot. I this way you must not use each time the whole path to the bot like:http://127.0.0.1:8000/Agent?function=AgentSpeak&amp;Auth={M:botpass.botpass}&amp;Text=Excuse me!  I don't recognize you. Please identify yourself, You have thirty seconds before I call the police ">
    <action>
      <cmdType>VC.TriggerEvent</cmdType>
      <params>
        <param>bot speak easy</param>
        <param>{ShortTime}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
  </command>
</commandGroup>


try this command group for your alarm stuff - if the Unusual Motion is detected, you have 30 seconds to say the password (seven seas without sharks) to deactivate the alarm:


Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.0.9-->
<commandGroup open="False" name="Alarm system test for ddl" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="478" name="Unusual Motion" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>ProcessRunning</ifType>
      <ifParams>Kodi&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>XJson.Raw</cmdType>
          <params>
            <param>InputExecuteAction</param>
            <param>"action"."pause"</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Scrape</cmdType>
          <params>
            <param>http://127.0.0.1:8000/Agent?function=AgentStayonTop&amp;Auth={M:botpass.botpass}&amp;onTop=True</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Scrape</cmdType>
          <params>
            <param>http://127.0.0.1:8000/Agent?function=AgentShow&amp;Auth={M:botpass.botpass}&amp;STATE=WSMaximized</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Scrape</cmdType>
          <params>
            <param>http://127.0.0.1:8000/Agent?function=AgentResolution&amp;Auth={M:botpass.botpass}&amp;Resolution=1</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>Scrape</cmdType>
          <params>
            <param>http://127.0.0.1:8000/Agent?function=AgentShow&amp;Auth={M:botpass.botpass}&amp;STATE=WSMAXIMIZED</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Scrape</cmdType>
          <params>
            <param>http://127.0.0.1:8000/Agent?function=AgentResolution&amp;Auth={M:botpass.botpass}&amp;Resolution=0</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <action>
      <cmdType>VC.Pause</cmdType>
      <params>
        <param>1000</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.TriggerEvent</cmdType>
      <params>
        <param>bot speak easy</param>
        <param>Excuse me!  I don't recognize you. Please identify yourself, You have thirty seconds before I call the police</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.TriggerEvent</cmdType>
      <params>
        <param>intruder alert</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.SetEventTimer</cmdType>
      <params>
        <param>30</param>
        <param>start sirene</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>UnMot</phrase>
    <event>UnMot.UnMot
</event>
  </command>
  <command id="772" name="alarm activated" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>VC.TriggerEvent</cmdType>
      <params>
        <param>bot speak easy</param>
        <param>alarm, unauthorized person in the house</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>start sirene</event>
  </command>
  <command id="754" name="deactivate alarm (password)" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>VC.StopEventTimer</cmdType>
      <params>
        <param>start sirene</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.TriggerEvent</cmdType>
      <params>
        <param>bot speak easy</param>
        <param>password is correct, alarm deactivated</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>seven seas without sharks</phrase>
  </command>
</commandGroup>

Have fun ;)
« Last Edit: January 24, 2016, 11:06:42 AM by Kalle »
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: What VC Action can I use?
« Reply #3 on: January 24, 2016, 09:43:06 AM »
Uhhhhhhhhhhhhhhhhh, this is not so easy as you think  :o

Why do you say that Kalle?  As you have shown it is very simple...

You simply need to create an event timer using the action VC.SetEventTimer which will trigger your alarm after 30 seconds.  If the users gives a password then it cancels this timer using the action VC.StopEventTimer

What could be simpler?

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: What VC Action can I use?
« Reply #4 on: January 24, 2016, 10:50:57 AM »
Haha, yes you are right - before I posted this simple command, I had a look on a similar command (a really old VC version) with missing VC.EventTimer actions. After I recreate the command in a newer Version of VC, it was easy to create this command and I forgot to change the text in the post at begin - sorry.


I can now say - it is really easy to create such a command
« Last Edit: January 24, 2016, 11:05:39 AM by Kalle »
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: What VC Action can I use?
« Reply #5 on: January 24, 2016, 11:44:18 AM »
 :biglaugh

ddl

  • Sr. Member
  • ****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: What VC Action can I use?
« Reply #6 on: January 24, 2016, 03:08:44 PM »
All,

Thanks much for the feedback.  I added a few things to Kalle's suggestion to complete the program and it works great.  Thanks again.  I chose Kalle suggestion because it helps me to understand the logic better.  I'll need to read up and study more on how the  " VC.SetEventTimer" and "VC.StopEventTimer" work.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: What VC Action can I use?
« Reply #7 on: January 24, 2016, 04:13:41 PM »
It's pretty easy to make your choice when there is only one option presented.  ;)