Author Topic: X10 Motion Sensor Help  (Read 3777 times)

0 Members and 1 Guest are viewing this topic.

IKROWNI

  • $upporter
  • Sr. Member
  • *****
  • Posts: 146
  • Karma: 2
    • View Profile
X10 Motion Sensor Help
« on: September 18, 2014, 11:17:14 PM »
Hello everyone. I just had someone steal some stuff from the front of my home and was hoping I could get your help with a little motion sensing setup I'm trying to get going. I have a PR511 motion flood light setup out front of my home.

The PR511 Motion sensor is set to code A16 and my socket rocket at the lanai is set to code A1 when motion is sensed it flips on the front garage lights and the lanai light all at once. What I would really like is to have TTS come through my computer speakers notifying me when the motion sensor is tripped.

Is there anyway for me to do this? I can't afford a camera setup yet so I was hoping I could at least be notified when there is motion detected out front. Just let me know any additional information you may need that can help me get this working.

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: X10 Motion Sensor Help
« Reply #1 on: September 19, 2014, 03:00:39 AM »
one way of achieving that is to have an x10 connected to your PC (either usb or serial, I think VC PLUGIN is tested with usb) then you can listen to the events ....
Once you can see x10 events in the history window drag it to a new command then you can do whatever you want ... From tts to firing a teaser(highly unrecommended and might be even illegal)   !!!
When Voice command gets tough, use hand gestures

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: X10 Motion Sensor Help
« Reply #2 on: September 19, 2014, 09:00:41 AM »
I think you need a cm15a

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

Serial might be possible with python but I don't really know.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: X10 Motion Sensor Help
« Reply #3 on: September 19, 2014, 09:06:56 AM »
If you don't already have one it might make more sense to get an IP camera.

IKROWNI

  • $upporter
  • Sr. Member
  • *****
  • Posts: 146
  • Karma: 2
    • View Profile
Re: X10 Motion Sensor Help
« Reply #4 on: September 20, 2014, 11:22:34 PM »
I think you need a cm15a

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

Serial might be possible with python but I don't really know.


EDIT: thanks I got it working
« Last Edit: September 20, 2014, 11:30:12 PM by IKROWNI »

IKROWNI

  • $upporter
  • Sr. Member
  • *****
  • Posts: 146
  • Karma: 2
    • View Profile
Re: X10 Motion Sensor Help
« Reply #5 on: September 20, 2014, 11:28:12 PM »
one way of achieving that is to have an x10 connected to your PC (either usb or serial, I think VC PLUGIN is tested with usb) then you can listen to the events ....
Once you can see x10 events in the history window drag it to a new command then you can do whatever you want ... From tts to firing a teaser(highly unrecommended and might be even illegal)   !!!

Hahaha could you provide me with some schematics for firing the taser? JUST KIDDING.. though I'm sure they would never look at my home as a target again after that. Also thanks for the bit of info now my motion sensor is notifying me inside when someone has been detected out front messing about.
« Last Edit: September 20, 2014, 11:30:59 PM by IKROWNI »

IKROWNI

  • $upporter
  • Sr. Member
  • *****
  • Posts: 146
  • Karma: 2
    • View Profile
Re: X10 Motion Sensor Help
« Reply #6 on: September 20, 2014, 11:55:50 PM »
Okay ive got my alarm working when motion is detected at the front of my home now. Ive also expanded on it a bit.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="482" name="Motion Announcement" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>XJson.Raw</cmdType>
    <cmdString>Input.ExecuteAction&amp;&amp;"action":"pause"</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Sound.SetVol</cmdType>
    <cmdString>100</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <cmdString>Motion has been detected at the front of the home.</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.Pause</cmdType>
    <cmdString>5000</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Sound.SetVol</cmdType>
    <cmdString>25</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.Raw</cmdType>
    <cmdString>Input.ExecuteAction&amp;&amp;"action":"pause"</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>X10.RECVPLC.A1.ON</event>
</command>

I was in the middle of watching a movie and when motion was detected from my stepson walking the dogs at like 9pm my movie volume about blew my eardrums out. So I added a pause before the task and after to pause/unpause my show before it switches the volume to 100 to announce the motion being detected. now I used setvolume command to make the volume go to 100 for the announcement but how can I get the volume to go back to where it was before the command fired? I'm currently just using setvolume command again to go to 25 which is pretty close to where it usually is when I'm viewing a show. But I would much rather have it go back to the exact volume level it was before the command triggered. Would "getvol" be used for this purpose?

Along with the volume thing I'm having a small issue with is that I have the kids out front playing int he front yard throughout the day. Is there a way to make it so that the command can only be triggered between certain times for example 8PM-6AM? That way its only going to run the TTS during a time I would care if someone were on my property possibly messing about? Could I use something like "seteventtimer" and "DisableGroup/EnableGroup" to enable my motion security event?
« Last Edit: September 21, 2014, 12:04:44 AM by IKROWNI »

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: X10 Motion Sensor Help
« Reply #7 on: September 21, 2014, 02:27:57 AM »
Okay ive got my alarm working when motion is detected at the front of my home now. Ive also expanded on it a bit.

Along with the volume thing I'm having a small issue with is that I have the kids out front playing int he front yard throughout the day. Is there a way to make it so that the command can only be triggered between certain times for example 8PM-6AM? That way its only going to run the TTS during a time I would care if someone were on my property possibly messing about? Could I use something like "seteventtimer" and "DisableGroup/EnableGroup" to enable my motion security event?

Cool ... What are you using ? Serial or usb?

You can add to beginning of your commands 2 simple ifs to stop the macro if the current time outside the time range... {DtCustom.HHmm} returns current time in 24h format without the : (military time format) which passes through if blocks easily ....
Add
If A<B 600 {DtCustom.HHmm}
     Vc.stopmacro                           (in the first row, true condition)
If A<B {DtCustom.HHmm}  2000
      Vc.stopmacro                           (in the first row, true condition)

I think it is the easiest approach
When Voice command gets tough, use hand gestures

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: X10 Motion Sensor Help
« Reply #8 on: September 21, 2014, 05:32:32 AM »
Quote
I'm currently just using setvolume command again to go to 25 which is pretty close to where it usually is when I'm viewing a show. But I would much rather have it go back to the exact volume level it was before the command triggered. Would "getvol" be used for this purpose?

You can use Sound.PartialMute and Sound.PartialUnmute

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

IKROWNI

  • $upporter
  • Sr. Member
  • *****
  • Posts: 146
  • Karma: 2
    • View Profile
Re: X10 Motion Sensor Help
« Reply #9 on: September 21, 2014, 09:12:05 PM »
Cool ... What are you using ? Serial or usb?

You can add to beginning of your commands 2 simple ifs to stop the macro if the current time outside the time range... {DtCustom.HHmm} returns current time in 24h format without the : (military time format) which passes through if blocks easily ....
Add
If A<B 600 {DtCustom.HHmm}
     Vc.stopmacro                           (in the first row, true condition)
If A<B {DtCustom.HHmm}  2000
      Vc.stopmacro                           (in the first row, true condition)

I think it is the easiest approach

Well I think I stumbled on a way to get it all working properly, you guys might laugh at the method I used cause I'm sure I made it a lot harder than what it needed to be.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="430" name="Motion Security Timer On" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>VC.SetEventTimer</cmdType>
    <cmdString>7:30 PM&amp;&amp;Enable Motion Security</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="499" name="Motion Security Timer Off" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>VC.SetEventTimer</cmdType>
    <cmdString>7:00 AM&amp;&amp;Enable Motion Security</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="500" name="Enable Motion Security" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>VC.EnableGroup</cmdType>
    <cmdString>Motion Security</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="508" name="Disable Motion Security" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>VC.DisableGroup</cmdType>
    <cmdString>Motion Security</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="Motion Security" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="505" name="Motion Announcement" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Input.ExecuteAction&amp;&amp;"action":"pause"</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.SetVolume</cmdType>
      <cmdString>100</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <cmdString>Motion has been detected at the front of the home.</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.Pause</cmdType>
      <cmdString>5000</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.SetVolume</cmdType>
      <cmdString>20</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Input.ExecuteAction&amp;&amp;"action":"pause"</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>X10.RECVPLC.A1.ON</event>
  </command>
</commandGroup>

I have 2 separate groups 1 called "X10" and the other called "Motion Security" I'm suing event timers and group disable/enable to start/stop the motion security group at the proper times. It seems to be working well ill have to see if there are any issues with it over the course of using it the next few days but it seems to be solid so far.

« Last Edit: September 21, 2014, 09:19:03 PM by IKROWNI »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: X10 Motion Sensor Help
« Reply #10 on: September 21, 2014, 10:18:24 PM »
Hadood's solution looked much simpler.  Was there some reason you did not want to use it?

Also, I don't know if you uploaded the actual commands that you are using but from what I am seeing it does not look like this will work.
« Last Edit: September 22, 2014, 10:05:38 AM by jitterjames »

IKROWNI

  • $upporter
  • Sr. Member
  • *****
  • Posts: 146
  • Karma: 2
    • View Profile
Re: X10 Motion Sensor Help
« Reply #11 on: September 22, 2014, 02:35:24 PM »
Hadood's solution looked much simpler.  Was there some reason you did not want to use it?

Also, I don't know if you uploaded the actual commands that you are using but from what I am seeing it does not look like this will work.

your right that didn’t work I thought it was working but it was just the dusk sensor on the motion sensor that wasn’t making it work in that time frame. I just tried using hadood's method. Ive never tried my hand at the if/then stuff. ive had voxcommando for about a year now and still trying to learn it all.

Heres the new code please let me know if I did this right.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="505" name="Motion Announcement" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)&lt;(B)</ifType>
    <ifParams>730&amp;&amp;{DtCustom.HHmm}</ifParams>
    <then>
      <action>
        <cmdType>VC.StopMacro</cmdType>
        <cmdString />
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)&lt;(B)</ifType>
    <ifParams>{DtCustom.HHmm}&amp;&amp;2000</ifParams>
    <then>
      <action>
        <cmdType>VC.StopMacro</cmdType>
        <cmdString />
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <action>
    <cmdType>XJson.Raw</cmdType>
    <cmdString>Input.ExecuteAction&amp;&amp;"action":"pause"</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.SetVolume</cmdType>
    <cmdString>100</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <cmdString>Motion has been detected at the front of the home.</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.Pause</cmdType>
    <cmdString>5000</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.SetVolume</cmdType>
    <cmdString>20</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.Raw</cmdType>
    <cmdString>Input.ExecuteAction&amp;&amp;"action":"pause"</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>X10.RECVPLC.A1.ON</event>
</command>


nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: X10 Motion Sensor Help
« Reply #12 on: September 22, 2014, 03:20:16 PM »
You followed Haddood's instructions correctly. But after taking a closer look, his solution wouldn't quite work as you want it.

The reason his method will not work is because every time the command is triggered after 7 am, it will immediately stop the command macro, and this will be just as true after 8 pm, since 2000 comes after 7 am. So it will never make it to the rest of the command

The following should work for you:
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.0.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;0700</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>XJson.Raw</cmdType>
        <params>
          <param>Input.ExecuteAction</param>
          <param>"action":"pause"</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>TTS.SetVolume</cmdType>
        <params>
          <param>100</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>
      <action>
        <cmdType>TTS.SetVolume</cmdType>
        <params>
          <param>20</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>XJson.Raw</cmdType>
        <params>
          <param>Input.ExecuteAction</param>
          <param>"action":"pause"</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>X10.RECVPLC.A1.ON</event>
</command>

In terms of the method you tried to use above, I don't know if what you were posting was the final version of your commands, but one of the main issues is that you had four commands that would not have been triggered by anything.

You need to assign either events or a voice command phrase to your commands no matter what, if you want them to be able to do something.

Also, just a note that when you use TTS.SetVolume you are setting the TTS volume as a percentage of your system volume. If your system volume is at 40 and you set your TTS volume to 100, then the TTS voice will speak at a volume of 40.

If you reduce your TTS volume to 20, then it will make announcements at 20% of 40.
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: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: X10 Motion Sensor Help
« Reply #13 on: September 22, 2014, 03:25:39 PM »
In most cases I think it makes sense to always leave your system volume at 100%.  If you want to reduce the volume of your movies then you should either be changing the volume of your receiver, or the volume of the program playing the media (e.g. XMBC).

The only time I adjust my system volume is when I want to temporarily turn it down to give a voice command and then turn it back up to 100%.

By doing it this way you are able to adjust the volume of all items individuallly so it is possible for your TTS to be heard at a volume higher than your movie, if that is what you want.

So in your case you should probably always leave both your TTS and System volume at 100% and just adjust your XBMC volume to whatever sounds best for your current media / time of day.