www.homeseer.com

Go Back   HomeSeer Message Board > 3rd Party Plug-Ins/Scripts > Doo Plug-Ins & Scripts > Motion Sensor Plug-In

Motion Sensor Plug-In Discussions relating to the DooMotion plug-in, provided by Jim Doolittle. This plug-in is available from the HomeSeer updater.

Reply
 
Thread Tools Display Modes
  #1  
Old August 22nd, 2009, 04:16 PM
tonlof's Avatar
tonlof tonlof is online now
Seer Master
 
Join Date: Apr 2001
Location: Koping,Sweden
Posts: 513
Default Query time from last motion/no motion?

Can I make an inquiry about how long it was not been any movement from a given sensor? I want the room lights to be switched off after eg 10 minutes after no motion activated
__________________
Please excuse any spelling and grammatical errors I may make.
--
Tony Lofgren | Sweden
HS Pro, Win 2003, MySQL 5, Dell XPS 3,2GHz 2Gb, 2 striped raptordisk in raid0, Velleman K8055 , TEMP05 V5.00, DS9097, 1Wire Dallas weatherstation, HS PCI Modem, Basic Stamp for I/O, AVS-8X8, Dreambox 7020s. 2pcs xbox 1.6 xbmc connected to HS2.
Reply With Quote
  #2  
Old August 22nd, 2009, 05:32 PM
rmasonjr's Avatar
rmasonjr rmasonjr is offline
Seer Master
 
Join Date: May 2001
Location: Brookhaven, MS USA
Posts: 1,391
Default

If you use doomotion's Custom Action Code (CAC), you can do this like so.

In the ON code:
PHP Code:
if(hs.isOffByName("Master Bedroom Robs Closet Light")) then
    hs
.execX10ByName("Master Bedroom Robs Closet Light","on")
end if
dm.newNoMotionDelayedEvent("Delayed Event Master Bedroom Robs Closet Light""Master Bedroom Robs Closet Light:off",2
This will turn off my closet light after 2 mins

In the OFF code - just to ensure the light gets turned off:

PHP Code:
If Sensor.FailSafeInvoked Then
   hs
.execX10ByName("Master Bedroom Robs Closet Light","off")
end If 

Hope this helps...
__________________
Dell P4 1.4Ghz / 2G RAM
HSPRO 2.4.0.1/ Z-Troller / Z-Wave devices / 2 WDTC-20 thermostats
Z-Troller v1.12 / TI-103 / WGL800 / RFXCom / Oregon Scientific Sensors / Motion Sensors / X10 devices / DS10a
Check out Homeseer's YouTube Channel!
Reply With Quote
  #3  
Old August 23rd, 2009, 06:11 PM
tonlof's Avatar
tonlof tonlof is online now
Seer Master
 
Join Date: Apr 2001
Location: Koping,Sweden
Posts: 513
Default

Thank you, I have tried to paste the code but get error.
PHP Code:
2009-08-23 23:06:23  Error Script compile error'#End Region' must be preceded by a matching '#Region'.on line 20
2009
-08-23 23:06:25  SCR Option Strict Offimports Schedulerimports SystemPublic Module scriptcode20#Region "Automatically generated code, do not modify"'Automatically generated code, do not modify'Event Sources Begin    <System.ContextStaticAttribute()> Public WithEvents hs As Scheduler.hsapplication    <System.ContextStaticAttribute()> Public WithEvents hsp As scheduler.hsp    <System.ContextStaticAttribute()> Public WithEvents hssystem As scheduler.phone0'Event Sources End'End of automatically generated code#End RegionDim dm As Object = hs.Plugin("DooMotion")Dim Sensor As Object = dm.GetSensorByRef(4998)#End Region' NOTE: Do NOT change the names of the Sensor procedures. #Region " Custom Action Code for Motion Entre "Sub Sensor7867_On(ByVal Ref As Integer)'Script_Initialize(Ref)'add code here'Script_Terminate()End SubSub Sensor7867_Off(ByVal Ref As Integer)'Script_Initialize(Ref)'add code here'Script_Terminate()End SubSub Test(ByVal parms As Object)If DateDiff("n", Sensor.LastOn, Now) > Sensor.NormalElapsedTime Then hs.speak "Someone is at the front door, Motion at the front door" End SubEnd Module 
I have also tried by housecode

PHP Code:
if(hs.isOff("A8")) then 
    hs
.execX10("A8","on"
end if 
dm.newNoMotionDelayedEvent("Delayed Event Master Bedroom Robs Closet Light""A8:off",2
__________________
Please excuse any spelling and grammatical errors I may make.
--
Tony Lofgren | Sweden
HS Pro, Win 2003, MySQL 5, Dell XPS 3,2GHz 2Gb, 2 striped raptordisk in raid0, Velleman K8055 , TEMP05 V5.00, DS9097, 1Wire Dallas weatherstation, HS PCI Modem, Basic Stamp for I/O, AVS-8X8, Dreambox 7020s. 2pcs xbox 1.6 xbmc connected to HS2.
Reply With Quote
  #4  
Old August 23rd, 2009, 07:11 PM
rmasonjr's Avatar
rmasonjr rmasonjr is offline
Seer Master
 
Join Date: May 2001
Location: Brookhaven, MS USA
Posts: 1,391
Default

Sorry - forgot to mention that I use VB.NET Scripting. In the Options pane, select "Use VB.NET Scripting"
__________________
Dell P4 1.4Ghz / 2G RAM
HSPRO 2.4.0.1/ Z-Troller / Z-Wave devices / 2 WDTC-20 thermostats
Z-Troller v1.12 / TI-103 / WGL800 / RFXCom / Oregon Scientific Sensors / Motion Sensors / X10 devices / DS10a
Check out Homeseer's YouTube Channel!
Reply With Quote
  #5  
Old August 23rd, 2009, 07:13 PM
tonlof's Avatar
tonlof tonlof is online now
Seer Master
 
Join Date: Apr 2001
Location: Koping,Sweden
Posts: 513
Default

I have tried it with and without...
__________________
Please excuse any spelling and grammatical errors I may make.
--
Tony Lofgren | Sweden
HS Pro, Win 2003, MySQL 5, Dell XPS 3,2GHz 2Gb, 2 striped raptordisk in raid0, Velleman K8055 , TEMP05 V5.00, DS9097, 1Wire Dallas weatherstation, HS PCI Modem, Basic Stamp for I/O, AVS-8X8, Dreambox 7020s. 2pcs xbox 1.6 xbmc connected to HS2.
Reply With Quote
  #6  
Old August 23rd, 2009, 07:15 PM
tonlof's Avatar
tonlof tonlof is online now
Seer Master
 
Join Date: Apr 2001
Location: Koping,Sweden
Posts: 513
Default

With vb.net I get this error.
PHP Code:
2009-08-24 00:13:49  SCR Option Strict Offimports Schedulerimports SystemPublic Module scriptcode10#Region "Automatically generated code, do not modify"'Automatically generated code, do not modify'Event Sources Begin     Public WithEvents hs As Scheduler.hsapplication     Public WithEvents hsp As scheduler.hsp     Public WithEvents hssystem As scheduler.phone0'Event Sources End'End of automatically generated code#End RegionDim dm As Object = hs.Plugin("DooMotion")Dim Sensor As Object = dm.GetSensorByRef(4998)'#End Region' NOTE: Do NOT change the names of the Sensor procedures. '#Region " Custom Action Code for Motion test_ljus "Sub Sensor9616_On(Ref)'End SubSub Sensor9616_Off(Ref)'End SubSub Test(ByVal parms As Object)if(hs.isOffByName("Master Bedroom Robs Closet Light")) then    hs.execX10ByName("Master Bedroom Robs Closet Light","on")end ifdm.newNoMotionDelayedEvent("Delayed Event Master Bedroom Robs Closet Light", "Master Bedroom Robs Closet Light:off",2)  End SubEnd Module
2009-08-24 00:13:49  Error Script compile errorStatement cannot appear within a method bodyEnd of method assumed.on line 29 


Do I need any referense in settings.ini?
__________________
Please excuse any spelling and grammatical errors I may make.
--
Tony Lofgren | Sweden
HS Pro, Win 2003, MySQL 5, Dell XPS 3,2GHz 2Gb, 2 striped raptordisk in raid0, Velleman K8055 , TEMP05 V5.00, DS9097, 1Wire Dallas weatherstation, HS PCI Modem, Basic Stamp for I/O, AVS-8X8, Dreambox 7020s. 2pcs xbox 1.6 xbmc connected to HS2.
Reply With Quote
  #7  
Old August 27th, 2009, 10:34 PM
Jim Doolittle's Avatar
Jim Doolittle Jim Doolittle is offline
DooSeer
 
Join Date: Mar 2001
Location: Highland, IN, USA
Posts: 10,175
Default

There appears to be conditions where the plug-in is not doing an adequate job of converting to/from VBScript to VB.NET. If you post your DooMotion.vb file in the DATA\DooMotion folder, I can take a look and correct it manually and perhaps get a clue as to what went wrong with the conversion process.
__________________
Jim Doolittle

My Twitter
My Hardware & Software
Reply With Quote
  #8  
Old August 28th, 2009, 02:43 PM
tonlof's Avatar
tonlof tonlof is online now
Seer Master
 
Join Date: Apr 2001
Location: Koping,Sweden
Posts: 513
Default

Thanks Jim, I did not found the file under DATA\DooMotion but under scripts.
I have only one sensor setup that trying to run script.
Attached Files
File Type: txt DooMotion.vb.txt (4.5 KB, 5 views)
__________________
Please excuse any spelling and grammatical errors I may make.
--
Tony Lofgren | Sweden
HS Pro, Win 2003, MySQL 5, Dell XPS 3,2GHz 2Gb, 2 striped raptordisk in raid0, Velleman K8055 , TEMP05 V5.00, DS9097, 1Wire Dallas weatherstation, HS PCI Modem, Basic Stamp for I/O, AVS-8X8, Dreambox 7020s. 2pcs xbox 1.6 xbmc connected to HS2.
Reply With Quote
  #9  
Old August 28th, 2009, 03:18 PM
Jim Doolittle's Avatar
Jim Doolittle Jim Doolittle is offline
DooSeer
 
Join Date: Mar 2001
Location: Highland, IN, USA
Posts: 10,175
Default

Looks like there is an unwanted apostrophe in front of an "End Region" which explains the error. Shutdown HomeSeer (actually you could remove DooMotion as a plug-in and then add it back when done). Open DooMotion.vb with Windows Notepad and hold down the Ctrl key and press G. Enter line 25 and then remove the apostrophe and save. See if that works. If so, I figured that it was a easy fix because they tend to be hard to find.
__________________
Jim Doolittle

My Twitter
My Hardware & Software
Reply With Quote
  #10  
Old August 28th, 2009, 04:41 PM
tonlof's Avatar
tonlof tonlof is online now
Seer Master
 
Join Date: Apr 2001
Location: Koping,Sweden
Posts: 513
Default

Thanks, but that did now help. I tried to copy the small sample file and start over but I still get error.

PHP Code:
2009-08-28 21:28:18  SCR Option Strict Offimports Schedulerimports SystemPublic Module scriptcode6#Region "Automatically generated code, do not modify"'Automatically generated code, do not modify'Event Sources Begin     Public WithEvents hs As Scheduler.hsapplication     Public WithEvents hsp As scheduler.hsp     Public WithEvents hssystem As scheduler.phone0'Event Sources End'End of automatically generated code#End RegionDim dm As Object = hs.Plugin("DooMotion")Dim Sensor As Object = dm.GetSensorByRef(4998)#End Region' NOTE: Do NOT change the names of the Sensor procedures. #Region " Custom Action Code for  test "Sub Sensor4023_On(ByVal Ref As Integer)'Script_Initialize(Ref)'add code here'Script_Terminate()End SubSub Sensor4023_Off(ByVal Ref As Integer)'Script_Initialize(Ref)'add code here'Script_Terminate()End SubSub Test(ByVal parms As Object)if(hs.isOffByName("Kitchen Plan1 Kok_Matbord")) then    hs.execX10ByName("Kitchen Plan1 Kok_Matbord","on")end ifdm.newNoMotionDelayedEvent("Delayed Kitchen Plan1 Kok_Matbord", "Kitchen Plan1 Kok_Matbord:off",2)End SubEnd Module
2009-08-28 21:28:18  Error Script compile error'#End Region' must be preceded by a matching '#Region'.on line 20 
PHP Code:
#Region " DooMotion generated code - Do not modify code within this Region "

Dim dm As Object
Dim Sensor 
As Object

Sub Script_Initialize
(ByVal Ref As Integer)
dm hs.Plugin("DooMotion")
Sensor dm.GetSensorByRef(Ref)
End Sub

Sub Script_Terminate
()
Sensor Nothing
dm 
Nothing
End Sub

#End Region

' If you wish to call any of the following functions from external scripts,
make sure that Script_Initialize(Refis the first line of the procedure
' and  a Script_Terminate() is the last line of the procedure.
'
Notethat the Script_Initialize and Script_Terminate
' functions will be ignored within the Custom Action Code editor.

#Region " Custom Functions Code - Keep custom functions within this Region"
#End Region

NOTE: Do NOT change the names of the Sensor procedures

#Region " Custom Action Code for  test "

Sub Sensor4023_On(ByVal Ref As Integer)
'Script_Initialize(Ref)
'
add code here
'Script_Terminate()
End Sub

Sub Sensor4023_Off(ByVal Ref As Integer)
'
Script_Initialize(Ref)
'add code here
'
Script_Terminate()
End Sub
#End Region

' NOTE: Do NOT change the names of the Sensor procedures. 

#Region " Custom Action Code for Motion Entre "

Sub Sensor7867_On(ByVal Ref As Integer)
'
Script_Initialize(Ref)
'add code here
'
Script_Terminate()
End Sub

Sub Sensor7867_Off
(ByVal Ref As Integer)
'Script_Initialize(Ref)
'
add code here
'Script_Terminate()
End Sub

#End Region

#Region " Custom Action Code for Motion Toalett "

Sub Sensor1062_On(ByVal Ref As Integer)
'
Script_Initialize(Ref)
'add code here
'
Script_Terminate()
End Sub

Sub Sensor1062_Off
(ByVal Ref As Integer)
'Script_Initialize(Ref)
'
add code here
'Script_Terminate()
End Sub

#End Region

#Region " Custom Action Code for Motion Koket "

Sub Sensor4998_On(ByVal Ref As Integer)
Script_Initialize(Ref)
if(hs.isOffByName("Kitchen Plan1 Kok_Matbord")) then
    hs.execX10ByName("Kitchen Plan1 Kok_Matbord","on")
end if
dm.newNoMotionDelayedEvent("Delayed Kitchen Plan1 Kok_Matbord", "Kitchen Plan1 Kok_Matbord:off",2)
Script_Terminate()
End Sub

Sub Sensor4998_Off(ByVal Ref As Integer)
'
Script_Initialize(Ref)
'add code here
'
Script_Terminate()
End Sub

#End Region

#Region " Custom Action Code for Motion Vardagsrum "

Sub Sensor6737_On(ByVal Ref As Integer)
'Script_Initialize(Ref)
'
add code here
'Script_Terminate()
End Sub

Sub Sensor6737_Off(ByVal Ref As Integer)
'
Script_Initialize(Ref)
'add code here
'
Script_Terminate()
End Sub

#End Region

#Region " Custom Action Code for Motion Vardagsrum "

Sub Sensor8332_On(ByVal Ref As Integer)
'Script_Initialize(Ref)
'
add code here
'Script_Terminate()
End Sub

Sub Sensor8332_Off(ByVal Ref As Integer)
'
Script_Initialize(Ref)
'add code here
'
Script_Terminate()
End Sub

#End Region

#Region " Custom Action Code for Dusk Entre_ljus "

Sub Sensor9616_On(ByVal Ref As Integer)
'Script_Initialize(Ref)
'
add code here
'Script_Terminate()
End Sub

Sub Sensor9616_Off(ByVal Ref As Integer)
'
Script_Initialize(Ref)
'add code here
'
Script_Terminate()
End Sub

#End Region

#Region " Custom Action Code for Dusk Toalett_Ljus "

Sub Sensor1992_On(ByVal Ref As Integer)
'Script_Initialize(Ref)
'
add code here
'Script_Terminate()
End Sub

Sub Sensor1992_Off(ByVal Ref As Integer)
'
Script_Initialize(Ref)
'add code here
'
Script_Terminate()
End Sub

#End Region

#Region " Custom Action Code for Dusk Koket_Ljus "

Sub Sensor2221_On(ByVal Ref As Integer)
'Script_Initialize(Ref)
'
add code here
'Script_Terminate()
End Sub

Sub Sensor2221_Off(ByVal Ref As Integer)
'
Script_Initialize(Ref)
'add code here
'
Script_Terminate()
End Sub

#End Region

#Region " Custom Action Code for Dusk Vardagsrum_Plan2 "

Sub Sensor9711_On(ByVal Ref As Integer)
'Script_Initialize(Ref)
'
add code here
'Script_Terminate()
End Sub

Sub Sensor9711_Off(ByVal Ref As Integer)
'
Script_Initialize(Ref)
'add code here
'
Script_Terminate()
End Sub

#End Region

#Region " Custom Action Code for Dusk Vardagsrum_Ljus "

Sub Sensor7830_On(ByVal Ref As Integer)
'Script_Initialize(Ref)
'
add code here
'Script_Terminate()
End Sub

Sub Sensor7830_Off(ByVal Ref As Integer)
'
Script_Initialize(Ref)
'add code here
'
Script_Terminate()
End Sub

#End Region

#Region " Custom Action Code for Bluetooth BT Device HTC73 "

Sub Sensor5658_On(ByVal Ref As Integer)
'Script_Initialize(Ref)
'
add code here
'Script_Terminate()
End Sub

Sub Sensor5658_Off(ByVal Ref As Integer)
'
Script_Initialize(Ref)
'add code here
'
Script_Terminate()
End Sub

#End Region 
__________________
Please excuse any spelling and grammatical errors I may make.
--
Tony Lofgren | Sweden
HS Pro, Win 2003, MySQL 5, Dell XPS 3,2GHz 2Gb, 2 striped raptordisk in raid0, Velleman K8055 , TEMP05 V5.00, DS9097, 1Wire Dallas weatherstation, HS PCI Modem, Basic Stamp for I/O, AVS-8X8, Dreambox 7020s. 2pcs xbox 1.6 xbmc connected to HS2.
Reply With Quote
  #11  
Old September 3rd, 2009, 07:50 AM
tonlof's Avatar
tonlof tonlof is online now
Seer Master
 
Join Date: Apr 2001
Location: Koping,Sweden
Posts: 513
Default Problem solved

The web interface damaging the code with invisible characters, now I have been using the editor for the action code from the icon and then it started to work immediately
__________________
Please excuse any spelling and grammatical errors I may make.
--
Tony Lofgren | Sweden
HS Pro, Win 2003, MySQL 5, Dell XPS 3,2GHz 2Gb, 2 striped raptordisk in raid0, Velleman K8055 , TEMP05 V5.00, DS9097, 1Wire Dallas weatherstation, HS PCI Modem, Basic Stamp for I/O, AVS-8X8, Dreambox 7020s. 2pcs xbox 1.6 xbmc connected to HS2.
Reply With Quote
  #12  
Old November 24th, 2009, 02:38 PM
czerpi czerpi is offline
Viewer
 
Join Date: Nov 2009
Location: Copenhagen
Posts: 1
Default the same problem

can you tell me how did you solve that problem. I have simillar one ;(
Pawel

2009-11-24 19:21:03 ~!~Error~!~Script compile error: Character is not valid.on line -3
2009-11-24 19:21:03 ~!~SCR~!~Option Strict OffImports Systâę.Iϐ‡Im
Reply With Quote
  #13  
Old November 30th, 2009, 11:18 AM
Jim Doolittle's Avatar
Jim Doolittle Jim Doolittle is offline
DooSeer
 
Join Date: Mar 2001
Location: Highland, IN, USA
Posts: 10,175
Default

Post your DooMotion.txt or DooMotion.vb file in the DATA\DooMotion folder and I will corrrect it.
__________________
Jim Doolittle

My Twitter
My Hardware & Software
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 09:50 AM.


Copyright 1998-2008 HomeSeer Technologies, LLC