Author Topic: vox timer for motion sensor  (Read 3315 times)

0 Members and 1 Guest are viewing this topic.

achel

  • Jr. Member
  • **
  • Posts: 38
  • Karma: 4
    • View Profile
vox timer for motion sensor
« on: December 11, 2014, 05:02:18 AM »
Hello
i am having trouble with logic and how to do this.

What I am trying to do is if motion is detected in a given time then do nothing , if not the then do action.

I appreciate any help with this.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: vox timer for motion sensor
« Reply #1 on: December 11, 2014, 09:51:47 AM »
Something similar is discussed here: http://voxcommando.com/forum/index.php?topic=1759.msg15302#msg15302

Because that xml is very specialized for IKROWNI's needs, below I have attached a simplified version.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.2.3-->
<command id="505" name="Motion Announcement" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Results.SetVar</cmdType>
    <params>
      <param>AnnounceMotion</param>
      <param>False</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)&lt;(B)</ifType>
    <ifParams>{DtCustom.HHmm}&amp;&amp;0800</ifParams>
    <then>
      <action>
        <cmdType>Results.SetVar</cmdType>
        <params>
          <param>AnnounceMotion</param>
          <param>True</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)&lt;(B)</ifType>
    <ifParams>2000&amp;&amp;{DtCustom.HHmm}</ifParams>
    <then>
      <action>
        <cmdType>Results.SetVar</cmdType>
        <params>
          <param>AnnounceMotion</param>
          <param>True</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)==(B)</ifType>
    <ifParams>{var.AnnounceMotion}&amp;&amp;True</ifParams>
    <then>
      <action>
        <cmdType>OSD.ShowText</cmdType>
        <params>
          <param>Warning: motion detected!</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <params>
          <param>Motion has been detected at the front of the home.</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>VcAdvanced.Log</cmdType>
        <params>
          <param>----Motion announcement cancelled----</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <event>motion event</event>
</command>

The above command is triggered by a motion event (obviously this should be changed to the correct event that is generated by your own system). When triggered, if the time is after 20:00 and before 8:00 in the morning, we set an "AnnounceMotion" variable to "true". During the daytime, the variable is set to "false".

The third logic block evaluates whether the AnnounceMotion variable is true or false. If it is true, then a "motion detected" announcement is given. If it is false, it simply adds an entry to the log saying that the motion announcement was cancelled.
« Last Edit: December 11, 2014, 09:54:13 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)

achel

  • Jr. Member
  • **
  • Posts: 38
  • Karma: 4
    • View Profile
Re: vox timer for motion sensor
« Reply #2 on: December 11, 2014, 07:15:39 PM »
thanks nime5ter
This is great I will have a play.

achel

  • Jr. Member
  • **
  • Posts: 38
  • Karma: 4
    • View Profile
Re: vox timer for motion sensor
« Reply #3 on: December 12, 2014, 05:48:49 AM »
nime5ter
Sorry I had a play and I didn't explain myself properly, sorry for wasting your time.

I meant time as in seconds not as in hours of day.
For example what I am trying to achieve is whether a room is occupied or not.

Scenario would go something like this: motion sensor is tripped by person being in room, Vc gets the notification from vera doesn't change anything.
But if Vc doesn't see a trip event because the motion sensor does not see movement for say 5 minutes, it would then assume the room was empty and trigger an action to turn lights off etc
« Last Edit: December 12, 2014, 05:52:31 AM by achel »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: vox timer for motion sensor
« Reply #4 on: December 12, 2014, 09:59:08 AM »
I'm not sure if you are explaining yourself clearly now or not.

If I understand you correctly, you don't want to turn the lights on, but if a room is empty for a period of time, then you want the lights to be turned off automatically.

Almost every PIR motion sensor is already designed to handle this type of situation.  In Vera you can open the device settings for the motion sensor and set this time-out to whatever you want (see attached image for example).  Then when there is no motion in a room for that period of time an event will be triggered and you can assign this event to your Vera Scene, or a VoxCommando macro which turns off your lights.  There is also an added benefit to doing this.  If you set the timeout to a longer period then the batteries in your motion sensor will last longer, because it will need to wake up the radio less often in order to report motion/secure messages back to the Vera controller.

achel

  • Jr. Member
  • **
  • Posts: 38
  • Karma: 4
    • View Profile
Re: vox timer for motion sensor
« Reply #5 on: December 12, 2014, 03:31:50 PM »
That has done it :D
I think I must lern how my vera works.

Thanks again