User Tools

Site Tools


Sidebar

xtdb:applescript:motionreport

Table of Contents

Motion Report For

Returns a list of values containing the number of “hits” or On events that happened for the Unit during the specified time. Uses the resolution value to break the events into individual list elements each representing this number of seconds. The count value is how many intervals of resolution to return starting at the start date.

for example asking for a start date 60 minutes into the past with a resolution of 5*60 seconds and a count of 12 would result in a report with every motion hit in each 5 minute interval of the last hour being returned in a list with 12 elements.

Usage:

  • motion report for [text: name of the Unit]
    • starting at [date]
    • resolution [integer: how many seconds to group into each return section]
    • count [integer: how many resolution intervals to return]
  • returns a list of numbers

Examples:

A report for the last 24 hours in 5 minute intervals

set myStartDate to (current date) - 1 * hours

tell app “XTdb"
   set myMotionReport to motion report for “Front Door Motion” starting at myStartDate interval 5*minutes count 12
end tell

return the hits for each minute in the last 5 minutes.

set myStartDate to (current date) - 5 * minutes
tell app “XTdb”
   set myMotionReport to motion report for “Front Door Motion” starting at myStartDate interval 60 count 5
end tell
xtdb/applescript/motionreport.txt · Last modified: 2022/04/06 14:02 by James Sentman